Skip to content

Commit

Permalink
Make DB_BASE::insert_id() correctly return numbers exceeding 32bits
Browse files Browse the repository at this point in the history
  • Loading branch information
Rytis Slatkevičius committed Mar 24, 2021
1 parent bdae15b commit 75b7b64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db/db_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int DB_CONN::affected_rows() {
return (int)x;
}

int DB_CONN::insert_id() {
DB_ID_TYPE DB_CONN::insert_id() {
int retval;
MYSQL_ROW row;
MYSQL_RES* rp;
Expand All @@ -162,7 +162,7 @@ int DB_CONN::insert_id() {
if (retval) return retval;
rp = mysql_store_result(mysql);
row = mysql_fetch_row(rp);
int x = atoi(row[0]);
DB_ID_TYPE x = atol(row[0]);
mysql_free_result(rp);
return x;
}
Expand Down
2 changes: 1 addition & 1 deletion db/db_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DB_CONN {
int do_query(const char*);
int affected_rows();
void close();
int insert_id();
DB_ID_TYPE insert_id();
void print_error(const char*);
const char* error_string();
int ping();
Expand Down

0 comments on commit 75b7b64

Please sign in to comment.