fixed query issues
This commit is contained in:
parent
7c74bb9cf6
commit
c203a9c091
@ -55,56 +55,63 @@ public void Command_listcmd()
|
||||
|
||||
//This still may not be the best way to do this
|
||||
if (iFlags & ADMFLAG_RESERVATION)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_RESERVATION ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_RESERVATION");
|
||||
if (iFlags & ADMFLAG_GENERIC)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_GENERIC ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_GENERIC");
|
||||
if (iFlags & ADMFLAG_KICK)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_KICK ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_KICK");
|
||||
if (iFlags & ADMFLAG_BAN)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_BAN ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_BAN");
|
||||
if (iFlags & ADMFLAG_UNBAN)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_UNBAN ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_UNBAN");
|
||||
if (iFlags & ADMFLAG_SLAY)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_SLAY ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_SLAY");
|
||||
if (iFlags & ADMFLAG_CHANGEMAP)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHANGEMAP ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHANGEMAP");
|
||||
if (iFlags & ADMFLAG_CONVARS)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CONVARS ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CONVARS");
|
||||
if (iFlags & ADMFLAG_CONFIG)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CONFIG ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CONFIG");
|
||||
if (iFlags & ADMFLAG_CHAT)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHAT ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHAT");
|
||||
if (iFlags & ADMFLAG_VOTE)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_VOTE ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_VOTE");
|
||||
if (iFlags & ADMFLAG_PASSWORD)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_PASSWORD ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_PASSWORD");
|
||||
if (iFlags & ADMFLAG_RCON)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_RCON ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_RCON");
|
||||
if (iFlags & ADMFLAG_CHEATS)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHEATS ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CHEATS");
|
||||
if (iFlags & ADMFLAG_ROOT)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_ROOT ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_ROOT");
|
||||
if (iFlags & ADMFLAG_CUSTOM1)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM1 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM1");
|
||||
if (iFlags & ADMFLAG_CUSTOM2)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM2 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM2");
|
||||
if (iFlags & ADMFLAG_CUSTOM3)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM3 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM3");
|
||||
if (iFlags & ADMFLAG_CUSTOM4)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM4 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM4");
|
||||
if (iFlags & ADMFLAG_CUSTOM5)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM5 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM5");
|
||||
if (iFlags & ADMFLAG_CUSTOM6)
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM6 ");
|
||||
StrCat(strFlags, sizeof(strFlags), "ADMFLAG_CUSTOM6");
|
||||
if (iFlags == 0)
|
||||
Format(strFlags, sizeof(strFlags), "No flag registered");
|
||||
|
||||
if (StrEqual(Description, "", false))
|
||||
Format(Description, sizeof(Description), "No description found");
|
||||
//PrintToChatAll("Command: %s Description: %s strFlags: %s", Command, Description, strFlags);
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `ze_commands_info` (`command`, `description`, `flag`) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE `description` = '%s', `flag` = '%s'", Command, Description, strFlags, Description, strFlags);
|
||||
g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, DBPrio_Low);
|
||||
char sQuery[2048];
|
||||
int size2 = 2 * strlen(Description) + 1;
|
||||
char[] sEscapedDescription = new char[size2 + 1];
|
||||
|
||||
g_hDatabase.Escape(Description, sEscapedDescription, size2 + 1);
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `ze_commands_info` (`command`, `description`, `flag`) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE `description` = '%s', `flag` = '%s'", Command, sEscapedDescription, strFlags, sEscapedDescription, strFlags);
|
||||
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteString(sQuery);
|
||||
g_hDatabase.Query(SQL_OnQueryCompleted, sQuery, hDataPack, DBPrio_Low);
|
||||
}
|
||||
CloseHandle(hIterator);
|
||||
}
|
||||
@ -113,8 +120,12 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
{
|
||||
if (!db || strlen(error))
|
||||
{
|
||||
LogError("Query error 3: %s", error);
|
||||
delete results;
|
||||
char sQuery[2048];
|
||||
ResetPack(data);
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 3: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
}
|
||||
delete results;
|
||||
delete data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user