escaping in query
#1

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?
Reply
#2

I don't quite understand what you mean, if you could post some code then that could clarify some points about your question.
Reply
#3

Код:
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 );
}
Reply
#4

Concerning your question, yes the "ttext" will be a escaped string on the callback.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)