From: Kern Sibbald Date: Sat, 10 Apr 2010 10:14:24 +0000 (+0200) Subject: Revert "We need to fool the Ingres code a bit more to think we are in a transaction... X-Git-Tag: Release-5.0.2~74 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bc52e1d97c2cf85300b173af5b09fac9f7e56c02;p=bacula%2Fbacula Revert "We need to fool the Ingres code a bit more to think we are in a transaction when doing an" This reverts commit 9510b20ea24351f838bf709bb2e99f26bdd9e8e1. --- diff --git a/bacula/src/cats/ingres.c b/bacula/src/cats/ingres.c index 647f84fb9e..b8a85ee5d5 100755 --- a/bacula/src/cats/ingres.c +++ b/bacula/src/cats/ingres.c @@ -678,51 +678,23 @@ bail_out: return id; } -/* - * First execute the insert query and then retrieve the currval. - * By setting transaction to true we make it an atomic transaction - * and as such we can get the currval after which we commit if - * mdb->transaction is false. This way things are an atomic operation - * for Ingres and things work. We save the current transaction status - * and set transaction in the mdb to true and at the end of this - * function we restore the actual transaction status. - */ int my_ingres_insert_id(B_DB *mdb, const char *query, const char *table_name) { - int id = 0; - bool transaction; - - /* - * Save the current transaction status and pretend we are in a transaction. - */ - transaction = mdb->transaction; - mdb->transaction = true; - /* - * Execute the INSERT query. + * First execute the insert query and then retrieve the currval. + * By setting transaction to true we make it an atomic transaction + * and as such we can get the currval after which we commit if + * mdb->transaction is false. This way its an atomic operation for + * Ingres and things work. */ - mdb->num_rows = INGexec(mdb->db, query, mdb->transaction); + mdb->num_rows = INGexec(mdb->db, query, true); if (mdb->num_rows == -1) { - goto bail_out; + return 0; } mdb->changes++; - id = my_ingres_currval(mdb, table_name); - /* - * Commit if we are NOT in a transaction. - */ - if (transaction) { - INGcommit(mdb->db); - } - -bail_out: - /* - * Restore the actual transaction status. - */ - mdb->transaction = transaction; - - return id; + return my_ingres_currval(mdb, table_name); } #ifdef HAVE_BATCH_FILE_INSERT