10.06.2014, 18:26
(
Последний раз редактировалось Patrick; 20.06.2014 в 16:28.
)
I was tired of escaping strings in SQLite every time I execute a query so I decided to use formatex include by Slice and created a simple specifier %E, the reason I didn't use %e because it will collide with MySQL who ever uses MySQL + SQLite.
You need Function
Usage
EDIT: Spoke to ****** and assuming mysql_format and format is different, I decided to change the specifier to %e instead of %E
You need Function
pawn Код:
FormatSpecifier<'e'>(output[], string[])
{
if(string[0] == EOS)
print("Error: Empty string, the system can't escape anything.");
else
format(output, sizeof(output), "%s", DB_Escape(string));
}
pawn Код:
new string[128];
format(string, sizeof(string), "INSERT INTO Table (RowID1) VALUES ('%e')", "EscapeMe");
db_query(dbHandle, string);