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

Quote:
Originally Posted by John_Cooper
Посмотреть сообщение
This is the problem im getting Failed (/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by plugins/mysql_debian.so))
Download here ( Thanks for Andre ) the recomplied version or talk the host owner about this problem.
Reply

Could put that supports 64-bit CentOS, thanks for your help
Reply

Quote:
Originally Posted by Dark_Children
Посмотреть сообщение
Could put that supports 64-bit CentOS, thanks for your help
Try the "untested" centos variant from here: http://www.egaming.ro/MySQL/Test-x64/

Please let me know if it works.

Thanks.
Reply

i get error on starting plugin:

Server Plugins
--------------
Loading plugin: mysql.so
Failed (/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (require by plugins/mysql.so))
Loaded 0 plugins.

error on debian 6.0
Reply

which version have you tried ?
Reply

version R6-2
R5 - lib15 error but i am not intrested R5
Reply

From the link above which I've posted ?

http://www.egaming.ro/MySQL

Try : Debian-mysqlR6-2-static.tar.gz or Debian-mysqlR6-static.tar.gz
Reply

Tnx xxmitsu its work now
Reply

This or 2.1.1 plugin better ?
Reply

Well, AFAIK mysql_get_field is slow, so its better to use sscanf. One question, does this will work? I want to get variable "Name" and store into a string. I can't test it ATM, because Im busy :<

pawn Код:
new Query[62], Name[24];
mysql_format(_, Query, "SELECT `Name` FROM `players` WHERE `something='%d'", value);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row(Query);
sscanf(Query, "p<|>s[24]", Name);
mysql_free_result();
Or, there is other way to do this better?
Reply

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
Well, AFAIK mysql_get_field is slow, so its better to use sscanf. One question, does this will work? I want to get variable "Name" and store into a string. I can't test it ATM, because Im busy :<

pawn Код:
new Query[62], Name[24];
mysql_format(_, Query, "SELECT `Name` FROM `players` WHERE `something='%d'", value);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row(Query);
sscanf(Query, "p<|>s[24]", Name);
mysql_free_result();
Or, there is other way to do this better?
Sscanf is not needed here.
Reply

That code can indeed be simplified a lot (making it faster as well). Since `name` is the only field being returned, there are no delimiters or anything else in the mysql_fetch_row returned string, so you can simply do:
pawn Код:
mysql_fetch_row(Name);
This raises a small question: Why do you use mysql_format when there's no %e specifier involved? In this case it would be more simple to use the actual format function.
pawn Код:
format(Query, sizeof(Query), "SELECT Name from players WHERE something=%d", value);
As you can see I removed some useless quotes. They are not required around table or field names, they are only necessary for strings. The very very small speed gain set aside, it makes the syntax easier to read in my opinion.
Reply

So.. I just need:

pawn Код:
new Query[62], Name[24];
format(Query, lenght, "SELECT `Name` FROM `players` WHERE `something='%d'", value);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row(Name);
mysql_free_result();
Reply

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
So.. I just need:

pawn Код:
new Query[62], Name[24];
format(Query, lenght, "SELECT `Name` FROM `players` WHERE `something='%d'", value);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row(Name);
mysql_free_result();
Yeah.
Btw i doubt about the speed incrase without the quotes.
I even benchmarked Select WHERE ID and Select WHERE NAME. Didn't make any difference. So the only advantage i can think off is a smaller packet sent to the server.
Reply

pls help....



how i put in GODFATHER
Reply

Quote:
Originally Posted by wups
Посмотреть сообщение
Yeah.
Btw i doubt about the speed incrase without the quotes.
I even benchmarked Select WHERE ID and Select WHERE NAME. Didn't make any difference. So the only advantage i can think off is a smaller packet sent to the server.
A small speed difference would make sense - there's less for the machine to go over, less to process. Meaning a smaller packet size as you said, this means less to process by the MySQL server receiving the query!

Also there's a mistake in this query which I didn't mange spotting before:
SELECT `Name` FROM `players` WHERE `something='%d'
The `something` field ending quotation isn't ended properly, so it'll either have to be:
SELECT `Name` FROM `players` WHERE `something`='%d' (which is useless and I wouldn't suggest it)
Or...
SELECT Name FROM players WHERE something=%d (which is more like it!)
Reply

The difference will be noticed more if you're having a really large database, your db (by design) is properly indexed and the queries are written to take advance of the indexing.
Reply

I have problem with this plugin. The server keeps freezing randomly, not crashing, freezing. People only see connected to server, and nothing after it. Server responds to nothing, and has to be forced to restart.
This isn't caused by some specific query or function, every function works, randomly server just freezes. Sometimes server stays up for week without freezes, sometimes just for day. I am using threaded mysql, code is written in OnQueryFinish.

Server is running on linux, players usually from 50 to 80, latest SA-MP server, latest plugin.

Do you have any idea what could cause these freezes? could it be incorrectly written script, if so, what is wrong, or too many queries at the same time?

Help appreciated.
Reply

Have you checked debug log ?

Are there any errors ? does your server suddenly lose the connection to database so it needs to reconnect?

Is the reverse dns option active on mysql server? if yes, you should start the mysql process with '--skip-name-resolve' parameter.

There are some mysql techniques to debug for 'slow queries'. You cold ****** that.. if anything else seems fine.
Reply

Tell me how can I get this code of such a request. What would it take some data from the database.
Код:
format(query,sizeof(query),"SELECT date1, date2, date3, date4, ..., datan FROM players WHERE id=%d AND Password='%s' LIMIT 1",id,password);
But the fact is that I have a lot of data. About 40 DATA. (Date1 - date40). But if I do as posted above then get an error that the string is very long.
How can this be done?
Just do not say do SELECT * ....
Because in addition to the required fields, I have a lot of extra fields. Including text and they are only needed for the site.
Reply


Forum Jump:


Users browsing this thread: 17 Guest(s)