From: Eric Bollengier Date: Wed, 16 Sep 2009 21:54:52 +0000 (+0200) Subject: Fix sql query for mysql X-Git-Tag: Release-5.0.0~311 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c05ccfae14411711f170c028eac3a07fbed83a56;p=bacula%2Fbacula Fix sql query for mysql --- diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 591a910889..035ebc8dde 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -1089,6 +1089,7 @@ bool db_write_batch_file_records(JCR *jcr) const char *create_temp_basefile[4] = { /* MySQL */ "CREATE TEMPORARY TABLE basefile%lld (" +// "CREATE TABLE basefile%lld (" "Path BLOB NOT NULL," "Name BLOB NOT NULL)", @@ -1228,12 +1229,11 @@ bool db_create_base_file_list(JCR *jcr, B_DB *mdb, char *jobids) } Mmsg(mdb->cmd, create_temp_basefile[db_type], (uint64_t) jcr->JobId); - if (!QUERY_DB(jcr, mdb, mdb->cmd)) { + if (!db_sql_query(mdb, mdb->cmd, NULL, NULL)) { goto bail_out; } - - Mmsg(buf, select_recent_version[db_type], jobids); + Mmsg(buf, select_recent_version[db_type], jobids); Mmsg(mdb->cmd, "CREATE TEMPORARY TABLE new_basefile%lld AS " //"CREATE TABLE new_basefile%lld AS " @@ -1245,7 +1245,7 @@ bool db_create_base_file_list(JCR *jcr, B_DB *mdb, char *jobids) "JOIN Path ON (Path.PathId = Temp.PathId) " "WHERE Temp.FileIndex > 0", (uint64_t)jcr->JobId, buf.c_str()); - ret = QUERY_DB(jcr, mdb, mdb->cmd); + ret = db_sql_query(mdb, mdb->cmd, NULL, NULL); bail_out: db_unlock(mdb); return ret; diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 7063fd2397..73c631b6ed 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1072,11 +1072,11 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, Mmsg(buf, "SELECT Path.Path, Filename.Name, FileIndex, JobId, " "LStat, MD5 " - "FROM ( %s ) AS TEMP " + "FROM ( %s ) AS Temp " "JOIN Filename ON (Filename.FilenameId = Temp.FilenameId) " "JOIN Path ON (Path.PathId = Temp.PathId) " "WHERE FileIndex > 0 ORDER BY JobId, FileIndex ASC",/* Return sorted by JobId, */ - /* FileIndex for restore code */ + /* FileIndex for restore code */ buf2.c_str()); Dmsg1(0, "sql=%s\n", buf.c_str()); #else diff --git a/regress/tests/base-job-test b/regress/tests/base-job-test index 1882e66107..e553749143 100755 --- a/regress/tests/base-job-test +++ b/regress/tests/base-job-test @@ -107,6 +107,8 @@ if [ $? -ne 0 ]; then bstat=2 fi +ls -l ${cwd}/tmp/bacula-restores/tmp/regress/build/accurate/ + ################################################################ p Now do a backup after making few changes ################################################################ @@ -138,6 +140,10 @@ check_two_logs check_restore_diff check_files_written ${cwd}/tmp/log1.out 4 +ls -l ${cwd}/tmp/bacula-restores/tmp/regress/build/accurate/ + +exit 0 + rm -rf ${cwd}/tmp/bacula-restores ################################################################