SA-MP Forums Archive
Function or normal exec - 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: Function or normal exec (/showthread.php?tid=504632)



Function or normal exec - andyandyy8 - 05.04.2014

This functiun make lag(this is a question not an afirmation)
Quote:

MySQL_SetInteger(sqlid, fieldname[], value, tablename[])
{
new query[256];
format(query, sizeof(query), "UPDATE %s SET %s = %d WHERE id = %d LIMIT 1", tablename, fieldname, value, sqlid);
return mysql_query(query);
}

Is better to use this ?
Quote:

format(query, sizeof(query), "UPDATE %s SET %s = %d WHERE id = %d LIMIT 1", tablename, fieldname, value, sqlid);
mysql_query(query);




Re: Function or normal exec - Dokins - 05.04.2014

It won't cause lag, if used appropriately.

If you want to update more than one variable, you need to use a full query because it's non-threaded function, it has to process each one. So if you made loads of the SetInteger in the one command, then you're making it un-necessary as you could put it all into one query.