forked from github/server
fix type conversion and incomplete database test.
This commit is contained in:
parent
32009b7043
commit
da3270517a
|
@ -50,6 +50,7 @@ static void test_update_faction(CuTest *tc) {
|
|||
int uid;
|
||||
|
||||
test_setup();
|
||||
db_driver_open(DB_GAME, NULL);
|
||||
f = test_create_faction(NULL);
|
||||
uid = db_driver_faction_save(f->uid, f->no, 0,
|
||||
faction_getemail(f),
|
||||
|
@ -59,6 +60,7 @@ static void test_update_faction(CuTest *tc) {
|
|||
faction_getemail(f),
|
||||
faction_getpassword(f));
|
||||
CuAssertIntEquals(tc, f->uid, uid);
|
||||
db_driver_close(DB_GAME);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
|
|
|
@ -100,9 +100,7 @@ dbrow_id db_driver_faction_save(dbrow_id id, int no, int turn, const char *email
|
|||
sqlite3_int64 row_id;
|
||||
int err;
|
||||
|
||||
if (!g_game_db) {
|
||||
return -1;
|
||||
}
|
||||
assert(g_game_db);
|
||||
if (id != 0) {
|
||||
int rows;
|
||||
|
||||
|
@ -192,7 +190,11 @@ static const char *g_swapname;
|
|||
int db_driver_open(database_t db, const char *dbname)
|
||||
{
|
||||
ERRNO_CHECK();
|
||||
|
||||
|
||||
if (!dbname) {
|
||||
/* by default, use an in-memory database */
|
||||
dbname = ":memory:";
|
||||
}
|
||||
if (db == DB_SWAP) {
|
||||
g_swapname = dbname;
|
||||
return db_open_swap(dbname);
|
||||
|
|
Loading…
Reference in New Issue