mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
Removed ancient table migration code (#758).
Should speed up initial load after map change by a lot! I believe this is now useless.
This commit is contained in:
parent
b1106d7c97
commit
bbccdcf28a
@ -2144,13 +2144,6 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char sQuery[192];
|
|
||||||
FormatEx(sQuery, 192, "SELECT lastlogin FROM %susers LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration1_Callback, sQuery, 0, DBPrio_High);
|
|
||||||
|
|
||||||
FormatEx(sQuery, 192, "SELECT points FROM %susers LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration2_Callback, sQuery, 0, DBPrio_High);
|
|
||||||
|
|
||||||
char sTables[][] =
|
char sTables[][] =
|
||||||
{
|
{
|
||||||
"maptiers",
|
"maptiers",
|
||||||
@ -2163,58 +2156,18 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
DataPack dp = new DataPack();
|
DataPack dp = new DataPack();
|
||||||
dp.WriteString(sTables[i]);
|
dp.WriteString(sTables[i]);
|
||||||
|
|
||||||
|
char sQuery[192];
|
||||||
FormatEx(sQuery, 192, "SELECT map FROM %s%s WHERE map LIKE 'workshop%%' GROUP BY map;", gS_MySQLPrefix, sTables[i]);
|
FormatEx(sQuery, 192, "SELECT map FROM %s%s WHERE map LIKE 'workshop%%' GROUP BY map;", gS_MySQLPrefix, sTables[i]);
|
||||||
gH_SQL.Query(SQL_TableMigration3_Callback, sQuery, dp, DBPrio_Low);
|
gH_SQL.Query(SQL_TableMigration_Callback, sQuery, dp, DBPrio_High);
|
||||||
}
|
}
|
||||||
|
|
||||||
Call_StartForward(gH_Forwards_OnDatabaseLoaded);
|
Call_StartForward(gH_Forwards_OnDatabaseLoaded);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_TableMigration1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
public void SQL_TableMigration_Callback(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[128];
|
|
||||||
FormatEx(sQuery, 128, "ALTER TABLE `%susers` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`lastlogin` INT NOT NULL DEFAULT -1)":"COLUMN `lastlogin` INTEGER NOT NULL DEFAULT -1");
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer error! Table alteration 1 (core) failed. Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration2_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[128];
|
|
||||||
FormatEx(sQuery, 128, "ALTER TABLE `%susers` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`points` FLOAT NOT NULL DEFAULT 0)":"COLUMN `points` FLOAT NOT NULL DEFAULT 0");
|
|
||||||
gH_SQL.Query(SQL_AlterTable2_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable2_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer error! Table alteration 2 (core) failed. Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration3_Callback(Database db, DBResultSet results, const char[] error, DataPack data)
|
|
||||||
{
|
{
|
||||||
char sTable[16];
|
char sTable[16];
|
||||||
|
|
||||||
data.Reset();
|
data.Reset();
|
||||||
data.ReadString(sTable, 16);
|
data.ReadString(sTable, 16);
|
||||||
delete data;
|
delete data;
|
||||||
|
|||||||
@ -2173,136 +2173,8 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
gB_Late = false;
|
gB_Late = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char sQuery[64];
|
|
||||||
FormatEx(sQuery, 64, "SELECT strafes FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration1_Callback, sQuery);
|
|
||||||
|
|
||||||
if(gB_MySQL) // this isn't possible in sqlite
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 64, "ALTER TABLE %splayertimes MODIFY date VARCHAR(16);", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_AlterTable2_Callback, sQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
FormatEx(sQuery, 64, "SELECT points FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration3_Callback, sQuery);
|
|
||||||
|
|
||||||
FormatEx(sQuery, 64, "SELECT track FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration4_Callback, sQuery);
|
|
||||||
|
|
||||||
FormatEx(sQuery, 64, "SELECT perfs FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration5_Callback, sQuery, 0, DBPrio_Low);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
|
|
||||||
if(gB_MySQL)
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD (`strafes` INT NOT NULL DEFAULT 0, `sync` FLOAT NOT NULL DEFAULT 0);", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD COLUMN `strafes` INT NOT NULL DEFAULT 0;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD COLUMN `sync` FLOAT NOT NULL DEFAULT 0;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (WR module) error! Times' table migration (1) failed. Reason: %s", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable2_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (WR module) error! Times' table migration (2) failed. Reason: %s", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration3_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`points` FLOAT NOT NULL DEFAULT 0)":"COLUMN `points` FLOAT NOT NULL DEFAULT 0");
|
|
||||||
gH_SQL.Query(SQL_AlterTable3_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable3_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (WR module) error! Times' table migration (3) failed. Reason: %s", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration4_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`track` INT NOT NULL DEFAULT 0)":"COLUMN `track` INT NOT NULL DEFAULT 0");
|
|
||||||
gH_SQL.Query(SQL_AlterTable4_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable4_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (WR module) error! Times' table migration (4) failed. Reason: %s", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration5_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
|
|
||||||
if(gB_MySQL)
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD (`perfs` FLOAT DEFAULT 0);", gS_MySQLPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD COLUMN `perfs` FLOAT DEFAULT 0;", gS_MySQLPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
gH_SQL.Query(SQL_AlterTable5_Callback, sQuery);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gB_Connected = true;
|
|
||||||
OnMapStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable5_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (WR module) error! Times' table migration (5) failed. Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gB_Connected = true;
|
gB_Connected = true;
|
||||||
|
|
||||||
OnMapStart();
|
OnMapStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2327,86 +2327,8 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char sQuery[64];
|
|
||||||
FormatEx(sQuery, 64, "SELECT destination_x FROM %smapzones LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration1_Callback, sQuery);
|
|
||||||
|
|
||||||
FormatEx(sQuery, 64, "SELECT track FROM %smapzones LIMIT 1;", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_TableMigration2_Callback, sQuery, 0, DBPrio_Low);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
|
|
||||||
if(gB_MySQL)
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%smapzones` ADD (`destination_x` FLOAT NOT NULL DEFAULT 0, `destination_y` FLOAT NOT NULL DEFAULT 0, `destination_z` FLOAT NOT NULL DEFAULT 0);", gS_MySQLPrefix);
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char sAxis[4];
|
|
||||||
strcopy(sAxis, 4, "xyz");
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%smapzones` ADD COLUMN `destination_%c` FLOAT NOT NULL DEFAULT 0;", gS_MySQLPrefix, sAxis[i]);
|
|
||||||
gH_SQL.Query(SQL_AlterTable1_Callback, sQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_AlterTable1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (zones module) error! Map zones' table migration (1) failed. Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SQL_TableMigration2_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
char sQuery[256];
|
|
||||||
|
|
||||||
if(gB_MySQL)
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%smapzones` ADD (`track` INT NOT NULL DEFAULT 0);", gS_MySQLPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%smapzones` ADD COLUMN `track` INTEGER NOT NULL DEFAULT 0;", gS_MySQLPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
gH_SQL.Query(SQL_AlterTable2_Callback, sQuery);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gB_Connected = true;
|
|
||||||
OnMapStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SQL_AlterTable2_Callback(Database db, DBResultSet results, const char[] error, any data)
|
|
||||||
{
|
|
||||||
if(results == null)
|
|
||||||
{
|
|
||||||
LogError("Timer (zones module) error! Map zones' table migration (2) failed. Reason: %s", error);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gB_Connected = true;
|
gB_Connected = true;
|
||||||
|
|
||||||
OnMapStart();
|
OnMapStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user