From: Marco van Wieringen Date: Mon, 5 Apr 2010 19:57:58 +0000 (+0200) Subject: Fix some typos and some forgotten things. Now the code at least compiles for all... X-Git-Tag: Release-5.2.1~1525 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3910f0db202d05f113388884fa5e3d936b200efc;p=bacula%2Fbacula Fix some typos and some forgotten things. Now the code at least compiles for all backends. --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 8f580e3a1e..8e25b0f254 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -291,24 +291,23 @@ struct B_DB { * * S Q L I T E 3 */ -#define sql_store_result(x) (x)->result -#define sql_free_result(x) my_sqlite_free_table(x) -#define sql_fetch_row(x) my_sqlite_fetch_row(x) -#define sql_query(x, y) my_sqlite_query((x), (y)) +#define sql_store_result(x) (x)->result +#define sql_free_result(x) my_sqlite_free_table(x) +#define sql_fetch_row(x) my_sqlite_fetch_row(x) +#define sql_query(x, y) my_sqlite_query((x), (y)) +#define sql_insert_id(x, y, z) my_sqlite_sql_insert_id((x), (y), (z)) #ifdef HAVE_SQLITE3 -#define sql_insert_id(x,y) sqlite3_last_insert_rowid((x)->db) -#define sql_close(x) sqlite3_close((x)->db) +#define sql_close(x) sqlite3_close((x)->db) #else -#define sql_insert_id(x,y) sqlite_last_insert_rowid((x)->db) -#define sql_close(x) sqlite_close((x)->db) +#define sql_close(x) sqlite_close((x)->db) #endif -#define sql_strerror(x) (x)->sqlite_errmsg?(x)->sqlite_errmsg:"unknown" -#define sql_num_rows(x) (x)->nrow -#define sql_data_seek(x, i) (x)->row = (i) -#define sql_affected_rows(x) sqlite3_changes((x)->db) -#define sql_field_seek(x, y) my_sqlite_field_seek((x), (y)) -#define sql_fetch_field(x) my_sqlite_fetch_field(x) -#define sql_num_fields(x) ((x)->ncolumn) +#define sql_strerror(x) (x)->sqlite_errmsg?(x)->sqlite_errmsg:"unknown" +#define sql_num_rows(x) (x)->nrow +#define sql_data_seek(x, i) (x)->row = (i) +#define sql_affected_rows(x) sqlite3_changes((x)->db) +#define sql_field_seek(x, y) my_sqlite_field_seek((x), (y)) +#define sql_fetch_field(x) my_sqlite_fetch_field(x) +#define sql_num_fields(x) ((x)->ncolumn) #define sql_batch_start(x,y) my_batch_start(x,y) #define sql_batch_end(x,y,z) my_batch_end(x,y,z) #define sql_batch_insert(x,y,z) my_batch_insert(x,y,z) @@ -326,6 +325,7 @@ SQL_ROW my_sqlite_fetch_row(B_DB *mdb); int my_sqlite_query(B_DB *mdb, const char *cmd); void my_sqlite_field_seek(B_DB *mdb, int field); SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb); +int my_sqlite_sql_insert_id(B_DB *mdb, const char *query, const char *table_name); extern const char* my_sqlite_batch_lock_query; extern const char* my_sqlite_batch_unlock_query; extern const char* my_sqlite_batch_fill_filename_query; @@ -486,7 +486,7 @@ void my_postgresql_free_result(B_DB *mdb); POSTGRESQL_ROW my_postgresql_fetch_row (B_DB *mdb); int my_postgresql_query (B_DB *mdb, const char *query); void my_postgresql_data_seek (B_DB *mdb, int row); -int my_postgresql_insert_id (B_DB *mdb, const char *query, const char *table_name) +int my_postgresql_insert_id (B_DB *mdb, const char *query, const char *table_name); void my_postgresql_field_seek (B_DB *mdb, int row); POSTGRESQL_FIELD * my_postgresql_fetch_field(B_DB *mdb); diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index d178bc3ebe..8a99519916 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -1229,7 +1229,7 @@ char *my_dbi_getvalue(dbi_result *result, int row_number, unsigned int column_nu return buf; } -static int my_dbi_sequence_last(B_DB *mdb, char *table_name) +static int my_dbi_sequence_last(B_DB *mdb, const char *table_name) { /* Obtain the current value of the sequence that diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 2d7264c844..f283416204 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -385,7 +385,7 @@ int my_mysql_sql_insert_id(B_DB *mdb, const char *query, const char *table_name) /* * First execute the insert query and then retrieve the currval. */ - if (!mysql_query(mdb, query)) { + if (!mysql_query(mdb->db, query)) { return 0; } diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 417e5a8842..218725e5a8 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -446,7 +446,7 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) Dmsg1(500, "Create Volume: %s\n", mdb->cmd); - mr->MediaId = sql_insert_id(mdb, mdb->cmd), NT_("Media")); + mr->MediaId = sql_insert_id(mdb, mdb->cmd, NT_("Media")); if (mr->MediaId == 0) { Mmsg2(&mdb->errmsg, _("Create DB Media record %s failed. ERR=%s\n"), mdb->cmd, sql_strerror(mdb));