summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2007-04-12 18:20:01 +0000
committerpixel <pixel>2007-04-12 18:20:01 +0000
commit1fdd95292cdf7f58109cc3fc5ab5ead2288f1bfc (patch)
treef0b07a17373642e1324c032b70a67fcb88d9dae6 /lib
parent753b838216316509ba5069ce44214630042bd33d (diff)
'query' now returns an error code instead of throwing an exception.
Diffstat (limited to 'lib')
-rw-r--r--lib/SQL.cc10
1 files changed, 7 insertions, 3 deletions
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() {