More changes for sql

This commit is contained in:
Walter Julius Hennecke 2011-12-16 10:24:25 +01:00
parent 0fef2e2732
commit 63cf3982f2
6 changed files with 23 additions and 41 deletions

View file

@ -10,7 +10,7 @@
// because games can change separately from the main system version, we need a // because games can change separately from the main system version, we need a
// second version that must match between game and cgame // second version that must match between game and cgame
#define RPGX_VERSION "RPG-X v2.2 wc141211b" #define RPGX_VERSION "RPG-X v2.2 wc161211a"
#define RPGX_COMPILEDATE "20/05/11" #define RPGX_COMPILEDATE "20/05/11"
#define RPGX_COMPILEDBY "GSIO01" #define RPGX_COMPILEDBY "GSIO01"
//const char GAME_VERSION[] = strcat("RPG-X v",RPGX_VERSION); //const char GAME_VERSION[] = strcat("RPG-X v",RPGX_VERSION);

View file

@ -989,6 +989,7 @@ void QDECL G_PrintfClientAll(const char *fmt, ...);
// g_sql.c // g_sql.c
// //
qboolean G_Sql_Init(void); qboolean G_Sql_Init(void);
void G_Sql_Shutdown(void);
qboolean G_Sql_CreateTables(const char *dbName); qboolean G_Sql_CreateTables(const char *dbName);
void G_Sql_Query(const char *query, const char *dbName, char *res); void G_Sql_Query(const char *query, const char *dbName, char *res);
qboolean G_Sql_UserAdd(const char *dbName, const char *uName, const char *password); qboolean G_Sql_UserAdd(const char *dbName, const char *uName, const char *password);

View file

@ -20,30 +20,37 @@ extern vmCvar_t sql_port;
extern void QDECL G_Printf( const char *fmt, ... ); extern void QDECL G_Printf( const char *fmt, ... );
extern void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...); extern void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...);
sqlite3 *user_db;
/* /*
=============== ===============
G_SqlInit G_SqlInit
=============== ===============
*/ */
qboolean G_Sql_Init(void) { qboolean G_Sql_Init(void) {
int res;
if(!sql_use.integer) return qtrue;
res = sqlite3_open("db/users.db", &user_db);
if(res) {
G_Printf(S_COLOR_RED "SQL ERROR: Could not open user database\n");
return qfalse; return qfalse;
} }
return qtrue;
}
/* /*
=============== ===============
Do_Mysql_Hash G_Sql_Shutdown
=============== ===============
*/ */
static const char *Do_Sql_Hash(const char *str) { void G_Sql_Shutdown(void) {
switch(sql_hash.integer) {
default: if(!sql_use.integer) return;
case 0:
return va("MD5(\'%s\')", str); sqlite3_close(user_db);
case 1:
return va("SHA1(\'%s)\'", str);
case 2:
return va("SHA512(\'%s\')", str);
}
} }
/* /*

View file

@ -725,29 +725,3 @@ int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent
return syscall( BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, numranks, ranks, parent1, parent2, child ); return syscall( BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, numranks, ranks, parent1, parent2, child );
} }
#ifdef SQL
int trap_SQL_UserCheckRight(const char *dbName, int uid, const char *right) {
return syscall( SQL_USERCHECKRIGHT, dbName, uid, right );
}
int trap_SQL_UserLogin(const char *dbName, const char *uName, const char *pwd) {
return syscall( SQL_USERLOGIN, dbName, uName, pwd);
}
int trap_SQL_CreateTables(const char *dbName) {
return syscall( SQL_CREATETABLES, dbName );
}
int trap_SQL_UserAdd(const char *dbName, const char *uName, const char *password) {
return syscall( SQL_USERADD, dbName, uName, password );
}
int trap_SQL_UserMod(const char *dbName, const char *uName, const char *right, int value) {
return syscall( SQL_USERMOD, dbName, uName, right, value );
}
int trap_SQL_UserDel(const char *dbName, const char *uName) {
return syscall( SQL_USERDEL, dbName, uName );
}
#endif

View file

@ -1,5 +1,5 @@
// Current version of holomatch game // Current version of holomatch game
#define Q3_VERSION "RPG-X v2.2 wc141211b" #define Q3_VERSION "RPG-X v2.2 wc161211a"
// end // end

Binary file not shown.