30.05.2013, 14:01 
	
	
	
	
	
	
				
				
					[Tutorial] Using BlueG's MySQL plugin R7 (with cache)
			
	
		
		
		
		09.06.2013, 10:28 
	
	
	
		Hm - I've worked with similar grouping before. I think you should wrap up t1.time in MIN().
// Edit. Did not see you had solved it. However if you see this, feel free to post your solution to it. I remember such queries making me shiver all over a few years ago.
	
	
	
// Edit. Did not see you had solved it. However if you see this, feel free to post your solution to it. I remember such queries making me shiver all over a few years ago.
		
		
		
		21.07.2013, 08:56 
	
	
	
		Is is compulsory to give a function to function_query??
Can I do it like
	
	
	
	
Can I do it like
Code:
CheckAccountExists(account[])
{
	new string[128];
	format(string, sizeof(string), "SELECT * FROM player_accounts WHERE Name = '%s'", account);
	mysql_function_query(dbHandle,string,FALSE, "", "");
	new value;
	value = mysql_num_rows();
	return value;
}
		
		
		
		21.07.2013, 09:07 
	
	
	
		Yes, it is in R7 or later.
	
	
	
	
		
		
		
		21.07.2013, 09:21 
	
	
	
		But it doesn't work for me  
	
	
	
	
 
	
		
		
		
		21.07.2013, 10:52 
	
	
	
		You can do it this way;
