procedure AllocateDbxHStmtNodes
Brought to you by:
edwardbenson
I was checking memory allocation and pointer use in dbxopenodbc.pas and this procedure looks strange. It is prepared to accept and use a PDbxConStmtInfo pointer, however sometimes it is called with a PDbxConStmt. Is that correct ?! Shouldn't we have other procedure for this particular case?
fixed:
function TSqlConnectionOdbc.FindFreeConnection;//(out DbxConStmtInfo: TDbxConStmtInfo;
...
function IsFreeDbxConStmt(aDbxConStmt: PDbxConStmt): Boolean;
...
if aDbxConStmt.fOutOfDateCon then
exit;
DbxConStmtInfo.fDbxConStmt := aDbxConStmt;
// Search of "not allocated SqlHStmt Statement ( == SQL_NULL_HANDLE)":
if aDbxConStmt.fNullDbxHStmtNodes = nil then
begin
iAddCount := fStatementPerConnection - aDbxConStmt.fSqlHStmtAllocated;
if iAddCount > cStatementPerConnectionBlockCount then
iAddCount := cStatementPerConnectionBlockCount;
AllocateDbxHStmtNodes(@DbxConStmtInfo, {allocate new statements buffer}iAddCount);
end;
DbxHStmtNode := aDbxConStmt.fNullDbxHStmtNodes;
aDbxConStmt.fNullDbxHStmtNodes := DbxHStmtNode.fNextDbxHStmtNode;
if Assigned(DbxHStmtNode.fNextDbxHStmtNode) then
DbxHStmtNode.fNextDbxHStmtNode.fPrevDbxHStmtNode := nil;
DbxConStmtInfo.fDbxHStmtNode := DbxHStmtNode;
Result := True;
end;
end;
// ---
begin
//
// use only when sStatementsPerConnection > 0
//
...
update your source to Version 3.205 2008-11-10
http://open-dbexpress.cvs.sourceforge.net/open-dbexpress/dbxoodbc/
changes:
DbxOpenOdbc.inc DbxObjectParser.pas DbxOpenOdbc.pas DbxOpenOdbc3.pas DbxOpenOdbcInterface.pas DbxOpenOdbcTrace.pas OdbcApi.pas DbxOpenOdbcCallback.pas DbxOpenOdbcFuncs.pas
Version 3.205, 2008-11-11
-------------------------
+ fixed connection when transaction is not unsupported (dbf, xls, csv)
+ fixed allocate connection/stmt when connection per statement > 0
+ changes for parsing object names
+ added more callback messages
+ update demo DbExplor: added sheet SQL Monitor
+ added demos for execel, dbf,
todo: csv
+ fixed read tables list for excel (msjet odbc bug)
+ fixed msject read table names for Dbx3 (dbf, csv: msjet odbc bug)
+ fixed update string fields over msject (dbf)
+ added supports unicode metadata (dbx3) for:
table name
todo: column name
proc name
index name
...