[Plugin] [REL] MySQL Plugin (Now on github!)

Quote:
Originally Posted by Sp3cter
Посмотреть сообщение
So isn't it slowly ?
Yes, but I'd rather decrease performance a bit to increase stability.
Reply

Why are you guys so crazy about speed? The plugin runs pretty fast already wtf why don't you guys focus on removing crashes and bugs and improve stability (uptime) then bloody performance for once!
Reply

i have a question related to mysql
what this means:
format(query, sizeof(query), "UPDATE `users` SET health = %.1f, X = %.2f, Y = %.2f, Z = %.2f, A = %.2f, interior = %d, vw = %d, skin = %d WHERE `id` = %d",

i dont know what this%1f means?
and another question what row and field is?
Reply

Quote:
Originally Posted by Kar
View Post
Why are you guys so crazy about speed? The plugin runs pretty fast already wtf why don't you guys focus on removing crashes and bugs and improve stability (uptime) then bloody performance for once!
R33 is much much faster than R31. I ran few tests with caches an speed is awesome.
Reply

Quote:
Originally Posted by B-Matt
View Post
R33 is much much faster than R31. I ran few tests with caches an speed is awesome.
R33 isn't out yet?
Reply

He is one of my beta testers.
Reply

Ah, sorry about that mate!
Reply

Quote:
Originally Posted by caoraivoso3
View Post
i have a question related to mysql
what this means:
format(query, sizeof(query), "UPDATE `users` SET health = %.1f, X = %.2f, Y = %.2f, Z = %.2f, A = %.2f, interior = %d, vw = %d, skin = %d WHERE `id` = %d",

i dont know what this%1f means?
and another question what row and field is?
Numbers after decimal point.

new Float:asd = 5.123456;

with:
%.1f 5.1
%.2f 5.12
%.4f 5.1234
Reply

thanks
Reply

Best MySQL plugin, i use the latest version with the cache functions.
The speed is amazing!
Thank you guys for your hard work on this plugin!
Reply

i use this function and i add a new field to create in mysqldb.

mysql_function_query(g_Handle, "CREATE TABLE IF NOT EXISTS `users` ( \
`id` int(11) NOT NULL AUTO_INCREMENT, \
`name` varchar(24) NOT NULL, \
`pass` varchar(129) NOT NULL, \
`salt` varchar(30) NOT NULL, \
`health` float NOT NULL, \
`X` float NOT NULL, \
`Y` float NOT NULL, \
`Z` float NOT NULL, \
`A` float NOT NULL, \
`interior` int(2) NOT NULL, \
`vw` int(11) NOT NULL, \
`skin` int(3) NOT NULL, \
`Admin` int(6) NOT NULL, \
`Gm` int(6) NOT NULL, \
`Pamoney` int(30) NOT NULL, \
PRIMARY KEY (`id`) \
)", false, "SendQuery", "");

return 1;
}

but i get this two errors:
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(143) : error 075: input line too long (after substitutions)
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(144) : error 017: undefined symbol "mysql_function_query"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

what i can do about it?
Reply

Quote:
Originally Posted by caoraivoso3
Посмотреть сообщение
i use this function and i add a new field to create in mysqldb.

mysql_function_query(g_Handle, "CREATE TABLE IF NOT EXISTS `users` ( \
`id` int(11) NOT NULL AUTO_INCREMENT, \
`name` varchar(24) NOT NULL, \
`pass` varchar(129) NOT NULL, \
`salt` varchar(30) NOT NULL, \
`health` float NOT NULL, \
`X` float NOT NULL, \
`Y` float NOT NULL, \
`Z` float NOT NULL, \
`A` float NOT NULL, \
`interior` int(2) NOT NULL, \
`vw` int(11) NOT NULL, \
`skin` int(3) NOT NULL, \
`Admin` int(6) NOT NULL, \
`Gm` int(6) NOT NULL, \
`Pamoney` int(30) NOT NULL, \
PRIMARY KEY (`id`) \
)", false, "SendQuery", "");

return 1;
}

but i get this two errors:
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(143) : error 075: input line too long (after substitutions)
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(144) : error 017: undefined symbol "mysql_function_query"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

