01.02.2012, 09:22
I want to know if anyone knows an optimization for this MySQL code:
This is the thread code:
There's around 50 columns in that table. Is there a way to just select those 7 results without getting the entire row?
Also, if anyone knows of a way to optimize the first query check(Loop part), please let me know. I'm afraid this might lag after a few players come online(20ish or so).
pawn Код:
// In a timer each 3 minutes
foreach(Player, i)
{
format(gQuery, sizeof(gQuery), "SELECT * FROM `Tests` WHERE `IP` = '%s'", gPIP[i]);
mysql_query(gQuery, THREAD_TEST, i);
}
pawn Код:
case THREAD_TEST:
{
mysql_store_result();
if(IsPlayerConnected(extraid))
{
mysql_retrieve_row();
mysql_get_field("Test1", iResult);
mysql_get_field("Test2", iResult);
mysql_get_field("Test3", iResult);
mysql_get_field("Test4", iResult);
mysql_get_field("Test5", iResult);
mysql_get_field("Test6", iResult);
mysql_get_field("Test7", iResult);
}
mysql_free_result();
}
Also, if anyone knows of a way to optimize the first query check(Loop part), please let me know. I'm afraid this might lag after a few players come online(20ish or so).