SA-MP Forums Archive
MySQL new plugins - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL new plugins (/showthread.php?tid=536364)



MySQL new plugins - khimera - 09.09.2014

Solved. Thank you


Re: MySQL new plugins - dusk - 09.09.2014

The code you posted is irrelevant. They syntax for queries didn't change.

I'm assuming you are talking about this MySQL plugin, version R7 or above.

mysql_query was removed in R7 and re-added later but with different usage.

The newest version has 3 functions for sending queries:
pawn Код:
native mysql_pquery(connectionHandle, query[], callback[] = "", format[] = "", {Float,_}:...);
native mysql_tquery(connectionHandle, query[], callback[] = "", format[] = "", {Float,_}:...);
native Cache:mysql_query(conhandle, query[], bool:use_cache = true);
Both mysql_pquery and mysql_tquery send threaded queries. You should read about multi-threading because it has both advantages and disadvantages.

mysql_query sends unthreaded queries and is used:
pawn Код:
new comandoquery[80];
format(comandoquery, sizeof(comandoquery), "UPDATE accounts SET HP='%f' WHERE Name='%s'",PlayerInfo[playerid][pHP],PlayerName(playerid));
mysql_query(connection_handle, comandoquery); // the "connection_handle" should be a variable with a value returned from mysql_connect
Although for UPDATE queries, mostly, you should send threaded queries. There are lots of tutorials about using it.


Re: MySQL new plugins - khimera - 09.09.2014

Thank you for your time and explaining that to me. Probably it would be easier to use old MySQL but R5 link for download isn't active.


Re: MySQL new plugins - khimera - 09.09.2014

Solved. Thank you


Re: MySQL new plugins - dusk - 09.09.2014

About R5. I really do not recommend using it. It's old and it isn't updated anymore. I believe it also contains a bug which causes the plugin to crash(not sure).

But if you're sure about it:
pawn Код:
mysql_query(comandoquery,(-1),(-1),databaseConnection);
You don't need to specify the 2,3,4 parameters. They will default to correct ones.

I uploaded the R6 version of it to here.


Re: MySQL new plugins - khimera - 09.09.2014

Thank you so much. Now it worked!