2021-03-08, 02:44 PM
(2021-03-08, 02:34 PM)kalEd Wrote: What is the most efficient and optimized method to save data in the database?
For example this?:
Code:new gQuery[ 256?]; //at the beginning of the gamemode
//in a function=>
gQuery[ 0 ] = EOS;
mysql_format( handle, gQuery, sizeof gQuery, "INSERT INTO `logs` (`Player`, `IP`) VALUES ('%e', '%s')", getName( playerid ), getPlayerIp( playerid ) );
mysql_tquery( handle, gQuery, "", "" );
or this?:
Code:new Query[ 90 ];
mysql_format( handle, Query, sizeof Query, "INSERT INTO `logs` (`Player`, `IP`) VALUES ('%e', '%s')", getName( playerid ), getPlayerIp( playerid ) );
mysql_tquery( handle, Query, "", "" );
What exactly does gQuery[0] = EOS; mean? What's the difference?
Quote:EOS: predefined constant standing for End Of String; it has the value ?n0?
Basically, it makes the array (string variable) empty, hold no real value. You do not even need to use it in that mysql code because the gQuery string is already empty. So second code is the way things should be.
Use this if you encounter something you don't know.
https://github.com/compuphase/pawn/blob/..._Guide.pdf