I tested the patch wrong; attached is a better patch.
-Corey
diff -Naur bacula-5.0.3+dfsg.orig/src/cats/make_mysql_tables.in
bacula-5.0.3+dfsg/src/cats/make_mysql_tables.in
--- bacula-5.0.3+dfsg.orig/src/cats/make_mysql_tables.in 2010-08-05
07:29:51.000000000 -0700
+++ bacula-5.0.3+dfsg/src/cats/make_mysql_tables.in 2012-05-25
23:33:50.810058531 -0700
@@ -324,8 +324,8 @@
CREATE TABLE Counters (
Counter TINYBLOB NOT NULL,
- MinValue INTEGER DEFAULT 0,
- MaxValue INTEGER DEFAULT 0,
+ `MinValue` INTEGER DEFAULT 0,
+ `MaxValue` INTEGER DEFAULT 0,
CurrentValue INTEGER DEFAULT 0,
WrapCounter TINYBLOB NOT NULL,
PRIMARY KEY (Counter(128))
diff -Naur bacula-5.0.3+dfsg.orig/src/cats/sql_create.c
bacula-5.0.3+dfsg/src/cats/sql_create.c
--- bacula-5.0.3+dfsg.orig/src/cats/sql_create.c 2010-08-05
07:29:51.000000000 -0700
+++ bacula-5.0.3+dfsg/src/cats/sql_create.c 2012-05-27 18:05:45.777048877
-0700
@@ -627,7 +627,7 @@
}
/* Must create it */
- Mmsg(mdb->cmd, "INSERT INTO Counters
(Counter,MinValue,MaxValue,CurrentValue,"
+ Mmsg(mdb->cmd, "INSERT INTO Counters
(Counter,`MinValue`,`MaxValue`,CurrentValue,"
"WrapCounter) VALUES ('%s','%d','%d','%d','%s')",
cr->Counter, cr->MinValue, cr->MaxValue, cr->CurrentValue,
cr->WrapCounter);
diff -Naur bacula-5.0.3+dfsg.orig/src/cats/sql_get.c
bacula-5.0.3+dfsg/src/cats/sql_get.c
--- bacula-5.0.3+dfsg.orig/src/cats/sql_get.c 2010-08-05 07:29:51.000000000
-0700
+++ bacula-5.0.3+dfsg/src/cats/sql_get.c 2012-05-27 18:06:34.705059251
-0700
@@ -730,7 +730,7 @@
SQL_ROW row;
db_lock(mdb);
- Mmsg(mdb->cmd, "SELECT MinValue,MaxValue,CurrentValue,WrapCounter "
+ Mmsg(mdb->cmd, "SELECT `MinValue`,`MaxValue`,CurrentValue,WrapCounter "
"FROM Counters WHERE Counter='%s'", cr->Counter);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
diff -Naur bacula-5.0.3+dfsg.orig/src/cats/sql_update.c
bacula-5.0.3+dfsg/src/cats/sql_update.c
--- bacula-5.0.3+dfsg.orig/src/cats/sql_update.c 2010-08-05
07:29:51.000000000 -0700
+++ bacula-5.0.3+dfsg/src/cats/sql_update.c 2012-05-27 18:06:58.385064115
-0700
@@ -243,7 +243,7 @@
db_lock(mdb);
Mmsg(mdb->cmd,
-"UPDATE Counters SET MinValue=%d,MaxValue=%d,CurrentValue=%d,"
+"UPDATE Counters SET `MinValue`=%d,`MaxValue`=%d,CurrentValue=%d,"
"WrapCounter='%s' WHERE Counter='%s'",
cr->MinValue, cr->MaxValue, cr->CurrentValue,
cr->WrapCounter, cr->Counter);