diff options
author | pixel <pixel> | 2003-08-21 16:49:52 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-08-21 16:49:52 +0000 |
commit | 23974eb093c83a5e6f7b1109e0f739ad7a870aac (patch) | |
tree | b3cabc2eae9dde5689e8182f06036fcb6c417c34 /lib | |
parent | 567a5619d98b17276479055512a469f1571c4ab4 (diff) |
Starting MySQL code
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 6 | ||||
-rw-r--r-- | lib/SQL.cc | 25 | ||||
-rw-r--r-- | lib/String.cc | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 6719ad7..c843753 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,7 @@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ -AM_CFLAGS = -O3 -Wall -Wstrict-prototypes -g -AM_CXXFLAGS = -O3 -Wall -Wstrict-prototypes -g +AM_CPPFLAGS = -O3 -Wall -Wstrict-prototypes -g @MYSQL_CFLAGS@ +LIBS = @MYSQL_LIBS@ INCLUDES = -I.. -I../include -I$(includedir) lib_LTLIBRARIES = libBaltisot.la @@ -9,4 +9,4 @@ libBaltisot_la_SOURCES = Action.cc Buffer.cc checkargs.c Confirm.cc CopyJob.cc \ datecalc.c Exceptions.cc Form.cc GMPString.cc Handle.cc HttpServ.cc Image.cc \ InPipe.cc Input.cc IRC.cc Main.cc Menu.cc Message.cc OutPipe.cc Output.cc \ ReadJob.cc Regex.cc Socket.cc String.cc Table.cc Task.cc TaskMan.cc \ -Variables.cc generic.cc fileutils.cc +Variables.cc generic.cc fileutils.cc SQL.cc 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) { +} diff --git a/lib/String.cc b/lib/String.cc index 265883f..402424c 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -474,3 +474,7 @@ String & String::tolower() { return *this; } + +bool compare(String a, String b) { + return a < b; +} |