Abort (i.e. return false) when failing to find the column's numbers by looking them up using their names

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5203 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-05-29 10:18:23 +00:00
parent f7df0848ec
commit 747f158b45
1 changed files with 16 additions and 8 deletions

View File

@ -141,6 +141,9 @@ typedef struct
static bool compBaseStatColumnNames(SQL_COMP_BASE_STATS* cols, sqlite3_stmt* stmt) static bool compBaseStatColumnNames(SQL_COMP_BASE_STATS* cols, sqlite3_stmt* stmt)
{ {
if (!baseStatColumnNames(&cols->parent, stmt))
return false;
cols->techlevel = getColNumByNameA(stmt, "techlevel"); cols->techlevel = getColNumByNameA(stmt, "techlevel");
cols->buildPower = getColNumByNameA(stmt, "buildPower"); cols->buildPower = getColNumByNameA(stmt, "buildPower");
cols->buildPoints = getColNumByNameA(stmt, "buildPoints"); cols->buildPoints = getColNumByNameA(stmt, "buildPoints");
@ -157,8 +160,7 @@ static bool compBaseStatColumnNames(SQL_COMP_BASE_STATS* cols, sqlite3_stmt* stm
ASSERT(cols->weight != -1, "No weight in this database query available"); ASSERT(cols->weight != -1, "No weight in this database query available");
ASSERT(cols->systempoints != -1, "No system points in this database query available"); ASSERT(cols->systempoints != -1, "No system points in this database query available");
return baseStatColumnNames(&cols->parent, stmt) return cols->techlevel != -1
&& cols->techlevel != -1
&& cols->buildPower != -1 && cols->buildPower != -1
&& cols->buildPoints != -1 && cols->buildPoints != -1
&& cols->weight != -1 && cols->weight != -1
@ -618,7 +620,8 @@ bool loadWeaponStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {
@ -679,7 +682,8 @@ bool loadBodyStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {
@ -807,7 +811,8 @@ bool loadBrainStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {
@ -894,7 +899,8 @@ bool loadPropulsionStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {
@ -974,7 +980,8 @@ bool loadSensorStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {
@ -1118,7 +1125,8 @@ bool loadECMStatsFromDB(sqlite3* db, const char* tableName)
return false; return false;
if ((rc = sqlite3_step(stmt)) == SQLITE_ROW) if ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
compBaseStatColumnNames(&cols, stmt); if (!compBaseStatColumnNames(&cols, stmt))
goto in_statement_err;
while (rc == SQLITE_ROW) while (rc == SQLITE_ROW)
{ {