fixed query issues
This commit is contained in:
parent
7c74bb9cf6
commit
c203a9c091
@ -102,9 +102,16 @@ public void Command_listcmd()
|
||||
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))
|
||||
{
|
||||
char sQuery[2048];
|
||||
ResetPack(data);
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 3: %s", error);
|
||||
delete results;
|
||||
LogError("actual query: %s", sQuery);
|
||||
}
|
||||
delete results;
|
||||
delete data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user