What about sqlite3_set_authorizer()? Implement a callback function and
monitor changes in transaction state for each connection object:
open_database(...) {
...
sqlite3* db = ...
connection_object* object = ...
sqlite3_set_authorizer(db, auth_handler, (void*)object);
...
}
int auth_handler( void* x, int type, const char* a, const char* b,
const char* c, const char* d )
{
connection_object* object = (connection_object*)x;
if((a != NULL) && (type == SQLITE_TRANSACTION)) {
if(strcmp(operation, "BEGIN") == 0) {
object->autocommit = 1;
}
if(strcmp(operation, "COMMIT")==0) {
object->autocommit = 0;
}
if(strcmp(operation, "ROLLBACK") {
object->autocommit = 0;
}
}
}
On 5/18/05, Will Leshner <[EMAIL PROTECTED]> wrote:
>
> On May 18, 2005, at 7:33 AM, Gerhard Haering wrote:
>
> > Basically I would have that information already if I peeked in the
> > sqlite3 struct, right? But as pysqlite is not just for me
> > personally, I
> > cannot do such hacks ;-) I'd need an API call that returns that
> > flag for
> > me.
>
> I would really like to see such an API call as well. I wonder if it
> wouldn't be as simple as just returning the autoCommit flag?
>