Skip to content

Commit

Permalink
Use DB engine specific queries for dropping temp table.
Browse files Browse the repository at this point in the history
Fixes #368: Bareos and PostgreSQL errors
  • Loading branch information
Marco van Wieringen committed Nov 25, 2014
1 parent 5d27b84 commit 18d9676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
17 changes: 15 additions & 2 deletions src/cats/sql_cmds.c
Expand Up @@ -95,9 +95,22 @@ const char *sel_JobMedia =
"AND Job.JobTDate<%s";

/* Delete temp tables and indexes */
static const char *drop_deltabs_default =
"DROP TABLE DelCandidates";

const char *drop_deltabs[] = {
"DROP TABLE DelCandidates",
NULL};
/* MySQL */
"DROP TABLE IF EXISTS DelCandidates",

/* Postgresql */
"DROP TABLE IF EXISTS DelCandidates",

/* SQLite3 */
drop_deltabs_default,

/* Ingres */
drop_deltabs_default
};

const char *create_delindex = "CREATE INDEX DelInx1 ON DelCandidates (JobId)";

Expand Down
5 changes: 1 addition & 4 deletions src/dird/ua_prune.c
Expand Up @@ -566,10 +566,7 @@ bool prune_files(UAContext *ua, CLIENTRES *client, POOLRES *pool)

static void drop_temp_tables(UAContext *ua)
{
int i;
for (i=0; drop_deltabs[i]; i++) {
db_sql_query(ua->db, drop_deltabs[i]);
}
db_sql_query(ua->db, drop_deltabs[db_get_type_index(ua->db)]);
}

static bool create_temp_tables(UAContext *ua)
Expand Down

0 comments on commit 18d9676

Please sign in to comment.