whats different between Cache:mysql_query and tquery?
#1

is tquery faster or safer?
sometime I dont want use tquery, beacause I dont need a callback or I just want query it and use it inline.
sorry for bad english, THX to replies.
Reply
#2

i don't know what you mean but safer it's faster
Reply
#3

Im myself using old R6 plugin with mysql_query_callback, so answer is based on what i read in wiki.

Mysql qeury will wait for response before continuing further, while tquery will be executed in another thread, code will continue and when mysql server send response it will be passed to callback.

Basically tquery is better for performance as it will be threaded. Simple example is, you send mysql_query to mysql server, it takes 5 seconds to respond (lets say huge lag or something), in that 5 seconds until mysql server responds or plugin decides that request has timed out your server will be stuck and not doing anything, not even updating players positions and such...meaning players would see server lag. While with tquery, after calling that function, server continues with executing his code, and when mysql server responds you get all info in a callback.
Reply
#4

Thank you.
Reply
#5

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Im myself using old R6 plugin with mysql_query_callback, so answer is based on what i read in wiki.

Mysql qeury will wait for response before continuing further, while tquery will be executed in another thread, code will continue and when mysql server send response it will be passed to callback.

Basically tquery is better for performance as it will be threaded. Simple example is, you send mysql_query to mysql server, it takes 5 seconds to respond (lets say huge lag or something), in that 5 seconds until mysql server responds or plugin decides that request has timed out your server will be stuck and not doing anything, not even updating players positions and such...meaning players would see server lag. While with tquery, after calling that function, server continues with executing his code, and when mysql server responds you get all info in a callback.
Can I do this ??

Код:
forward checkPlayerAccount(name[], queried = 0);
public checkPlayerAccount(name[], queried = 0) {
	if(requeried == 0) {
		new query[128];
		mysql_format(mySQL, query, sizeof query, "SELECT * FROM `accounts` WHERE `name` = '%e' LIMIT 1", name);
		mysql_tquery(mySQL, query, "checkPlayerAccount", format[] = "sd", name[], 1);
	} else {
		// Do something..
	}
}
Reply
#6

That would be a good idea, never thought of that.
Try it and find out if it works.

My guess is that it would work just fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)