[Plugin] [REL] SA:MP MySQL Plugin 2.1.1 - Released (1/25/2011

Quote:

Loading plugin: mysql.so
[16:21:13] Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)

Just happens to your newest version (upgraded from 1.3 i think).
Please, i please you to fix this.
The only working alternative is gstylez plugin, and thats so dawn ugly to use...

//Ђ: http://www.strickenkid.info/mysql_pl...nux_2.0.tar.gz
Reply

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.
Reply

Ok, I've compiled the plugin with a static library, so it should be able to run without linking to the libraries. Let me know if it works!

http://www.strickenkid.info/mysql_pl...X/2.1/mysql.so
Reply

Yep. Seems to work. Thanks StrickenKid.
Reply

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.
Reply

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.
Reply

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.
Reply

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.
Reply

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:
Reply

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.
Reply

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.
Reply

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.
Reply

Whenever I restart my server crashes, no MySQL connections are open at the time

Anyway someone can help my debug this?
Reply

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

Whenever I GMX the server crashes, I have disconnected from the MySQL server in ongamemodeexit

Any help? :S
Reply

is that SQL plugin faster the the SQLite build in plugin in samp?

cuz i need 37-40sek to save 500 Accounts at the same time.... 1 Accounts takes up to 200ms... its way to long... i need a better sql plugin...

thats the code i use

Код:
#define p PlayerInfo[playerid]
public OnPlayerSave(playerid)
{
	new start = GetTickCount();
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	format(sql, sizeof(sql), "UPDATE Accounts SET\
	'Password'='%s',\
	'Admin'='%i',\
	'Job'='%i',\
	'SafeMaterials'='%i',\
	'Respect'='%i',\
	'Level'='%i'\
	WHERE Username = '%s'", p[pPassword], p[pAdmin], p[pJob], p[pSafeMaterials], p[pRespect], p[pLevel], GetPlayerNameEx(playerid));
	
	db_free_result(db_query(Database, sql));
	}
	format(str, sizeof(str), "[Debug] Zeit: %i", GetTickCount()-start);
	SendClientMessage(playerid, COLOR_LIGHT_BLUE, str);
	start = GetTickCount();
	format(sql, sizeof(sql), "UPDATE Accounts SET\
	'Password'='%s',\
	'Admin'='%i',\
	'Job'='%i',\
	'SafeMaterials'='%i',\
	'Respect'='%i',\
	'Level'='%i'\
	WHERE Username = '%s'", p[pPassword], p[pAdmin], p[pJob], p[pSafeMaterials], p[pRespect], p[pLevel], GetPlayerNameEx(playerid));
	
	db_free_result(db_query(Database, sql));
	format(str, sizeof(str), "[Debug] Zeit: %i", GetTickCount()-start);
	SendClientMessage(playerid, COLOR_LIGHT_BLUE, str);
	return 1;
}
so will that be faster with this sql plugin here?
Reply

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.
Reply

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
Reply

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
Reply

I'm having a bit of a problem.
The plugin was working, but it suddenly stopped working for no apparent reason.

mysql_log.txt:
Код:
[Sat Dec 18 19:08:40 2010]      Logging Started
[Sat Dec 18 19:08:40 2010] -------------------------
[Sat Dec 18 19:08:40 2010] Function: mysql_init executed with result: "0".
[Sat Dec 18 19:08:40 2010] Error (1): Function: mysql_connect failed, mysql was not initialized on this handle.
Part of OnGameModeInit() in my gamemode that handles the MySQL initalization:
Код:
    mysql_init(1);
    SetGameModeText("XXXXXXXXXX");
    // mysql
    if(mysql_connect("127.0.0.1", "root", "", "samp", 1))
    {
        dbConnSuccess = 1;
    }
    else
    {
        dbConnSuccess = 0;
    }
(blah blah, I didn't blank out the db details, whatever. It's just my local development server.)

I've also bolded the line where for whatever reason, the PAWN compiler gives me a "tag mismatch" warning.
Didn't know if this should've been posted here or in the scripting section, so I posted it here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)