summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/SQL.cc25
-rw-r--r--lib/String.cc4
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;
+}