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

Quote:
Originally Posted by Danny
Посмотреть сообщение
I'm sorry for 'bumping' my question, but can anybody help me out with this? I'm kinda on a schedule.

In the meantime I've been able again to reproduce the hang-issues. With some optimisations (replacing cache_get_row by cache_get_row_int/float in some places) I succeeded in reducing the hang time from > 100 to 81 seconds. But the issue hasn't been solved yet: I never had issues like this with the old plugin.
How much RAM does your PC have and can you generally monitor RAM usage when this hang occurs? My first guess would be, that you don't have much RAM, the MySQL plugin runs out of RAM and Windows does some pagefile swapping (which results in horrible performance).
Reply

Quote:
Originally Posted by iZN
Посмотреть сообщение
wat?



Don't you see your mistake there?
Where is the mistake there ??
Reply

It's working! Thank you very much. +REP
Reply

Hi all,

I use the version R7, and I've a problem to start my gamemode on Dйbian 7 32bit.

I installed:

Quote:

apt-get update
apt-get upgrade
apt-get install apache2
apt-get install php5 php5-mysql
apt-get install mysql-server
apt-get install phpmyadmin
apt-get install libmysqlclient-dev

I placed libmysqlclient_r.so.16 on the racine of my gamemode, and in /usr/lib.

I get that:
Quote:

[13:09:11] Loading plugin: mysql.so
[13:09:11] Failed (libmysqlclient_r.so.16: wrong ELF class: ELFCLASS64)

Do you have a idea, please ?
Thanks a lot!

Nlx
Reply

First post of this thread needs to be updated as I can see many users gets confuse with the part that the latest release are on Github page and that's R39-2 at the moment.

@Noliax8: Use mysql_static.so which is available in further releases or download R39-2 but you should know what you're doing because after R21, queries are now cache-only.

@[Mr]Wallace: You've missed the part where I bold the text. You're using outdated plugin (R7) and your script is compiled with (R39-2). Download R39-2 package and place the plugin .dll or .so of R39-2 NOT R7. Now you should know what mistake you've made.
Reply

Quote:
Originally Posted by iZN
Посмотреть сообщение
@Noliax8: Use mysql_static.so which is available in further releases or download R39-2 but you should know what you're doing because after R21, queries are now cache-only.
I use already the cache with the version R7. I'll trying with the version R39-2.

EDIT:
Quote:

[13:36:00] Loading plugin: mysql.so
[13:36:00] Failed (libmysqlclient_r.so.16: wrong ELF class: ELFCLASS64)
[13:36:00] Loading plugin: mysql_5.5.so
[13:36:00] >> plugin.mysql: R39-2 successfully loaded.
[13:36:00] Loaded.
[13:36:00] Loading plugin: mysql_static.so
[13:36:00] >> plugin.mysql: R39-2 successfully loaded.
[13:36:00] Loaded.

EDIT 2:
Quote:

[13:50:37] Loading plugin: mysql_static.so
[13:50:37] >> plugin.mysql: R39-2 successfully loaded.

Perfect! Thanks a lot

EDIT 3:

But.... But don't work on my Windows computer...



Do you have a idea?
Thanks
Reply

Quote:
Originally Posted by Danny
Посмотреть сообщение
Thank you for your quick reply. I have 4 GB RAM in total. I use about 50% of it without my SA-MP server running.
When I fire it up it only increases by 2%. But my CPU skyrockets from ~20% to values between 70-80%.
After some time it drops again, presumably when the loading job is finished. Moreover, I asked one of my fellow developers to launch the server on his (state-of-the-art) PC and check the log timestamps. His server process took only 2 seconds to load. He has an 8-core CPU and I have an AMD Athlon X2 Dual-Core QL-65 2,1 GHz processor.

So apparently I'm a part of the problem here since I have a terrible computer. Is there anything you could do to lower the CPU usage in the next version and is there anything I could do to prevent this behaviour?
You said you are using pqueries, weren't you? Try using tqueries instead, this should lower the performance (and thus CPU usage). Also disable parallel queries (by setting the pool_size parameter in mysql_connect to '0'). If this still doesn't help, I'll try to compile a special version for you (with some performance adjustments of course).

Quote:
Originally Posted by Noliax8
Посмотреть сообщение
Hi all,

I use the version R7, and I've a problem to start my gamemode on Dйbian 7 32bit.

I installed:



I placed libmysqlclient_r.so.16 on the racine of my gamemode, and in /usr/lib.

