From: Kern Sibbald Date: Sat, 10 Apr 2010 10:15:35 +0000 (+0200) Subject: Revert "Fix some typos and some forgotten things. Now the code at least compiles... X-Git-Tag: Release-5.0.2~66 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=03b05dbaf3773d63f7e8ddd8b5eef511ad9aea5d;p=bacula%2Fbacula Revert "Fix some typos and some forgotten things. Now the code at least compiles for all backends." This reverts commit 11a33ed8e43b341d5d0319e431e996245103a5d9. --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 688bff4935..f4e49f6dcb 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -291,23 +291,24 @@ 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_insert_id(x, y, z) my_sqlite_sql_insert_id((x), (y), (z)) +#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)) #ifdef HAVE_SQLITE3 -#define sql_close(x) sqlite3_close((x)->db) +#define sql_insert_id(x,y) sqlite3_last_insert_rowid((x)->db) +#define sql_close(x) sqlite3_close((x)->db) #else -#define sql_close(x) sqlite_close((x)->db) +#define sql_insert_id(x,y) sqlite_last_insert_rowid((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) @@ -325,7 +326,6 @@ 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 01cbd5f893..eb77308562 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -1221,7 +1221,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, const char *table_name) +static int my_dbi_sequence_last(B_DB *mdb, 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 dc3e97c35e..0d079ae058 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -378,7 +378,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->db, query)) { + if (!mysql_query(mdb, query)) { return 0; } diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index eeaa2cc51c..0508351cdb 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -438,7 +438,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));