SA-MP Forums Archive
[MYSQL] proper way to do multi-table query??Rep+ - 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] proper way to do multi-table query??Rep+ (/showthread.php?tid=602016)



[MYSQL] proper way to do multi-table query??Rep+ - iLuXing - 01.03.2016

Hello guys, I confused this.
I use lots of table to store player's data but on player login, I have to load them all.

now I use this-kind method to loadit, but its slowly.
Can you point a proper way to do this
Код:
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `a` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `b` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `c` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `d` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `e` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `f` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `g` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);




THX.


Re: [MYSQL] proper way to do multi-table query??Rep+ - itsCody - 01.03.2016

What do these tables store, that is a lot of tables for simple player data..


Re: [MYSQL] proper way to do multi-table query??Rep+ - iLuXing - 01.03.2016

Yea, more than 60 fileds in one table, and I split its up to lots tables.
I just thought a method, but I think its still slowly.

make every tquery the same callback, and give it a check.

when check = 1, load mysql_format(1);
end, check ++
and then. check = 2, =3 , =4.
when check = end. call a func.

so....slowly I think.


Re: [MYSQL] proper way to do multi-table query??Rep+ - Vince - 01.03.2016

As long as it's threaded it shouldn't matter. However your example is too abstract. Some tables may be able to be joined together while others may be left out completely. Storing non-essential data in variables seems redundant to me.


Re: [MYSQL] proper way to do multi-table query??Rep+ - iLuXing - 01.03.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
As long as it's threaded it shouldn't matter. However your example is too abstract. Some tables may be able to be joined together while others may be left out completely. Storing non-essential data in variables seems redundant to me.
no no no,
some states data will be stored in one table. and it need update per sceond.
and some non-changed data like name, password and salt in one table.
weapons in one tables changed by call.