MySQL pquery help?
#1

I have done this mysql_format which is meant to log kicks into the database

pawn Код:
mysql_format(sqlConnection, query, sizeof(query), "INSERT INTO kicklogs (`Name`, `Admin`, `Reason`) VALUES ('%e', '%e', '%e')", NameRP(id), NameRP(playerid), msg);
What else would I need to do in order for this to work? I don't entirely understand pquery, just want this to log into the db
Reply
#2

You don't need to use mysql_pquery for this, you can just use mysql_tquery in this case
Код:
mysql_tquery(sqlConnection, query);
and it'll work fine.
Reply
#3

Quote:
Originally Posted by DTV
Посмотреть сообщение
You don't need to use mysql_pquery for this, you can just use mysql_tquery in this case
Код:
mysql_tquery(sqlConnection, query);
and it'll work fine.
../gamemodes/Includes/Commands/General.pwn(250) : error 035: argument type mismatch (argument 3)

Код:
			mysql_tquery(sqlConnection, query, sizeof(query), "INSERT INTO kicklogs (`Name`, `Admin`, `Reason`) VALUES ('%e', '%e', '%e')", NameRP(id), NameRP(playerid), msg);
edit: looked up samp wiki for the function but still confused
Reply
#4

Use tquery for UPDATE operations and pquery for SELECT operations.
Pquery would work here but tquery would be better in this case
On your last reply: No, he means that you have to add this line after your code
Код:
mysql_tquery(sqlConnection, query);
Reply
#5

Quote:
Originally Posted by Battlezone
Посмотреть сообщение
Use tquery for UPDATE operations and pquery for SELECT operations.
Pquery would work here but tquery would be better in this case
Ah I got it.
Reply
#6

Quote:
Originally Posted by Jing_Chan
Посмотреть сообщение
Ah I got it.
Код:
	mysql_format(sqlConnection, query, sizeof(query), "INSERT INTO kicklogs (`Name`, `Admin`, `Reason`) VALUES ('%e', '%e', '%e')", NameRP(id), NameRP(playerid), msg);
	mysql_tquery(sqlConnection, query);
Reply
#7

Quote:
Originally Posted by Battlezone
Посмотреть сообщение
Use tquery for UPDATE operations and pquery for SELECT operations.
Pquery would work here but tquery would be better in this case
On your last reply: No, he means that you have to add this line after your code
Код:
mysql_tquery(sqlConnection, query);
It depends on your needs, honestly, and the advice above shouldn't be taken as strict truth.

Queries sent with tquery are processed in the order they are sent while queries sent with pquery may not necessarily be. For tquery, imagine one pipe that the queries are put into. First in is first out. For pquery there are multiple pipes (this is where the poolsize parameter comes in) and the query is put into the pipe that is least full.

So if you have two select statements that you want to execute in order then you use tquery. Similarly, if you have multiple independent updates then you can use pquery here instead.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)