SA-MP Forums Archive
[Plugin] [REL] MySQL Plugin (Now on github!) - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MySQL Plugin (Now on github!) (/showthread.php?tid=56564)



Re: [REL] MySQL Plugin R6-2 - 17/07/11 - kurta999 - 07.09.2011

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.


Respuesta: [REL] MySQL Plugin R6-2 - 17/07/11 - DarkChildren - 07.09.2011

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


Re: Respuesta: [REL] MySQL Plugin R6-2 - 17/07/11 - xxmitsu - 08.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - whitedragon - 08.09.2011

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


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - xxmitsu - 08.09.2011

which version have you tried ?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - whitedragon - 08.09.2011

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


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - xxmitsu - 08.09.2011

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


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - whitedragon - 08.09.2011

Tnx xxmitsu its work now


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Ernis456 - 11.09.2011

This or 2.1.1 plugin better ?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Gh0sT_ - 14.09.2011

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?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - wups - 14.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - AndreT - 14.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Gh0sT_ - 14.09.2011

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();



Re: [REL] MySQL Plugin R6-2 - 17/07/11 - wups - 14.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Slice - 14.09.2011

pls help....



how i put in GODFATHER


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - AndreT - 14.09.2011

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!)


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - xxmitsu - 14.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Johnson_boy - 20.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - xxmitsu - 21.09.2011

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.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - PawnNewCommer - 21.09.2011

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.