diff options
Diffstat (limited to 'lib/SQL.cc')
-rw-r--r-- | lib/SQL.cc | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -29,15 +29,17 @@ SQLConnection::~SQLConnection() { mysql_close(&con); } -void SQLConnection::query(String q) throw(GeneralException) { +int SQLConnection::query(String q) { + int r; + if (res) { mysql_free_result(res); } res = 0; - if (mysql_real_query(&con, ((ugly_string)q).p, q.strlen())) { - throw GeneralException(String("Couldn't run query ") + q); + if ((r = mysql_real_query(&con, ((ugly_string)q).p, q.strlen()))) { + return r; } res = mysql_store_result(&con); @@ -55,6 +57,8 @@ void SQLConnection::query(String q) throw(GeneralException) { na = 0; ii = -1; } + + return r; } int SQLConnection::numrows() { |