Here's one I can't find any documentation for anywhere...can someone please help?
If I connect to a database via ODBC, then change the commit mode from AUTO_COMMIT (the default for ODBC connections) to manual commit mode; I know "SqlEndTran handleType, handle, SQL_COMMIT | SQL ROLLBACK" is required to "complete" an INSERT or UPDATE operation.
But what about "completing " SELECT statment?
I have seen code that COMMITs after a SELECT and other code which doesn't.
Seems to me COMMIT or ROLLBACK should be "moot" if there is nothing to commit or roll back (i.e, only SELECTs executed on the handle since last commit or rollback), but I just cannot find any definitive and/or authoritative documentation on this.
FWIW, I am settin the commit mode on the Connection handle (not the Environment handle); and am currently debating with myself if for this application I should hold the connection open whilst I periodically monitor a column value. I.e., the application - essentially a "batch" process, although I do have a "quit waiting" button available - does this:
My other option is to just connect in default (autocommit) mode, which is what I will probably end up doing. (This application also does INSERTs and UPDATEs, so I will need to use Manual Commit mode in those parts of the program).
Any comments?
Thanks,
MCM
If I connect to a database via ODBC, then change the commit mode from AUTO_COMMIT (the default for ODBC connections) to manual commit mode; I know "SqlEndTran handleType, handle, SQL_COMMIT | SQL ROLLBACK" is required to "complete" an INSERT or UPDATE operation.
But what about "completing " SELECT statment?
I have seen code that COMMITs after a SELECT and other code which doesn't.
Seems to me COMMIT or ROLLBACK should be "moot" if there is nothing to commit or roll back (i.e, only SELECTs executed on the handle since last commit or rollback), but I just cannot find any definitive and/or authoritative documentation on this.
FWIW, I am settin the commit mode on the Connection handle (not the Environment handle); and am currently debating with myself if for this application I should hold the connection open whilst I periodically monitor a column value. I.e., the application - essentially a "batch" process, although I do have a "quit waiting" button available - does this:
Code:
DO SELECT column from table where condition ***COMMIT OR ROLLBACK HERE? *** IF column = target value EXIT DO ELSE Wait five (5) or ten (10) seconds ' either value perfectly acceptable for this application END IF LOOP ... more cool stuff goes here
Any comments?
Thanks,
MCM
Comment