]> git.sur5r.net Git - bacula/bacula/commitdiff
Final fix for #1859 missed one query.
authorMarco van Wieringen <mvw@planets.elm.net>
Wed, 5 Sep 2012 07:22:52 +0000 (09:22 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:54 +0000 (14:50 +0200)
bacula/src/cats/sql_cmds.c
bacula/src/cats/sql_cmds.h
bacula/src/cats/sql_create.c

index b60be1f96f2348f327a0f000aa0aaa6d25864399..860def19e3be2b833a2a5a9864b7cf42646e4879 100644 (file)
@@ -1016,6 +1016,27 @@ const char *match_query[] = {
    "~"
 };
 
+static const char *insert_counter_values_default =
+   "INSERT INTO Counters (Counter, MinValue, "
+   "MaxValue, CurrentValue, WrapCounter) "
+   "VALUES ('%s','%d','%d','%d','%s')";
+
+const char *insert_counter_values[] = {
+   /* Mysql */
+   "INSERT INTO Counters (Counter, Counters.MinValue, "
+   "Counters.MaxValue, CurrentValue, WrapCounter) "
+   "VALUES ('%s','%d','%d','%d','%s')",
+
+   /* Postgresql */
+   insert_counter_values_default,
+
+   /* SQLite3 */
+   insert_counter_values_default,
+
+   /* Ingres */
+   insert_counter_values_default
+};
+
 static const char *select_counter_values_default =
    "SELECT MinValue, MaxValue, CurrentValue, WrapCounter "
    "FROM Counters WHERE Counter='%s'";
index ed7c26f7e9a9b204187a2e120ee81a976b37e8af..9ffbc9d93faa2c57baf600ad1723b3859bcf919d 100644 (file)
@@ -84,5 +84,6 @@ extern const char CATS_IMP_EXP *batch_unlock_tables_query[];
 extern const char CATS_IMP_EXP *batch_fill_path_query[];
 extern const char CATS_IMP_EXP *batch_fill_filename_query[];
 extern const char CATS_IMP_EXP *match_query[];
+extern const char CATS_IMP_EXP *insert_counter_values[];
 extern const char CATS_IMP_EXP *select_counter_values[];
 extern const char CATS_IMP_EXP *update_counter_values[];
index a4a6f47222e96ac21f910011209157280fd569fe..cdd7d1aa225f11816478a328eee58eccf8b14280 100644 (file)
@@ -655,9 +655,9 @@ int db_create_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
       return 1;
    }
    mdb->db_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
+
    /* Must create it */
-   Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,Counters.MinValue,Counters.MaxValue,CurrentValue,"
-      "WrapCounter) VALUES ('%s','%d','%d','%d','%s')",
+   Mmsg(mdb->cmd, insert_counter_values[db_get_type_index(mdb)],
         esc, cr->MinValue, cr->MaxValue, cr->CurrentValue,
         cr->WrapCounter);
 
@@ -673,7 +673,6 @@ int db_create_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
    return stat;
 }
 
-
 /**
  * Create a FileSet record. This record is unique in the
  *  name and the MD5 signature of the include/exclude sets.