Sack Library Documentation
ContentsIndexReferenceHome
PreviousUpNext
sack::sql::ODBC Type
C++
typedef struct odbc_handle_tag ODBC;

This is the connection object that provides interface to the database. Can be NULL to specify the default connection interface. See namespace sql

 

An ODBC connection handles commands as a stack. Each command is done as a temporary entry on the stack. A query is done as an entry on the stack, but the entry remains on the stack until the final result is retrieved or an early PopODBC is called. 

 

The structure of this is such that if a command is slow to a database, it would be possible to stack commands that are temporary and pending until the database connection is restored.

int f( void )
{
    // results from the query
    CTEXTSTR *results;
    // connect.
    PODBC odbc = ConnectToDatabase( "system_dsn_name" );
    // do a command, does a temporary entry on the stack, unless the database is slow
    SQLCommandf( odbc, "create temporary table my_test_table( ID int, value int )" );
    // start a new entry on the command stack.
    SQLRecordQueryf( odbc, NULL, &results, NULL, "select 1+1" );
    // when this command is done, it is stacked on the query.
    SQLCommandf( odbc, "insert into my_test_table (value) values(%d)", 1234 );
    // at this point there is technically 2 entries on the command stack until the next
    // FetchSQLResult( odbc, &results );
}
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!