SA-MP Forums Archive
Few questions - 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: Few questions (/showthread.php?tid=599751)



Few questions - DetoNater - 29.01.2016

Q1:
Do I need to use cache_delete(); in my script for the latest, mysql R-39 plugin since it stores cache, and do they cause the server to lag more ??

Q2:
Without MapAndreas is it possible to find the lowest GetPlayerPosFindZ co-ordinate??

Q3:
Is it possible to escape string in query?? For eg, when I type yass1n, but the result in the DB is Yass1n, the result is not returned?? Any possible ways?


Re: Few questions - xTURBOx - 30.01.2016

haven't used mysql so i cant answer 1 and 3
but for 2) i think(but won't be accurate)


Re: Few questions - itsCody - 30.01.2016

3) use mysql_format(..) and use %e for escaping.


Re: Few questions - DetoNater - 30.01.2016

-bump-, not clear with the issue, ******d of case insensitivity in sql, saying to use latin swedish collation, not clear with this.


Re: Few questions - Vince - 30.01.2016

Cache is automatically deleted if you use threaded queries, unless you use cache_save (obviously). You must also manually store and delete cache with non-threaded queries.

Set collation to utf8_general_ci. To change collation, see: http://stackoverflow.com/questions/1...e-table-column


Re: Few questions - DetoNater - 31.01.2016

Q3 - issue solved,
Q1 - I use non-threaded queries, since its like "near to hell" changing to threaded queries in my script, that's okay, now in non-threaded queries the cache is saved automatically, but should I delete with the cache_delete(); ?
example
Код:
mysql_format(mysql,query,sizeof(query),"SELECT `clan`,`Clanscore` FROM `clans` ORDER BY `Clanscore` DESC LIMIT 30");
	mysql_query(mysql,query);
    if(cache_num_rows(mysql) > 0)
   	{
	    
	    for(new i = 0; i < cache_get_row_count(); i++)
        {
        cache_get_field_content(i, "clan", Clan);
        cache_get_field_content(i, "Clanscore",score);
        format(content,sizeof(content),"%s%s\t\t%s Score\n",content,Clan,score);
		}

	}
	else if(AdminLevel{playerid} < 4) return SendLangMessage(playerid, _COLOR_RED, "Es gibt keine Clans!","There are no Clans!","No hay clanes!");
now should i use cache_delete(Clan);


Re: Few questions - DetoNater - 13.02.2016

-bump- any ideas??


Re: Few questions - Jefff - 13.02.2016

If you are using mysql_query - YES you need use cache_delete

new Cache:result = mysql_query(...);
// code
...
...
cache_delete(result);

try use mysql_debug then your code and you will see warning about not cleared cache


Re: Few questions - DetoNater - 13.02.2016

What if I use mysql_function_query(); replacing mysql_query(); will that be a good move ??


Re: Few questions - JeaSon - 13.02.2016

just use mysql_tquery and you dont need to use cache_delete

PHP код:
mysql_tquery(mysql,query,"","");