ODBC transactions

4 views
Skip to first unread message

Michael I

unread,
Jun 16, 2009, 1:10:27 AM6/16/09
to JSDB
Hi
Does JSDB ODBC interface supports transactions ?, I haven't found any
info in documentation.
And if not is it planned ?

Michael

Jason S

unread,
Jul 3, 2009, 3:31:27 PM7/3/09
to JSDB
Not currently (as far as I can tell) -- you can, however, perform
transactions manually in SQL w/o too much trouble:

var O = new ODBC(...);
var success = false;
try {
O.exec("START TRANSACTION;");
...
success = true;
}
catch (error)
{
}
finally
{
O.exec(success ? "COMMIT" : "ROLLBACK");

Michael I

unread,
Jul 15, 2009, 8:05:58 AM7/15/09
to JSDB
Hi Jason
Thanks for your answer :)

In my database server (firebird) when I issue START TRANSACTION I got
an error:
[HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 1
START(-104)

So I think that this doesn't work in this particular dbms :(

But lately I modified JSDB to allow transactions,
I added two functions
commit() and rollback()
and disabled the autocommit option.

I sended my changes to Shanti.

Michael

Shanti Rao

unread,
Jul 16, 2009, 6:30:07 PM7/16/09
to JSDB
Hi Michael,

Your message arrived too late for this week's 1.7.3.4 release. I'll
put it in the next one, with begin() (which stops auto-commit), commit
() and rollback() functions.

SQL is like Latin: knowing it will help you read the Romance
languages, but not hear, speak or write them. If you stick to the
Table interface, your code will be portable to another database. What
a pity that we JSDB is cross-platform, but SQL is still not cross-
DBMS. I suspect that there are only two SQL commands which work on all
databases:

SELECT * FROM name
DELETE TABLE name

Thanks,

Shanti
Reply all
Reply to author
Forward
0 new messages