Merge pull request #4282 from BOINC/rytiss-db-insertid-long

Make DB_BASE::insert_id() correctly return numbers exceeding 32bits
This commit is contained in:
David Anderson 2021-03-26 20:23:50 -07:00 committed by GitHub
commit 7b7638ff91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ int DB_CONN::affected_rows() {
return (int)x; return (int)x;
} }
int DB_CONN::insert_id() { DB_ID_TYPE DB_CONN::insert_id() {
int retval; int retval;
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES* rp; MYSQL_RES* rp;
@ -162,7 +162,7 @@ int DB_CONN::insert_id() {
if (retval) return retval; if (retval) return retval;
rp = mysql_store_result(mysql); rp = mysql_store_result(mysql);
row = mysql_fetch_row(rp); row = mysql_fetch_row(rp);
int x = atoi(row[0]); DB_ID_TYPE x = atol(row[0]);
mysql_free_result(rp); mysql_free_result(rp);
return x; return x;
} }

View File

@ -71,7 +71,7 @@ public:
int do_query(const char*); int do_query(const char*);
int affected_rows(); int affected_rows();
void close(); void close();
int insert_id(); DB_ID_TYPE insert_id();
void print_error(const char*); void print_error(const char*);
const char* error_string(); const char* error_string();
int ping(); int ping();