Skip to content

Commit

Permalink
Log an error if failed to import run/zone data from db
Browse files Browse the repository at this point in the history
  • Loading branch information
TotallyMehis committed Jul 4, 2020
1 parent e8b802a commit 6b36579
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion addons/sourcemod/scripting/influx_core/db_cb.sp
Expand Up @@ -385,6 +385,7 @@ public void Thrd_GetRuns( Handle db, Handle res, const char[] szError, any data
}


int runid;
decl String:rundata[1024];
KeyValues kv;

Expand All @@ -393,10 +394,17 @@ public void Thrd_GetRuns( Handle db, Handle res, const char[] szError, any data

while ( SQL_FetchRow( res ) )
{
runid = SQL_FetchInt( res, 0 );
SQL_FetchString( res, 1, rundata, sizeof( rundata ) );

kv = new KeyValues( "" );
kv.ImportFromString( rundata, "" );
if ( !kv.ImportFromString( rundata, "" ) )
{
LogError( INF_CON_PRE..."Failed to import run of id %i keyvalue data from database! Run data:\n%s", runid, rundata );

delete kv;
continue;
}


LoadRunFromKv( kv );
Expand Down
10 changes: 9 additions & 1 deletion addons/sourcemod/scripting/influx_zones/db_cb.sp
Expand Up @@ -24,15 +24,23 @@ public void Thrd_GetZones( Handle db, Handle res, const char[] szError, any data


decl String:zonedata[1024];
int zoneid;
KeyValues kv;


while ( SQL_FetchRow( res ) )
{
zoneid = SQL_FetchInt( res, 0 );
SQL_FetchString( res, 1, zonedata, sizeof( zonedata ) );

kv = new KeyValues( "" );
kv.ImportFromString( zonedata, "" );
if ( !kv.ImportFromString( zonedata, "" ) )
{
LogError( INF_CON_PRE..."Failed to import zone of id %i keyvalue data from database! Zone data:\n%s", zoneid, zonedata );

delete kv;
continue;
}


LoadZoneFromKv( kv );
Expand Down

0 comments on commit 6b36579

Please sign in to comment.