Any feedback of this?

Ronen Mizrahi wrote:

Hello,

In sqlite3 "END TRANSACTION" and "COMMIT" are synonyms, yet the code below, taken from the svn head of apr_dbd_sqlite3.c, invokes them both resulting in sqlite returning an SQL error when doing the commit becuase there is no active transaction. Can someone that knows sqlite better please check it and confirm this? I would like to know if I am correct or I am missing something. As a side comment, in case you are wondering, I just realized that this issue was not detected earlier due to various bugs in dbd_sqlite3_query() (now they are fixed, thank you to whoever fixed them, BTW) that prevented the correct error code from being returned.

Thank you,

Ronen

static int dbd_sqlite3_end_transaction(apr_dbd_transaction_t *trans)
{
   int ret = 0;
   int nrows = 0;

   if (trans) {
ret = dbd_sqlite3_query(trans->handle, &nrows, "END TRANSACTION;");
       if (trans->errnum) {
           trans->errnum = 0;
           ret = dbd_sqlite3_query(trans->handle, &nrows, "ROLLBACK;");
       } else {
           ret = dbd_sqlite3_query(trans->handle, &nrows, "COMMIT;");
       }
       trans->handle->trans = NULL;
   }

   return ret;
}


Reply via email to