[Library] MySQL Prepared Statements - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13) ---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31) ---- Thread: [Library] MySQL Prepared Statements (/showthread.php?tid=644) |
MySQL Prepared Statements - PatrickGTR - 2019-06-07 Introduction Hi, I'll keep it short and simple.? This emulates prepared statement when using the MySQL plugin. Thank you for reading this really long introduction. Download: Click me Important: sampctl required! check github repository for installation instructions. Reading Data (using inline) Code: new stmt_readloop = MySQL_PrepareStatement(MySQLHandle, "SELECT * FROM spawns"); Writing Data Code: new Statement: stmt_insert = MySQL_PrepareStatement(MySQLHandle, "INSERT INTO accounts(username, password, salt, money, kills, deaths) VALUES (?,?,?,?,?,?) " ); Functions Open/Close Code: MySQL_StatementClose(Statement:statement) Writing Code: MySQL_Bind(Statement:statement, param, const str[])? Reading Code: MySQL_BindResult(Statement:statement, field, const result[], len = sizeof(result)) Executing Code: MySQL_ExecuteThreaded(Statement:statement, const callback[] = "", const fmat[] = "", {Float,_}:...) RE: MySQL Prepared Statements - PatrickGTR - 2019-06-07 Added account example script. https://github.com/PatrickGTR/MySQL-Prepared-Statements/blob/master/example/account.pwn RE: MySQL Prepared Statements - Y_Less - 2019-06-08 Very nice. RE: MySQL Prepared Statements - Shadow_ - 2020-06-03 Love it - will switch to this. RE: MySQL Prepared Statements - PatrickGTR - 2020-06-04 (2020-06-03, 02:39 PM)Shadow_ Wrote: Love it - will switch to this. Ah thank you, glad you find it useful. RE: MySQL Prepared Statements - XoMoX - 2020-12-07 Yes to avoid SQL injections very very nice RE: MySQL Prepared Statements - PatrickGTR - 2020-12-09 Code updated! - Fix the issue where a data would get loaded DESC instead of ASC. - stmt_fetch_row is not depending on loop to retrieve next row. - fix typo in Debug of stmt_fetch_row. - format code a lil bit more (like it matters much lol) RE: MySQL Prepared Statements - PatrickGTR - 2021-05-07 added bcrypt example to Prepared Statement as requested. https://github.com/PatrickGTR/MySQL-Prepared-Statements/blob/master/example/account_bcrypt.pwn |