diff options
Diffstat (limited to 'lib/SQL.cc')
-rw-r--r-- | lib/SQL.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/SQL.cc b/lib/SQL.cc new file mode 100644 index 0000000..9091c23 --- /dev/null +++ b/lib/SQL.cc @@ -0,0 +1,25 @@ +#include "SQL.h" + +SQLConnection::SQLConnection(String host, String user, String passwd, + String db, int port, String socket, + unsigned long cflags) throw (GeneralException) : res(0) { + mysql_init(&con); + + char * p; + + if (!mysql_real_connect(&con, + p = ((ugly_string)(host)).p ? p : 0, + ((ugly_string)(user)).p, + ((ugly_string)(passwd)).p, + ((ugly_string)(db)).p, port, + ((ugly_string)(socket)).p, cflags)) { + throw GeneralException(String("Could not connect to MySQL host ") + p); + } +} + +SQLConnection::~SQLConnection() { + mysql_close(&con); +} + +void SQLConnection::query(String q) throw(GeneralException) { +} |