If you want to do it the 'old' way, without CheckAccount callback, you can try y_inline which is supported in R31.
	
	
	
	
pawn Code:
CheckAccountExists(account[])
{
new string[128];
format(string, sizeof(string), "SELECT * FROM player_accounts WHERE Name = '%s'", account);
mysql_function_query(dbHandle, string, true, "CheckAccount", "s", account);
}
forward CheckAccount(account[]);
public CheckAccount(account[])
{
new rows, fields;
cache_get_data(rows, fields);
if(!rows)
{
// account does not exist, register?
}
else
{
//proceed to login?
}
return 1; // To clear cache
}
		
		
		
		21.07.2013, 10:57 
	
	
	
		Guys, I updated from R15 to R27 few days ago and now we have R31? Are those all bugfixes, or are there some new features? What's the status of mysql_format and linux (I'm using it extensively with %e instead of normal format + mysql_real_escape_string)? Is there some compact changelog (I'm not so comfortable in using ****** code instead of github), other than fixed issues list?
#e: 1k post, yay
	
	
	
#e: 1k post, yay
		
		
		
		21.07.2013, 11:14 
	
	
	Quote:
| Guys, I updated from R15 to R27 few days ago and now we have R31? Are those all bugfixes, or are there some new features? What's the status of mysql_format and linux (I'm using it extensively with %e instead of normal format + mysql_real_escape_string)? Is there some compact changelog (I'm not so comfortable in using ****** code instead of github), other than fixed issues list? #e: 1k post, yay | 
https://code.******.com/p/sa-mp-mysq...ce/detail?r=28
https://code.******.com/p/sa-mp-mysq...ce/detail?r=29
https://code.******.com/p/sa-mp-mysq...ce/detail?r=30
https://code.******.com/p/sa-mp-mysq...ce/detail?r=31
Quote:
| - added '%%' specifier to native 'mysql_format' - mysql_reconnect returns true if connection is established, else false - added optional parameter "autoreconnect" to mysql_connect to control whether the plugin should reconnect automatically if connection is lost - added optional parameter "wait" to mysql_close to control whether the plugin should wait till all pending queries are executed or not - re-added our old and beloved native mysql_errno | 
		
		
		
		28.07.2013, 23:46 
	
	
	Code:
forward AracYukle();
public AracYukle()
{
	new resultline[1024];
	new car[37][64];
	new query[100];
	mysql_real_escape_string("SELECT * FROM araclar ORDER BY id ASC",query);
	mysql_query(query);
	mysql_store_result();
    for(new h = 0; h < sizeof(DynamicCars); h++)
	{
		while(mysql_fetch_row(resultline)==1)
		{
			H_split(resultline, car, '|');
			h = AddStaticVehicleEx(strval(car[1]), floatstr(car[2]), floatstr(car[3]), floatstr(car[4]), floatstr(car[5]), strval(car[6]), strval(car[7]), -1);
			DynamicCars[h][cSQLid] = strval(car[0]);
			DynamicCars[h][CarModel] = strval(car[1]);
			DynamicCars[h][CarX] = floatstr(car[2]);
			DynamicCars[h][CarY] = floatstr(car[3]);
			DynamicCars[h][CarZ] = floatstr(car[4]);
			DynamicCars[h][CarAngle] = floatstr(car[5]);
			DynamicCars[h][CarColor1] = strval(car[6]);
			DynamicCars[h][CarColor2] = strval(car[7]);
			DynamicCars[h][FactionCar] = strval(car[8]);
			DynamicCars[h][CarType] = strval(car[9]);
			DynamicCars[h][CarValue] = strval(car[10]);
			DynamicCars[h][CarOwned] = strval(car[11]);
	        strmid(DynamicCars[h][CarOwner], car[12], 0, strlen(car[12]), 20);
	        strmid(DynamicCars[h][CarDescription],car[13], 0, strlen(car[13]), 20);
			DynamicCars[h][CarHealth] = floatstr(car[14]);
			DynamicCars[h][AracPatladi] = strval(car[15]);
			DynamicCars[h][AracKiraZaman] = strval(car[16]);
			DynamicCars[h][cSigorta] = strval(car[17]);
			DynamicCars[h][cKazaSayi] = strval(car[18]);
			DynamicCars[h][ModPaintjob] = strval(car[19]);
			DynamicCars[h][ModSpoiler] = strval(car[20]);
			DynamicCars[h][ModRoof] = strval(car[21]);
			DynamicCars[h][ModLeftSideSkirt] = strval(car[22]);
			DynamicCars[h][ModRightSideSkirt] = strval(car[23]);
			DynamicCars[h][ModExhaust] = strval(car[24]);
			DynamicCars[h][ModWheels] = strval(car[25]);
			DynamicCars[h][ModFrontBumper] = strval(car[26]);
			DynamicCars[h][ModRearBumper] = strval(car[27]);
			DynamicCars[h][ModStereo] = strval(car[28]);
			DynamicCars[h][ModHydraulics] = strval(car[29]);
			DynamicCars[h][ModNitro] = strval(car[30]);
			DynamicCars[h][ModNeon] = strval(car[31]);
			DynamicCars[h][ModAlarm] = strval(car[32]);
			DynamicCars[h][Panels] = strval(car[33]);
			DynamicCars[h][Doors] = strval(car[34]);
			DynamicCars[h][Lights] = strval(car[35]);
			DynamicCars[h][Tires] = strval(car[36]);
			AraciModifiyeEt(h);
			h++;
		}
	}
}
		
		
		
		29.07.2013, 03:28 
	
	
	
		Have you tried to do it yourself? It's a big code and you should really be trying to convert it yourself.
	
	
	
	
		
		
		
		29.07.2013, 15:22 
	
	
	
		I'm working on it for a week and I could not, really.
	
	
	
	
		
		
		
		30.07.2013, 03:07 
	
	
	Quote:
| You can do it this way; pawn Code: 
 | 
*First of all, I am updating from R5 to R7
*I have used if(CheckAccountExists(...))
How do make change to the code without effecting these ifs??
Thanks
 
	
		
		
		
		29.10.2013, 14:43 
	
	
	
		I have question: how to make function like GetPlayerInt(playerid, field[]) using cache? I don't want to create functions to all my queries.
	
	
	
	
		
		
		
		12.11.2013, 08:50 
	
	
	
		It gives me argument type mismatch (argument 1)
At line mysql_funtion_query
How to solve this?
	
	
	
	
At line mysql_funtion_query
How to solve this?
HTML Code:
new
    count = 10,
    result[2][32], 
    string[(24 + 10) * 10];
mysql_function_query("SELECT `Score`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Score` ASC LIMIT 10");
mysql_store_result();
if (mysql_num_rows() < 1) return 0;
while (mysql_retrieve_row() && count > 0)
{
    mysql_fetch_field_row(result[0], "Score");
    mysql_fetch_field_row(result[1], "PlayerName");
    format(string, sizeof(string), "%s%d. %s: %d\n", string, count--, result[1], strval(result[0]));
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Top 10", string, "Close", "");
		
		
		
		11.01.2014, 13:35 
	
	
	
		I'm lost. My script is for the r6 version. So now r33 r34... is for wich update?
	
	
	
	
		
		
		
		13.01.2014, 16:52 
	
	
	
		Hi,
How can I use "cache_get_row_int(0, 1);" with the R7 please ? Cause it was fine with R35 but now I got a lot of errors.
	
	
	
How can I use "cache_get_row_int(0, 1);" with the R7 please ? Cause it was fine with R35 but now I got a lot of errors.
		
		
		
		14.01.2014, 13:25 
	
	
	
	
	
	
		
		
		
		22.02.2014, 20:51 
	
	
	Code:
Plugin version R8 and newer BlueG has decided to use a public repository for the development of this plugin. This means that others can commit code as well, and some already have. Here are some of the changes: * Added cache_get_row_int and cache_get_row_float (supported briefly in this tutorial, but I'll continue it some time). * More security added to internal string handling to prevent buffer overflows. * Fixed crash issue on gamemode restart (gmx). * A few more internal issues cleared up.
Code:
[17:33:18] [MySQL] (Main Pipelines) Connecting to 5.231.45.5... [17:33:18] [MySQL] (MainPipeline) Connection successful toward MySQL Database Server! [17:33:18] [LoadHouses] Loading data from database... [17:33:18] [LoadDynamicDoors] Loading data from database... [17:33:18] [LoadDynamicMapIcons] Loading data from database... [17:33:18] [LoadDynamicTexts] Loading data from database... [17:33:19] [LoadTurfWars] 40 turfs loaded. [17:33:19] [LoadPaintballArenas] 10 paintball arenas loaded. [17:33:19] [LoadEventPoints] 0 event points loaded. [17:33:19] [LoadGates] 4000 gates loaded. [17:33:19] [LoadElevatorStuff] 20 floors loaded. [17:33:19] [LoadFamilies] 16 families loaded. [17:33:19] [LoadPoints] 9 points loaded. [17:33:24] [LoadCDealerships] 15 dealerships loaded. [17:33:24] [MiscLoad] Misc Loaded [17:33:24] [Tax] Government Tax/Vault Loaded. [17:33:36] [LoadCDealerships] 15 dealerships loaded. [17:33:36] [MiscLoad] Misc Loaded [17:33:36] [Tax] Government Tax/Vault Loaded.
		
		
		
		20.03.2014, 08:03 
	
	
	
		nice
	
	
	
	
		
		
		
		16.05.2014, 13:03 
	
	
	
		great!!!
i really need this tutorial!
you're the only one who makes me understand what threaded MySQL is...
+REP
	
	
	
i really need this tutorial!
you're the only one who makes me understand what threaded MySQL is...
+REP
					« Next Oldest | Next Newest »
				
				Users browsing this thread: 2 Guest(s)