what i can do about it?
Try this:
Код:
	mysql_tquery( 1, "CREATE TABLE IF NOT EXISTS `users` ( \
	`id` int(11) NOT NULL AUTO_INCREMENT, \
	`name` varchar(24) NOT NULL, \
	`pass` varchar(129) NOT NULL, \
	`salt` varchar(30) NOT NULL, \
	`health` float NOT NULL, \
	`X` float NOT NULL, \
	`Y` float NOT NULL, \
	`Z` float NOT NULL, \
	`A` float NOT NULL, \
	`interior` int(2) NOT NULL, \
	`vw` int(11) NOT NULL, \
	`skin` int(3) NOT NULL, \
	`Admin` int(6) NOT NULL, \
	`Gm` int(6) NOT NULL, \
	`Pamoney` int(30) NOT NULL, \
	PRIMARY KEY (`id`) )", "", "");
I insert this to my script and all it's ok ...no errors (But U need to have the latest versions of MySQL include/plugin , here -> https://code.******.com/p/sa-mp-mysq...downloads/list )
Quote:

Pawn compiler 6.3.3166 Copyright © 1997-2011, ITB CompuPhase
[Finished in 0.6s]

Reply

what you change? please explain i already have the last plugin
Reply

Hi!
I ask that when you are expected to appear in the r33?

sorry bad english..
Reply

Read the thread..
http://forum.sa-mp.com/showpost.php?...postcount=4158
Reply

Quote:
Originally Posted by caoraivoso3
Посмотреть сообщение
i use this function and i add a new field to create in mysqldb.

mysql_function_query(g_Handle, "CREATE TABLE IF NOT EXISTS `users` ( \
`id` int(11) NOT NULL AUTO_INCREMENT, \
`name` varchar(24) NOT NULL, \
`pass` varchar(129) NOT NULL, \
`salt` varchar(30) NOT NULL, \
`health` float NOT NULL, \
`X` float NOT NULL, \
`Y` float NOT NULL, \
`Z` float NOT NULL, \
`A` float NOT NULL, \
`interior` int(2) NOT NULL, \
`vw` int(11) NOT NULL, \
`skin` int(3) NOT NULL, \
`Admin` int(6) NOT NULL, \
`Gm` int(6) NOT NULL, \
`Pamoney` int(30) NOT NULL, \
PRIMARY KEY (`id`) \
)", false, "SendQuery", "");

return 1;
}

but i get this two errors:
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(143) : error 075: input line too long (after substitutions)
C:\Users\rui\Documents\garage\gamemodes\tyhrefwdsq .pwn(144) : error 017: undefined symbol "mysql_function_query"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

what i can do about it?
Put it in the mysql_format function and then use the query.
Reply

hey i have another questions to all of us. I am making a house system and i want to make all players that have the house key can enter in the house but i need to create a field to store all the player's sqlid on that field.
How i can do that? thanks if anyone can helpme
Reply

Is it possible to speed up mysql_real_escape_string?

It takes 193ms for me for about 600 length string.

I'm using R30.
Reply

I think I see a potential problem with the code in CScripting.cpp.

The memory allocated for the output of the C mysql_real_escape_string must be (2*strlen(input))+1. Assuming that you usually know what you're doing, when you write PAWN code, you do this:
pawn Код:
new src[32];
new dest[64];
mysql_real_escape_string(src, dest); // max_len=sizeof(destination) by default
What the plugin native then does is:
pawn Код:
size_t DestLen = (params[4] <= 0 ? 8192 : params[4]); // DestLen becmes 64 (in our case at least)
// ...
char *StrBuffer = (char *)malloc(DestLen*2+1); // Allocates 64*2+1=129 bytes of memory
memset(StrBuffer, 0, DestLen*2 + 1); // Set it all to zeros (?)
cell StringLen = (cell)mysql_real_escape_string(ConnPtr, StrBuffer, Source, strlen(Source));
StrAmx::SetCString(amx, params[2], StrBuffer, params[4]);
free(StrBuffer);
Also, I think that memset needn't be used here - the C mysql_real_escape_string appends a NULL byte by itself. To allocate 64+1 bytes of memory (aka. what we need here to be on the safe side), it needs to make use of the SourceLen variable (cannot exceed 32 in our example) and double it and add 1 byte for the NULL.

I assume this is not going to make a relevant speed difference, and perhaps the AMX interactions with large arrays is just slow, but using heap allocation (alloca instead of malloc) is a possibility here as well. Once again may not make a relevant speed difference, and may even be dangerous (if you start allocating megabytes!)
Reply

Hi guys, last time (R8 ) there were some issues with mysql_format and linux - is this fixed now?
Reply


Forum Jump:


Users browsing this thread: 20 Guest(s)