From: Marco van Wieringen Date: Mon, 5 Apr 2010 13:42:24 +0000 (+0200) Subject: Lets call it COMMIT and not END as that seems to be the counterpart of BEGIN for... X-Git-Tag: Release-5.0.2~102 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=683329b67a22094295bcc6d50d2852718fe11cd7;p=bacula%2Fbacula Lets call it COMMIT and not END as that seems to be the counterpart of BEGIN for transactions. Updated Ingres lock queries to only start a transaction as the current SQL is not valid Ingres SQL. --- diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index fad2d03fa4..dd2a9bba9c 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -1274,7 +1274,10 @@ const char *my_dbi_batch_lock_path_query[4] = { /* SQLite */ "BEGIN", /* SQLite3 */ - "BEGIN"}; + "BEGIN", + /* Ingres */ + "BEGIN" +}; const char *my_dbi_batch_lock_filename_query[4] = { /* Mysql */ @@ -1284,7 +1287,10 @@ const char *my_dbi_batch_lock_filename_query[4] = { /* SQLite */ "BEGIN", /* SQLite3 */ - "BEGIN"}; + "BEGIN", + /* Ingres */ + "BEGIN" +}; const char *my_dbi_batch_unlock_tables_query[4] = { /* Mysql */ @@ -1314,7 +1320,13 @@ const char *my_dbi_batch_fill_path_query[4] = { /* SQLite3 */ "INSERT INTO Path (Path)" " SELECT DISTINCT Path FROM batch" - " EXCEPT SELECT Path FROM Path"}; + " EXCEPT SELECT Path FROM Path", + /* Ingres */ + "INSERT INTO Path (Path) " + "SELECT a.Path FROM " + "(SELECT DISTINCT Path FROM batch) AS a " + "WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) " +}; const char *my_dbi_batch_fill_filename_query[4] = { /* Mysql */ @@ -1335,7 +1347,14 @@ const char *my_dbi_batch_fill_filename_query[4] = { /* SQLite3 */ "INSERT INTO Filename (Name)" " SELECT DISTINCT Name FROM batch " - " EXCEPT SELECT Name FROM Filename"}; + " EXCEPT SELECT Name FROM Filename", + /* Ingres */ + "INSERT INTO Filename (Name) " + "SELECT a.Name FROM " + "(SELECT DISTINCT Name FROM batch) as a " + "WHERE NOT EXISTS " + "(SELECT Name FROM Filename WHERE Name = a.Name)" +}; #endif /* HAVE_BATCH_FILE_INSERT */ diff --git a/bacula/src/cats/ingres.c b/bacula/src/cats/ingres.c index c8799a7cfd..9d68edac4e 100755 --- a/bacula/src/cats/ingres.c +++ b/bacula/src/cats/ingres.c @@ -561,7 +561,7 @@ int my_ingres_query(B_DB *mdb, const char *query) Dmsg0(500,"my_ingres_query: Start of transaction\n"); mdb->transaction = true; return 0; - } else if (strcasecmp(new_query, "END") != NULL) { + } else if (strcasecmp(new_query, "COMMIT") != NULL) { /* * End of a transaction. */ @@ -776,12 +776,9 @@ char *my_ingres_copy_escape(char *dest, char *src, size_t len) } #ifdef HAVE_BATCH_FILE_INSERT -const char *my_ingres_batch_lock_path_query = - "BEGIN; LOCK TABLE Path IN SHARE ROW EXCLUSIVE MODE"; +const char *my_ingres_batch_lock_path_query = "BEGIN"; - -const char *my_ingres_batch_lock_filename_query = - "BEGIN; LOCK TABLE Filename IN SHARE ROW EXCLUSIVE MODE"; +const char *my_ingres_batch_lock_filename_query = "BEGIN"; const char *my_ingres_batch_unlock_tables_query = "COMMIT";