April 25, 2024, 12:56:35 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Transaction support?

Started by Dogge, May 02, 2007, 04:08:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dogge

How are transactions working in the Easy Database command set?
Is every dbExecSQL and dbExecute committed automatically?
Can I create my own transaction by doing
dbExecSQL(pConnection,"BEGIN")
...sql statements...
dbExecSQL(pConnection,"COMMIT")

I didn't get any error from my PostgreSQL database doing this, but I didn't test it doing a "ROLLBACK"


Rod

AutoCommit is normally a setting in the ODBC connection, and is dependent on which database you're connecting to. If you're not using AutoCommit, the statements to begin, commit, and roll back a transaction depend on what the database understands, but it's usually something like BEGIN TRANSACTION, COMMIT TRANSACTION, and ROLLBACK TRANSACTION.

So, I think you're on the right track, but just need to check that setting in the ODBC connection. The syntax depends on what the driver accepts. The Microsoft ODBC driver, for example, accepts "AUTOCOMMIT=1" (set ON) or "AUTOCOMMIT=0" (set OFF). The IBM driver for DB2 accepts "TRUEAUTOCOMMIT=1" (or =0).

Hope that helps a bit!  :)

Dogge

Thanks, now I know where I should start looking, I'll update the thread once I find it.
/Douglas