Create DB Schema before DBMaxIDCallback is initialized
Set SQLITE_FOUND so metaserver gets actually built
This commit is contained in:
parent
2e54a8985b
commit
63dd530c11
2 changed files with 10 additions and 11 deletions
|
@ -18,6 +18,7 @@
|
|||
if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
|
||||
# in cache already
|
||||
SET(Sqlite_FIND_QUIETLY TRUE)
|
||||
SET(SQLITE_FOUND)
|
||||
endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
|
|
|
@ -144,6 +144,15 @@ int DBInit(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (doinit) {
|
||||
errmsg = NULL;
|
||||
if (sqlite3_exec(DB, SQLCreateTables, NULL, NULL, &errmsg) != SQLITE_OK) {
|
||||
fprintf(stderr, "SQL error: %s\n", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
errmsg = NULL;
|
||||
if (sqlite3_exec(DB, "SELECT MAX(id) FROM games;", DBMaxIDCallback, NULL, &errmsg) != SQLITE_OK) {
|
||||
fprintf(stderr, "SQL error: %s\n", errmsg);
|
||||
|
@ -151,17 +160,6 @@ int DBInit(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!doinit) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
errmsg = NULL;
|
||||
if (sqlite3_exec(DB, SQLCreateTables, NULL, NULL, &errmsg) != SQLITE_OK) {
|
||||
fprintf(stderr, "SQL error: %s\n", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue