summaryrefslogtreecommitdiff
path: root/lib/SQL.cc
blob: 9091c237de7ec998a64db8f30715b794d550b62a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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) {
}