From 75b7b640f64c471496c7a2ed669b340b48fef114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rytis=20Slatkevi=C4=8Dius?= Date: Wed, 24 Mar 2021 14:30:18 +0200 Subject: [PATCH] Make DB_BASE::insert_id() correctly return numbers exceeding 32bits --- db/db_base.cpp | 4 ++-- db/db_base.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db_base.cpp b/db/db_base.cpp index 05bcd44727..007a5f69bc 100644 --- a/db/db_base.cpp +++ b/db/db_base.cpp @@ -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; @@ -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; } diff --git a/db/db_base.h b/db/db_base.h index c65ac8fcc3..6af3a4330e 100644 --- a/db/db_base.h +++ b/db/db_base.h @@ -71,7 +71,7 @@ public: 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();