Menu

#9 procedure AllocateDbxHStmtNodes

closed-accepted
nobody
None
5
2008-11-17
2008-10-22
No

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?

Discussion

  • Vadim V.Lopushanskiy

    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
    //
    ...

     
  • Vadim V.Lopushanskiy

    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
    ...

     
  • Mozart Hasse

    Mozart Hasse - 2008-11-17
    • status: open --> closed-accepted
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.