X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=gameserver_db.h;h=fe39931af843ae30b3715b6192367193dedc489a;hb=b440efbe5785d114d08bb3f5ec0e09cad943006d;hp=90852481e9ae1804b8523f78189c05cdd983bc51;hpb=a7d144c7905105909cc4434e0ab43008bbb8f89f;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/gameserver_db.h b/gameserver_db.h index 9085248..fe39931 100644 --- a/gameserver_db.h +++ b/gameserver_db.h @@ -5,7 +5,6 @@ #include "vg/vg_mem_queue.h" #include "network_common.h" #include "dep/sqlite3/sqlite3.h" -#include "highscores.h" #include #include @@ -155,7 +154,7 @@ static int db_writeusertime( char table[DB_TABLE_UID_MAX], u64 steamid, vg_strnull( &q, buf, 512 ); vg_strcat( &q, "CREATE TABLE IF NOT EXISTS \n \"" ); vg_strcat( &q, table ); - vg_strcat( &q, "\"\n (steamid BIGINT PRIMARY KEY, time INT);" ); + vg_strcat( &q, "\"\n (steamid BIGINT UNIQUE, time INT);" ); if( !vg_strgood(&q) ) return 0; vg_str str; @@ -277,7 +276,7 @@ static void *db_loop(void *_){ sqlite3_stmt *stmt = db_stmt( "CREATE TABLE IF NOT EXISTS \n" - " users(steamid BIGINT PRIMARY KEY, name VARCHAR(128), type INT);" ); + " users(steamid BIGINT UNIQUE, name VARCHAR(128), type INT);" ); if( stmt ){ int fc = sqlite3_step( stmt ); @@ -376,10 +375,10 @@ static void db_free(void){ } static db_request *db_alloc_request( u32 size ){ - u32 total = sizeof(db_request) + vg_align8(size); + u32 total = sizeof(db_request) + size; pthread_mutex_lock( &database.mux ); - vg_queue_frame *frame = vg_queue_alloc( &database.queue, size ); + vg_queue_frame *frame = vg_queue_alloc( &database.queue, total ); if( frame ){ db_request *req = (db_request *)frame->data;