From e4c79f3a2a6e9eff312b474fda10e097660e131f Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Mon, 5 Apr 2010 17:15:17 +0200 Subject: [PATCH] Drop have_insert_id in mdb as its always true for all backends. --- bacula/src/cats/cats.h | 6 ------ bacula/src/cats/dbi.c | 1 - bacula/src/cats/ingres.c | 1 - bacula/src/cats/mysql.c | 1 - bacula/src/cats/postgresql.c | 1 - bacula/src/cats/sql.c | 6 +----- bacula/src/cats/sqlite.c | 1 - 7 files changed, 1 insertion(+), 16 deletions(-) diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 5bbd4d7df4..164eec325c 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -135,7 +135,6 @@ struct B_DB { char *db_password; int db_port; /* port for host name address */ bool connected; /* connection made to db */ - bool have_insert_id; /* do not have insert id */ bool fields_defined; /* set when fields defined */ char *sqlite_errmsg; /* error message returned by sqlite */ POOLMEM *errmsg; /* nicely edited error message */ @@ -257,7 +256,6 @@ struct B_DB { char *db_password; int db_port; /* port for host name address */ bool connected; /* connection made to db */ - bool have_insert_id; /* do not have insert id */ bool fields_defined; /* set when fields defined */ char *sqlite_errmsg; /* error message returned by sqlite */ POOLMEM *errmsg; /* nicely edited error message */ @@ -364,7 +362,6 @@ struct B_DB { char *db_address; /* host address */ char *db_socket; /* socket for local access */ int db_port; /* port of host address */ - int have_insert_id; /* do have insert_id() */ bool connected; POOLMEM *errmsg; /* nicely edited error message */ POOLMEM *cmd; /* SQL command string */ @@ -467,7 +464,6 @@ struct B_DB { char *db_address; /* host address */ char *db_socket; /* socket for local access */ int db_port; /* port of host address */ - int have_insert_id; /* do have insert_id() */ bool connected; POOLMEM *errmsg; /* nicely edited error message */ POOLMEM *cmd; /* SQL command string */ @@ -577,7 +573,6 @@ struct B_DB { char *db_socket; /* socket for local access */ int db_port; /* port of host address */ int session_id; /* unique session id */ - int have_insert_id; /* do have insert_id() */ bool connected; POOLMEM *errmsg; /* nicely edited error message */ POOLMEM *cmd; /* SQL command string */ @@ -705,7 +700,6 @@ struct B_DB { char *db_address; /* host address */ char *db_socket; /* socket for local access */ int db_port; /* port of host address */ - int have_insert_id; /* do have insert_id() */ bool connected; POOLMEM *errmsg; /* nicely edited error message */ POOLMEM *cmd; /* SQL command string */ diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index dd2a9bba9c..f721f1fbb2 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -168,7 +168,6 @@ db_init_database(JCR *jcr, const char *db_name, const char *db_user, const char } mdb->db_type = db_type; mdb->db_port = db_port; - mdb->have_insert_id = TRUE; mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ *mdb->errmsg = 0; mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */ diff --git a/bacula/src/cats/ingres.c b/bacula/src/cats/ingres.c index 3553f37953..bc32703a0f 100755 --- a/bacula/src/cats/ingres.c +++ b/bacula/src/cats/ingres.c @@ -130,7 +130,6 @@ db_init_database(JCR *jcr, const char *db_name, const char *db_user, const char } mdb->db_port = db_port; mdb->session_id = ++next_session_id; - mdb->have_insert_id = TRUE; mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ *mdb->errmsg = 0; mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */ diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 5f950fb5c1..1045d24c5d 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -113,7 +113,6 @@ db_init_database(JCR *jcr, const char *db_name, const char *db_user, const char mdb->db_socket = bstrdup(db_socket); } mdb->db_port = db_port; - mdb->have_insert_id = true; mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ *mdb->errmsg = 0; mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */ diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index c5757efced..693b009d39 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -115,7 +115,6 @@ db_init_database(JCR *jcr, const char *db_name, const char *db_user, const char mdb->db_socket = bstrdup(db_socket); } mdb->db_port = db_port; - mdb->have_insert_id = TRUE; mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ *mdb->errmsg = 0; mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */ diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 9d4d580224..e4fdfb512a 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -269,11 +269,7 @@ InsertDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd) } return 0; } - if (mdb->have_insert_id) { - mdb->num_rows = sql_affected_rows(mdb); - } else { - mdb->num_rows = 1; - } + mdb->num_rows = sql_affected_rows(mdb); if (mdb->num_rows != 1) { char ed1[30]; m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"), diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 85bd3258f7..84c33a2155 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -119,7 +119,6 @@ db_init_database(JCR *jcr, const char *db_name, const char *db_user, const char mdb = (B_DB *) malloc(sizeof(B_DB)); memset(mdb, 0, sizeof(B_DB)); mdb->db_name = bstrdup(db_name); - mdb->have_insert_id = true; mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ *mdb->errmsg = 0; mdb->cmd = get_pool_memory(PM_EMSG); /* get command buffer */ -- 2.39.5