Posts: 762
Threads: 157
Joined: Feb 2009
Reputation:
0
This is not a problem with the plugin.
You need to download and compile a thread-safe version of mysql, install it, and link it correctly.
I know this is a little hard to do though for inexperienced linux users, it took me a bit to figure it out correctly, when I get a chance, I'll see if I can include the already compiled thread safe libraries with the plugin.
I am very busy though, I'm in the middle of moving to another state.
EDIT: Also please note that every release of this plugin has been used with the latest mysql build at the time of compile. So make sure to check if you have the latest mysql version.
Posts: 1,843
Threads: 8
Joined: Nov 2008
Reputation:
0
Yep. Seems to work. Thanks StrickenKid.
Posts: 63
Threads: 4
Joined: Jul 2008
Reputation:
0
First I just want to say, I like the plugin, upgrading was a great thing to do.
My issue is, I understand mysql_query() is supposed to return 1 or 0 for success/fail, but for me it doesn't seem to be returning the success.
I have quite a few functions that run similar to this
if(mysql_query(query))
{
//do something here such as zero enums on a 'DELETE FROM WHERE' query
}
And the query does run, because the affected row does get deleted from the table, but it's not doing anything (such as zeroing out the associated enums) in the { }.
Does anyone have any thoughts on this? Or maybe a possible work around. The most used query with the problem statement is 'DELETE FROM WHERE' so there isn't really data to store for the query for mysql_store_result(), to use that so... Yeah.
There are no errors in the log, or console because the query does run, it just doesn't return. :/
I'm out of ideas, if anyone has any I'm all ears.
Posts: 762
Threads: 157
Joined: Feb 2009
Reputation:
0
mysql_query returns 0 for success and an error code (non-zero) for fail. The wiki might be outdated, I'll check it when i get a chance.
Posts: 63
Threads: 4
Joined: Jul 2008
Reputation:
0
Wow, I feel stupid.
It was something I was going to try on a hunch but got too tired to mess with it. Adding the ! in the if statement worked, everything is working now.
Thanks for the response StrickenKid and great job on this.
Posts: 132
Threads: 11
Joined: Nov 2008
Reputation:
0
I found a SMALL error in the PAWNO include:
native mysql_connect(const host[], const user[], const pass[], const db[], MySQL:handle = (MySQL:0), auto_reconnect = 0);
Should be this, if we read the SAMP wiki:
native mysql_connect(const host[], const user[], const pass[], const db[], auto_reconnect = 0, MySQL:handle = (MySQL:0));
But, when running the server, it's the PAWNO's version that is the good one. The pluging needs to be fixed to read the params in the good order.
Posts: 482
Threads: 84
Joined: Nov 2010
Reputation:
0
this has weird bugs.. really. i was using this plugin everything working fine, then i made a group system. a loadgroups stock, it was all fine but it didn't load. then i switch to BlueG's and it just suddenly worked without any changes? (just saying) s:
Posts: 762
Threads: 157
Joined: Feb 2009
Reputation:
0
90% of problems people have when using the plugin are related to their script, not the plugin. Plus if you would have taken your time to read up a few posts and the wiki, you will find that I changed mysql_query's result to 0 on success, and non-zero (error code) on failure.
Yet, if you didn't update the plugin and it has nothing to do with bad written script, posting this has been an utter waste of both of our time considering you didn't supply any useful information that could help me fix any bugs.
Posts: 654
Threads: 20
Joined: Jul 2009
Reputation:
0
How about making a function to call a custom callback upon a query being complete, working similar to CallLocalFunction?
mysql_thread_query(const query[], const callback[], const format[], {Float,_}:...)
Example:
mysql_query_callback("UPDATE Players SET registered = 1 WHERE name = 'Jay'", OnPlayerRegister, "d", playerid);
It would probably be possible to script a function for this in PAWN with the given functions but I'm sure this would be much better coded in C++. This would make threading much easier.
Also: It would be cool if mysql_store_result could store more than one result. It could work like SA:MP's native SQLite functions: Assigning a tagged variable to a query would automatically store the given result. This would make threading MUCH easier and eliminate the use for the store/free result natives.
Posts: 762
Threads: 157
Joined: Feb 2009
Reputation:
0
Nice ideas Jay_, I will definitely look into having custom query callbacks, doing it this way will be much easier than having all threaded queries sent to one callback.
Posts: 724
Threads: 62
Joined: Dec 2008
Reputation:
0
14.12.2010, 23:49
(
Последний раз редактировалось Memoryz; 16.12.2010 в 00:45.
)
Whenever I restart my server crashes, no MySQL connections are open at the time
Anyway someone can help my debug this?
Posts: 206
Threads: 9
Joined: Aug 2007
Reputation:
0
Hey, just thought I'd update my servers MySQL so got your latest version and ran into the latest problem, used your mysql.so from the last page and it fixed it.
One question, is it likely to impact is much using this mysql.so? Will I notice any difference? Is there any point doing the command line fix?
Thanks and as always, great work!
Posts: 724
Threads: 62
Joined: Dec 2008
Reputation:
0
Whenever I GMX the server crashes, I have disconnected from the MySQL server in ongamemodeexit
Any help? :S
Posts: 7
Threads: 1
Joined: Jun 2010
Reputation:
0
Asking about speed for mysql has as much to do with the mysql server and the table layout as the mysql plugin. I notice you update off of username, do you have atleast an index, if not a primary key on your Username column? Also shouldn't you have an "If (PlayerConnected(i))" so you don't save people who are offline?
For weapon saving with a short historical data I have a table with a couple million rows, and can do changes to it in less then 20 ms most of the time, even when what I am doing could be affecting 480 rows at once, so yes it can be quite fast.
Posts: 43
Threads: 5
Joined: Aug 2009
Reputation:
0
i know but thats just a test for a local server i just want to test how fast he can save 500 Acounts... its way to long... 40seconds... hell no
Posts: 482
Threads: 84
Joined: Nov 2010
Reputation:
0
try removing sendclient message and format and use printf
scm and format will slow it down even more, printf will slow it down by about 1ms, just minus the 1ms