I get that:


Do you have a idea, please ?
Thanks a lot!

Nlx
I don't think you are using Debian 7 32bit. How else could you install a 64bit libmysqlclient library? (yes, that ELFCLASS64 error indicates a conflict with 32bit and 64bit programs/libraries)
You'll need a 32bit library or the static version (like iZN said) to run your server with the MySQL plugin.

EDIT: Seems like the 5.5 version works. Use that version (mysql_5.5.so) instead of the static version (mysql_static.so).
Your Windows error indicates, that you don't have the correct redistributables installed. Take a look at the FAQ, there is a list of all required redistributables.

Quote:
Originally Posted by iZN
Посмотреть сообщение
First post of this thread needs to be updated as I can see many users gets confuse with the part that the latest release are on Github page and that's R39-2 at the moment.
[...]
There are big fat links on the first post, linking to the Github page. Also, I don't think many users really confuse this.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Your Windows error indicates, that you don't have the correct redistributables installed. Take a look at the FAQ, there is a list of all required redistributables.
I've trying and it's not different...

Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
There are big fat links on the first post, linking to the Github page. Also, I don't think many users really confuse this.
I know about 10+ guys who were thinking R7 is the last release and I told them to check Github page. It also could be the reason of the tutorial made by AndreT as the thread is not yet updated.
Reply

Quote:
Originally Posted by Noliax8
Посмотреть сообщение
I've trying and it's not different...

Remove all .dll's you've placed in your SA-MP server folder (except the libmysql.dll of course).
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Remove all .dll's you've placed in your SA-MP server folder (except the libmysql.dll of course).
You're the best, thanks a lot!
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
You said you are using pqueries, weren't you? Try using tqueries instead, this should lower the performance (and thus CPU usage). Also disable parallel queries (by setting the pool_size parameter in mysql_connect to '0'). If this still doesn't help, I'll try to compile a special version for you (with some performance adjustments of course).
Sorry for my late reply. Yes, I'm using pqueries. I tried using tqueries and I set the pool_size to 0, but this didn't solve it. I would really appreciate a low CPU version if there's no other fix.
Reply

Hello everyone I have a problem with loading mysql plugin R39-2 so I downloaded that plugin and of course I put in wrigth places libmysql in main root server folder where is samp server exe mysql plugin in plugins folder and of course a_mysql.inc in /pawno/include folder then I compile the gamemode and it all fine no errors also I downloaded correct visual c++ redistributables 2010 2010 SP1 and 2012 x86 like it said in this link https://github.com/pBlueG/SA-MP-MySQL#faq. Also I use windows not linux and in my sever.cfg goes plugins mysql

and when I start server I get this errors:



pawn Код:
[12:55:24]    Error: Function not registered: 'mysql_log'
[12:55:24]    Error: Function not registered: 'mysql_connect'
[12:55:24]    Error: Function not registered: 'mysql_stat'
[12:55:24]    Error: Function not registered: 'mysql_errno'
[12:55:24]    Error: Function not registered: 'mysql_format'
[12:55:24]    Error: Function not registered: 'mysql_tquery'
[12:55:24]    Error: Function not registered: 'mysql_close'
[12:55:24]    Error: Function not registered: 'cache_insert_id'
[12:55:24]    Error: Function not registered: 'cache_get_data'
[12:55:24]    Error: Function not registered: 'cache_get_row'
[12:55:24]    Error: Function not registered: 'cache_get_row_int'
[12:55:24]    Error: Function not registered: 'cache_get_field_content_int'
[12:55:24]    Error: Function not registered: 'cache_get_field_content'
[12:55:24]    Error: Function not registered: 'cache_get_field_content_float'
[12:55:24] [debug] Run time error 19: "File or function is not found"
Reply

seem to be having a problem with my dialog login not loading up from upgrading from R38 to R39 when I downgrade back to R38 I have no problems.
Reply

I am trying to perform an SQL injection using this plugin on my own server (solely for pentest purposes) and I have a question. I have a command whose input is deliberately unescaped and I am trying to delete a table abusing this mistake. The code is:

Код:
CMD:testtest( playerid, params[] )
{
	TestT( "asd", params );
	return 1;
}

TestT(nme[], tst[])
{
	format(query, sizeof(query), "INSERT INTO `test` (`asdfg`, `fghij`) VALUES ('%s', '%s')", nme, tst);
	mysql_query(query);
	return 1;
}
Using deliberately malicious input such as:

