From: Marco van Wieringen Date: Mon, 30 Aug 2010 09:42:44 +0000 (+0200) Subject: Tweak insert_autokey to use unsigned int64 instead of signed int64. X-Git-Tag: Release-7.0.0~1569 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cd0826785c0dc9a1cf1fccaeffe7f94e7a2647cc;p=bacula%2Fbacula Tweak insert_autokey to use unsigned int64 instead of signed int64. --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index aaf0e58e9a..f0767ea507 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -198,7 +198,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); -int64_t my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); +uint64_t my_sqlite_insert_autokey_record(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; @@ -326,7 +326,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); -int64_t my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); +uint64_t my_sqlite_insert_autokey_record(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; @@ -414,7 +414,7 @@ extern const char* my_mysql_batch_unlock_tables_query; extern const char* my_mysql_batch_fill_filename_query; extern const char* my_mysql_batch_fill_path_query; extern void my_mysql_free_result(B_DB *mdb); -extern int64_t my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); +extern uint64_t my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); #else @@ -485,7 +485,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); -int64_t my_postgresql_insert_autokey_record (B_DB *mdb, const char *query, const char *table_name); +uint64_t my_postgresql_insert_autokey_record (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); @@ -596,7 +596,7 @@ void my_ingres_data_seek (B_DB *mdb, int row); void my_ingres_field_seek (B_DB *mdb, int row); INGRES_FIELD * my_ingres_fetch_field(B_DB *mdb); void my_ingres_close (B_DB *mdb); -int64_t my_ingres_insert_autokey_record (B_DB *mdb, const char *query, const char *table_name); +uint64_t my_ingres_insert_autokey_record (B_DB *mdb, const char *query, const char *table_name); bool my_ingres_batch_start(JCR *jcr, B_DB *mdb); bool my_ingres_batch_end(JCR *jcr, B_DB *mdb, const char *error); @@ -725,7 +725,7 @@ const char * my_dbi_strerror (B_DB *mdb); int my_dbi_getisnull (dbi_result *result, int row_number, int column_number); char * my_dbi_getvalue (dbi_result *result, int row_number, unsigned int column_number); //int my_dbi_getvalue (dbi_result *result, int row_number, unsigned int column_number, char *value); -int64_t my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); +uint64_t my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name); int my_dbi_batch_start(JCR *jcr, B_DB *mdb); int my_dbi_batch_end(JCR *jcr, B_DB *mdb, const char *error); diff --git a/bacula/src/cats/dbi.c b/bacula/src/cats/dbi.c index b4b0f6500a..53f0ea5760 100644 --- a/bacula/src/cats/dbi.c +++ b/bacula/src/cats/dbi.c @@ -1232,7 +1232,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 uint64_t my_dbi_sequence_last(B_DB *mdb, const char *table_name) { /* Obtain the current value of the sequence that @@ -1275,7 +1275,7 @@ static int my_dbi_sequence_last(B_DB *mdb, const char *table_name) return id; } -int64_t my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) +uint64_t my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) { /* * First execute the insert query and then retrieve the currval. diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 5b31d2b728..a7dfe465a5 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -411,7 +411,7 @@ void my_mysql_free_result(B_DB *mdb) db_unlock(mdb); } -int64_t my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) +uint64_t my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) { /* * First execute the insert query and then retrieve the currval. diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index bcd1466b9e..959baf75ed 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -650,7 +650,7 @@ void my_postgresql_free_result(B_DB *mdb) db_unlock(mdb); } -static int64_t my_postgresql_currval(B_DB *mdb, const char *table_name) +static uint64_t my_postgresql_currval(B_DB *mdb, const char *table_name) { // Obtain the current value of the sequence that // provides the serial value for primary key of the table. @@ -671,7 +671,7 @@ static int64_t my_postgresql_currval(B_DB *mdb, const char *table_name) char sequence[NAMEDATALEN-1]; char query [NAMEDATALEN+50]; PGresult *result; - int64_t id = 0; + uint64_t id = 0; if (strcasecmp(table_name, "basefiles") == 0) { bstrncpy(sequence, "basefiles_baseid", sizeof(sequence)); @@ -702,7 +702,7 @@ static int64_t my_postgresql_currval(B_DB *mdb, const char *table_name) if (PQresultStatus(result) == PGRES_TUPLES_OK) { Dmsg0(500, "getting value"); - id = str_to_int64(PQgetvalue(result, 0, 0)); + id = str_to_uint64(PQgetvalue(result, 0, 0)); Dmsg2(500, "got value '%s' which became %d\n", PQgetvalue(result, 0, 0), id); } else { Dmsg1(50, "Result status failed: %s\n", query); @@ -715,7 +715,7 @@ bail_out: return id; } -int64_t my_postgresql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) +uint64_t my_postgresql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) { /* * First execute the insert query and then retrieve the currval. diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index ccfa9f4c73..bc2458a731 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -556,7 +556,7 @@ SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb) } } -int64_t my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) +uint64_t my_sqlite_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name) { /* * First execute the insert query and then retrieve the currval.