summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/SQL.h2
-rw-r--r--lib/SQL.cc10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/SQL.h b/include/SQL.h
index fa1a163..4d794d5 100644
--- a/include/SQL.h
+++ b/include/SQL.h
@@ -11,7 +11,7 @@ class SQLConnection : public Base {
public:
SQLConnection(String host, String user, String passwd, String db, int port = 3306, String socket = "", unsigned long clags = 0) throw (GeneralException);
~SQLConnection();
- void query(String) throw (GeneralException);
+ int query(String);
int numrows();
int numfields();
AssocArray fetchrow();
diff --git a/lib/SQL.cc b/lib/SQL.cc
index 3234ffd..7667cfb 100644
--- a/lib/SQL.cc
+++ b/lib/SQL.cc
@@ -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() {