Код:
/testtest fgh'); DROP TABLE `example`;--
yields the following error:

Код:
[23:44:38] CMySQLHandler::Query(INSERT INTO `test` (`asdfg`, `fghij`) VALUES ('asd', 'fgh'); DROP TABLE `example`;-- ')) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DROP TABLE malibusux;-- ')' at line 1)
The following code runs perfectly fine on phpMyAdmin. Is there a reason why these attacks do not work, or am I doing something wrong?
Reply

Quote:
Originally Posted by Reynolds
Посмотреть сообщение
I am trying to perform an SQL injection using this plugin on my own server (solely for pentest purposes) and I have a question. I have a command whose input is deliberately unescaped and I am trying to delete a table abusing this mistake. The code is:

Код:
CMD:testtest( playerid, params[] )
{
	TestT( "asd", params );
	return 1;
}

TestT(nme[], tst[])
{
	format(query, sizeof(query), "INSERT INTO `test` (`asdfg`, `fghij`) VALUES ('%s', '%s')", nme, tst);
	mysql_query(query);
	return 1;
}
Using deliberately malicious input such as:

Код:
/testtest fgh'); DROP TABLE `example`;--
yields the following error:

Код:
[23:44:38] CMySQLHandler::Query(INSERT INTO `test` (`asdfg`, `fghij`) VALUES ('asd', 'fgh'); DROP TABLE `example`;-- ')) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DROP TABLE malibusux;-- ')' at line 1)
The following code runs perfectly fine on phpMyAdmin. Is there a reason why these attacks do not work, or am I doing something wrong?
You did nothing wrong. I intentionally disallowed the execution of multiple SQL statements in one query.
However, that doesn't mean, that you are now completely safe against SQL injections. There are still ways to cause damage without using multiple SQL statements.
Reply

I totally understand that merely disabling multiple queries won't make my system secure, I just wasn't sure why there was an error given for a seemingly valid query.
Reply

the setkey function sets the variable from orm to the table?
like i use the cache insert id to get the autoincriment id then i use the setkey to set the key to the table and use it on the next query to save other variables. it is right?

edit:
I think i fix the last problem I just save the thing iwth the function but i still have a problem

I get this error
[ERROR] CMySQLQuery::Execute[OnAccountCreate] - (error #1062) Duplicate entry '33' for key 'PRIMARY'.
I dont know why this is giving me errors in this function i have

g_PlayerInfo[playerid][pSQLid] = cache_insert_id();
and this is called in this other function
orm_insert(g_PlayerInfo[playerid][ORM_ID], "OnAccountCreate", "d", playerid);.
any idea?
Reply

I think you have forgotten to use orm_setkey before.
Reply

I want to update to R39-2 But I got a lot of errors, can someone tell me what should I replace these with?

Quote:

(900) : error 017: undefined symbol "mysql_store_result"
(901) : error 017: undefined symbol "mysql_num_rows"
(361 : error 017: undefined symbol "mysql_store_result"
(3619) : error 017: undefined symbol "mysql_num_rows"
(3621) : error 017: undefined symbol "mysql_fetch_row"
(3627) : error 017: undefined symbol "mysql_free_result"
(6895) : error 017: undefined symbol "mysql_store_result"
(6896) : error 017: undefined symbol "mysql_num_rows"
(689 : error 017: undefined symbol "mysql_fetch_row"
(6904) : error 017: undefined symbol "mysql_free_result"
(11143) : error 017: undefined symbol "mysql_store_result"
(11144) : error 017: undefined symbol "mysql_num_rows"
(11146) : error 017: undefined symbol "mysql_fetch_row"
(1114 : error 017: undefined symbol "mysql_get_field"
(11154) : error 017: undefined symbol "mysql_free_result"
(11167) : error 017: undefined symbol "mysql_store_result"
(1116 : error 017: undefined symbol "mysql_fetch_row"
(11170) : error 017: undefined symbol "mysql_get_field"
(11171) : error 017: undefined symbol "mysql_get_field"
(1118 : error 017: undefined symbol "mysql_store_result"
(11189) : error 017: undefined symbol "mysql_fetch_row"
(11191) : error 017: undefined symbol "mysql_get_field"
(11192) : error 017: undefined symbol "mysql_get_field"
(11232) : error 017: undefined symbol "mysql_store_result"
(11233) : error 017: undefined symbol "mysql_num_rows"
(11235) : error 017: undefined symbol "mysql_fetch_row"

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)