diff --git a/game/g_sql.c b/game/g_sql.c index 2ec2135..7551f86 100644 --- a/game/g_sql.c +++ b/game/g_sql.c @@ -20,6 +20,15 @@ extern vmCvar_t sql_port; extern void QDECL G_Printf( const char *fmt, ... ); extern void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...); +/* +=============== +G_SqlInit +=============== +*/ +qboolean G_SqlInit(void) { + +} + /* =============== Do_Mysql_Hash diff --git a/game/g_sql.h b/game/g_sql.h index 3572b17..721b88e 100644 --- a/game/g_sql.h +++ b/game/g_sql.h @@ -1,16 +1,19 @@ #define MAX_SQL_RESULT 4096 -#define SQL_GET_UID(UNAME) va("SELECT id FROM rpgxEF_users WHERE username = %s", UNAME) -#define SQL_DELETE(TNAME, COND) va("DELETE FROM %s WHERE %s", TNAME, COND) -#define SQL_INSERT(TNAME, L1, L2) va("INSERT INTO %s (%s) VALUES (%s)", TNAME, L1, L2) -#define SQL_INSERT_DELAYED(TNAME, L1, L2) va("INSERT DELAYED INTO %s (%s) VALUES (%s)", TNAME, L1, L2) -#define SQL_UPDATE(TNAME, CHANGE, CONDITION) va("UPDATE %s SET %s WHERE %s", TNAME, CHANGE, CONDITION) -#define SQL_CREATEUSERTABLE "CREATE TABLE rpgxEF_users ( \ - id INT PRIMARY KEY AUTOINCREMENT, \ +#define SQL_ENABLE_FOREIGN_KEY_CONTRAINTS "PRAGMA foreign_keys = ON;" +#define SQL_GET_UID(UNAME) va("SELECT id FROM rpgx_users WHERE username = %s", UNAME) +#define SQL_CREATEUSERTABLE "CREATE TABLE rpgx_users ( \ + id INTEGER PRIMARY KEY AUTOINCREMENT, \ username TEXT NOT NULL , \ password TEXT NOT NULL, \ mail TEXT \ )" +#define SQL_CREATERIGHTSTABLE "CREATE TABLE rpgx_userRights ( \ + id INT NOT NULL PRIMARY KEY, \ + admin BIT NOT NULL, \ + rights LONG NOT NULL, \ + FOREIGN KEY(id) REFERENCES rpgx_users(id) \ + )" typedef enum { SQLF_GIVE = 1, @@ -46,8 +49,4 @@ typedef enum { SQLF_SHAKE = 1073741824 } sql_userflags; -#define SQL_CREATERIGHTSTABLE "CREATE TABLE rpgxEF_rights ( \ - id INT NOT NULL, \ - admin BIT NOT NULL, \ - rights LONG NOT NULL, \ - )" +qboolean G_SqlInit(void); diff --git a/stefgame.suo b/stefgame.suo index d8e2e47..1ac338c 100644 Binary files a/stefgame.suo and b/stefgame.suo differ