• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] MySQL Question
#2
(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
  Reply


Messages In This Thread
MySQL Question - by kalEd - 2021-03-08, 02:34 PM
RE: MySQL Question - by Virsenas - 2021-03-08, 02:44 PM
RE: MySQL Question - by Kwarde - 2021-03-08, 07:29 PM
RE: MySQL Question - by Y_Less - 2021-03-08, 07:57 PM
RE: MySQL Question - by kalEd - 2021-03-09, 10:28 AM

Forum Jump: