[unixODBC-dev] Commiting transations in ODBC

Peter Nolan peter at peternolan.com
Sat Aug 7 23:27:59 BST 2004


Hi All,

I've written an ETL tool and I'd like to introduce the ability to specify
how many statements are executed before a commit is performed. (It
autocommits after each statement at the moment.)

I believe the following statement will set auto commit off...is this
correct?

SQLCODE = SQLSetConnectAttr(DBConnectionHandle, SQL_ATTR_AUTOCOMMIT,
SQL_AUTOCOMMIT_OFF, 0);

I also have a commit function to call SQLendtran as follows:

SQLCODE = SQLEndTran(SQL_HANDLE_DBC,DBConnectionHandle,SQL_COMMIT);

////////////////////////////////////////////////////////////////////////////
//////////////////

// Check the call. //

////////////////////////////////////////////////////////////////////////////
//////////////////

SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;

CALL_RETURNED_OK = SQL_OK ;

return CALL_RETURNED_OK ;

But I have one question....when the SQLEndTran is called, will it cause any
problems to my prepared statements? I have prepared statements for
insert/update/deletes which is what I want to commit. I am guessing there is
no problem because the application is already committing after each call.



Thanks

Peter





More information about the unixODBC-dev mailing list