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_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
+int64_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;
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_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
+int64_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;
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 int my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
+extern int64_t my_mysql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
#else
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_autokey_record (B_DB *mdb, const char *query, const char *table_name);
+int64_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);
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);
-int my_ingres_insert_autokey_record (B_DB *mdb, const char *query, const char *table_name);
+int64_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);
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);
-int my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
+int64_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);
db_unlock(mdb);
}
-static int my_postgresql_currval(B_DB *mdb, const char *table_name)
+static int64_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.
char sequence[NAMEDATALEN-1];
char query [NAMEDATALEN+50];
PGresult *result;
- int id = 0;
+ int64_t id = 0;
if (strcasecmp(table_name, "basefiles") == 0) {
bstrncpy(sequence, "basefiles_baseid", sizeof(sequence));
if (PQresultStatus(result) == PGRES_TUPLES_OK) {
Dmsg0(500, "getting value");
- id = atoi(PQgetvalue(result, 0, 0));
+ id = str_to_int64(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);
return id;
}
-int my_postgresql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name)
+int64_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.