MySQL new plugins
#1

Solved. Thank you
Reply
#2

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.
Reply
#3

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.
Reply
#4

Solved. Thank you
Reply
#5

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.
Reply
#6

Thank you so much. Now it worked!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)