escaping in query - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: escaping in query (
/showthread.php?tid=614928)
escaping in query -
MerryDeer - 15.08.2016
Hi,
I'am escaping in command end sending querie which calling to callback and there also i do another query. I'am also sending same text to update but it's escaped? if i escape in command and send it with parameter to query that text is escaped too? or i need reescape?
Re: escaping in query -
ThePhenix - 15.08.2016
I don't quite understand what you mean, if you could post some code then that could clarify some points about your question.
Re: escaping in query -
MerryDeer - 15.08.2016
Код:
CMD:Test()
{
new Someshit[ 50 ] = "blbl,'''\;//''"'";
new escapedtext[200];
mysql_escape_string(Someshit, escapedtext);
mysql_tquery(MySQL, query, "OnPlayerDataLoaded", "ds", playerid,escapedtext);
}
forward OnPlayerDataLoaded( playerid, ttext );
public OnPlayerDataLoaded( playerid, ttext )
{
// now if using ttext it's will be escaped like if in command?
mysql_tquery("UPDATE table set row='%s'", ttext );
}
Re: escaping in query -
ThePhenix - 15.08.2016
Concerning your question, yes the "ttext" will be a escaped string on the callback.
Re: escaping in query -
Vince - 15.08.2016
You should simply use mysql_format. Using that you don't ever have to worry about escaping. The original value of the variable is preserved and an escaped version is sent with the query.