]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/mysql.c
Tweak some comments and formatting.
[bacula/bacula] / bacula / src / cats / mysql.c
index 4c5bbfbd97fe7062737dfd93389f88c18e75175a..513e4bb5f8f3ce8ee9beca98f61fd9c0a2d275d9 100644 (file)
@@ -116,6 +116,13 @@ B_DB_MYSQL::B_DB_MYSQL(JCR *jcr,
    esc_obj = get_pool_memory(PM_FNAME);
    m_allow_transactions = mult_db_connections;
 
+   /* At this time, when mult_db_connections == true, this is for 
+    * specific console command such as bvfs or batch mode, and we don't
+    * want to share a batch mode or bvfs. In the future, we can change
+    * the creation function to add this parameter.
+    */
+   m_dedicated = mult_db_connections; 
+
    /*
     * Initialize the private members.
     */
@@ -236,10 +243,10 @@ void B_DB_MYSQL::db_close_database(JCR *jcr)
 {
    db_end_transaction(jcr);
    P(mutex);
-   sql_free_result();
    m_ref_count--;
    Dmsg3(100, "closedb ref=%d connected=%d db=%p\n", m_ref_count, m_connected, m_db_handle);
    if (m_ref_count == 0) {
+      sql_free_result();
       db_list->remove(this);
       if (m_connected) {
          Dmsg1(100, "close db=%p\n", m_db_handle);
@@ -296,7 +303,7 @@ void B_DB_MYSQL::db_close_database(JCR *jcr)
 void B_DB_MYSQL::db_thread_cleanup(void)
 { 
 #ifndef HAVE_WIN32
-   my_thread_end();
+   mysql_thread_end();
 #endif
 }
 
@@ -602,7 +609,6 @@ bool B_DB_MYSQL::sql_batch_end(JCR *jcr, const char *error)
  */
 bool B_DB_MYSQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
 {
-   size_t len;
    const char *digest;
    char ed1[50];
 
@@ -618,10 +624,10 @@ bool B_DB_MYSQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
       digest = ar->Digest;
    }
 
-   len = Mmsg(cmd, "INSERT INTO batch VALUES "
-                   "(%u,%s,'%s','%s','%s','%s',%u)",
-                   ar->FileIndex, edit_int64(ar->JobId,ed1), esc_path,
-                   esc_name, ar->attr, digest, ar->DeltaSeq);
+   Mmsg(cmd, "INSERT INTO batch VALUES "
+        "(%u,%s,'%s','%s','%s','%s',%u)",
+        ar->FileIndex, edit_int64(ar->JobId,ed1), esc_path,
+        esc_name, ar->attr, digest, ar->DeltaSeq);
 
    return sql_query(cmd);
 }