+
+#ifdef HAVE_DBI
+ if (db_type == SQL_TYPE_SQLITE) {
+ if (!mdb->allow_transactions) {
+ return;
+ }
+ db_lock(mdb);
+ /* Allow only 10,000 changes per transaction */
+ if (mdb->transaction && mdb->changes > 10000) {
+ db_end_transaction(jcr, mdb);
+ }
+ if (!mdb->transaction) {
+ //my_sqlite_query(mdb, "BEGIN"); /* begin transaction */
+ db_sql_query(mdb, "BEGIN", NULL, NULL); /* begin transaction */
+ Dmsg0(400, "Start SQLite transaction\n");
+ mdb->transaction = 1;
+ }
+ db_unlock(mdb);
+ } else if (db_type == SQL_TYPE_POSTGRESQL) {
+ if (!mdb->allow_transactions) {
+ return;
+ }
+ db_lock(mdb);
+ /* Allow only 25,000 changes per transaction */
+ if (mdb->transaction && mdb->changes > 25000) {
+ db_end_transaction(jcr, mdb);
+ }
+ if (!mdb->transaction) {
+ db_sql_query(mdb, "BEGIN", NULL, NULL); /* begin transaction */
+ Dmsg0(400, "Start PosgreSQL transaction\n");
+ mdb->transaction = 1;
+ }
+ db_unlock(mdb);
+ }
+#endif