From 98967395c4a65cc554a3cb801087f51c9edddaef Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Wed, 21 Mar 2012 14:59:39 +0000 Subject: [PATCH] Started creating database code --- sql/players.sql | 7 +++++++ src/Makefile.am | 2 +- src/db.c | 12 ++++++++++++ src/db.h | 11 +++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 sql/players.sql create mode 100644 src/db.c create mode 100644 src/db.h diff --git a/sql/players.sql b/sql/players.sql new file mode 100644 index 0000000..70e5aea --- /dev/null +++ b/sql/players.sql @@ -0,0 +1,7 @@ +CREATE TABLE players ( + id integer primary key, + login varchar(50) not null unique, + password varchar(50), + email varchar(150) not null unique +); + diff --git a/src/Makefile.am b/src/Makefile.am index 1cc5b09..84fa832 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = wmud AM_CFLAGS = $(MEMCACHED_CFLAGS) $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GTHREAD_CFLAGS) $(SQLITE3_CFLAGS) -wmud_SOURCES = main.c networking.c interpreter.c +wmud_SOURCES = main.c networking.c interpreter.c db.c wmud_LDADD = $(MEMCACHED_LIBS) $(GLIB_LIBS) $(GIO_LIBS) $(GTHREAD_LIBS) $(SQLITE3_LIBS) diff --git a/src/db.c b/src/db.c new file mode 100644 index 0000000..6bfa2db --- /dev/null +++ b/src/db.c @@ -0,0 +1,12 @@ +#include + +#include "db.h" + +sqlite3 *dbh = NULL; + +gboolean +wmud_db_init(void) +{ + sqlite3_open( +} + diff --git a/src/db.h b/src/db.h new file mode 100644 index 0000000..f380041 --- /dev/null +++ b/src/db.h @@ -0,0 +1,11 @@ +#ifndef __WMUD_DB_H__ +#define __WMUD_DB_H__ + +#include + +gboolean wmud_db_init(Gerror ** error); +gboolean wmud_load_players(GError **err); +gboolean wmud_save_player(wmudPlayer *player, GError **err); + +#endif /* __WMUD__DB_H__ */ +