Created
June 29, 2017 01:56
-
-
Save voided/c8db8c264ff5f32449c594e7a7469ac4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void txn_addExtraCheckpoints() | |
{ | |
// Add extra checkpoints to Checkpoints and add new primary key: | |
if (!SQL_FastQuery(g_hDb, "SELECT cp35 FROM ck_checkpoints;")) | |
{ | |
char migrationError[256]; | |
SQL_GetError(g_hDb, migrationError, sizeof(migrationError)); | |
PrintToServer("Migration check: %s", migrationError); | |
PrintToServer("---------------------------------------------------------------------------"); | |
disableServerHibernate(); | |
PrintToServer("[ckSurf] Started to make changes to database. Updating from 1.17 -> 1.18."); | |
PrintToServer("[ckSurf] WARNING: DO NOT CONNECT TO THE SERVER, OR CHANGE MAP!"); | |
PrintToServer("[ckSurf] Adding extra checkpoints... (1 / 6)"); | |
g_bInTransactionChain = true; | |
Transaction h_checkpoint = SQL_CreateTransaction(); | |
SQL_AddQuery(h_checkpoint, "ALTER TABLE ck_checkpoints RENAME TO ck_checkpoints_temp;"); | |
SQL_AddQuery(h_checkpoint, sql_createCheckpoints); | |
SQL_AddQuery(h_checkpoint, "INSERT INTO ck_checkpoints(steamid, mapname, zonegroup, cp1, cp2, cp3, cp4, cp5, cp6, cp7, cp8, cp9, cp10, cp11, cp12, cp13, cp14, cp15, cp16, cp17, cp18, cp19, cp20) SELECT steamid, mapname, 0, cp1, cp2, cp3, cp4, cp5, cp6, cp7, cp8, cp9, cp10, cp11, cp12, cp13, cp14, cp15, cp16, cp17, cp18, cp19, cp20 FROM ck_checkpoints_temp GROUP BY mapname, steamid;"); | |
SQL_AddQuery(h_checkpoint, "DROP TABLE ck_checkpoints_temp;"); | |
SQL_ExecuteTransaction(g_hDb, h_checkpoint, SQLTxn_Success, SQLTxn_TXNFailed, 1); | |
} | |
else | |
{ | |
PrintToServer("[ckSurf] No database update needed!"); | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment