]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/sqlite.c
Print block errors once + add RunAfterFailedJob + improve db_find_job_start_time...
[bacula/bacula] / bacula / src / cats / sqlite.c
index acf91cde323c98d503c79bdb475193eded1195be..754ae338558272ff08dc96c64f264bac6d8e43e9 100644 (file)
@@ -51,7 +51,7 @@ static BQUEUE db_list = {&db_list, &db_list};
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
+int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
 
 
 /*
@@ -59,7 +59,7 @@ int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
  * never have errors, or it is really fatal.
  */
 B_DB *
-db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
+db_init_database(JCR *jcr, char *db_name, char *db_user, char *db_password,
                 char *db_address, int db_port, char *db_socket) 
 {
    B_DB *mdb;
@@ -98,7 +98,7 @@ db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
  * which are returned in the errmsg
  */
 int
-db_open_database(void *jcr, B_DB *mdb)
+db_open_database(JCR *jcr, B_DB *mdb)
 {
    char *db_name;
    int len;
@@ -159,7 +159,7 @@ db_open_database(void *jcr, B_DB *mdb)
 }
 
 void
-db_close_database(void *jcr, B_DB *mdb)
+db_close_database(JCR *jcr, B_DB *mdb)
 {
    P(mutex);
    mdb->ref_count--;
@@ -187,7 +187,7 @@ db_close_database(void *jcr, B_DB *mdb)
  * Return the next unique index (auto-increment) for
  * the given table.  Return 0 on error.
  */
-int db_next_index(void *jcr, B_DB *mdb, char *table, char *index)
+int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index)
 {
    SQL_ROW row;
 
@@ -226,7 +226,7 @@ int db_next_index(void *jcr, B_DB *mdb, char *table, char *index)
  * Escape strings so that SQLite is happy
  *
  *   NOTE! len is the length of the old string. Your new
- *        string must be long enough (max 2*old) to hold
+ *        string must be long enough (max 2*old+1) to hold
  *        the escaped output.
  */
 void
@@ -406,7 +406,7 @@ list_dashes(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx)
  * list on one line horizontally.      
  */
 void
-list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, int full_list)
+list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type)
 {
    SQL_FIELD *field;
    SQL_ROW row;
@@ -422,7 +422,7 @@ list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, int full_list)
    for (i = 0; i < sql_num_fields(mdb); i++) {
       field = sql_fetch_field(mdb);
       col_len = strlen(field->name);
-      if (full_list) {
+      if (type == VERT_LIST) {
         if (col_len > max_len) {
            max_len = col_len;
         }
@@ -440,8 +440,8 @@ list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, int full_list)
       }
    }
 
-   if (full_list) {
-      goto horizontal_list;
+   if (type == VERT_LIST) {
+      goto vertical_list;
    }
 
    list_dashes(mdb, send, ctx);
@@ -475,7 +475,7 @@ list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, int full_list)
    list_dashes(mdb, send, ctx);
    return;
 
-horizontal_list:
+vertical_list:
    
    while ((row = sql_fetch_row(mdb)) != NULL) {
       sql_field_seek(mdb, 0);