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

Just put _ there.

Код:
mysql_format(_,.....);
Reply

I have a 3way problem:

- If I use mysql_ping every second to check the connection, my server crashes.

Код:
[12:47:15] The server has been crashed by mysql_ping at line 15181 in rr.pwn.
[12:47:15] Stack trace of gamemodes\rr.amx (most recent call first):
[12:47:16] #0: (null) (entry point) in rr.pwn
- If I do not use mysql_ping and just refresh the mysql connection (mysql_reconnect), my server doesn't crash, but I get often this message: (Debug.txt)
Код:
[18:41:43] CMySQLHandler::Query(SELECT `job` FROM `jobs` WHERE `name` = "Noah_Vosen") - Successfully executed.

[18:41:43] >> mysql_store_result( Connection handle: 1 )

[18:41:43] CMySQLHandler::StoreResult() - Result was stored.

[18:41:43] >> mysql_num_rows( Connection handle: 1 )

[18:41:43] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:41:43] >> mysql_fetch_int( Connection handle: 1 )

[18:41:43] CMySQLHandler::FetchRow() - Return: 0

[18:41:43] >> mysql_free_result( Connection handle: 1 )

[18:41:43] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:41:43] >> mysql_reconnect( Connection handle: 1 )

[18:41:43] CMySQLHandler::Disconnect() - Connection was closed.

[18:41:43] CMySQLHandler::Connect() - Can't connect to MySQL server on '91.82.84.98' (10048) (Error ID: 2003)

[18:41:44] >> mysql_format( Connection handle: 1 )

[18:41:44] >> mysql_query( Connection handle: 1 )

[18:41:44] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[18:41:44] >> mysql_store_result( Connection handle: 1 )

[18:41:44] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[18:41:44] >> mysql_num_rows( Connection handle: 1 )

[18:41:44] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[18:41:44] >> mysql_fetch_int( Connection handle: 1 )

[18:41:44] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Connection is dead)

[18:41:44] >> mysql_free_result( Connection handle: 1 )

[18:41:44] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[18:41:44] >> mysql_reconnect( Connection handle: 1 )

[18:41:44] CMySQLHandler::Disconnect() - You cannot call this function now. (Reason: Connection is dead)

[18:41:44] CMySQLHandler::Connect() - Connection was successful.

[18:41:44] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[18:41:45] >> mysql_reconnect( Connection handle: 1 )

[18:41:45] CMySQLHandler::Disconnect() - Connection was closed.

[18:41:45] CMySQLHandler::Connect() - Connection was successful.
- If I don't use both, my mysql server goes away.

Код:
[22:45:54] CMySQLHandler::Query(SELECT `user_id` FROM `users` WHERE `name` = 'Maximilien_Maurizio') - Successfully executed.

[22:45:54] >> mysql_store_result( Connection handle: 1 )

[22:45:54] CMySQLHandler::StoreResult() - Result was stored.

[22:45:54] >> mysql_num_rows( Connection handle: 1 )

[22:45:54] CMySQLHandler::NumRows() - Returned 1 row(s)

[22:45:54] >> mysql_free_result( Connection handle: 1 )

[22:45:54] CMySQLHandler::FreeResult() - Result was successfully free'd.

[22:45:54] >> mysql_format( Connection handle: 1 )

[22:45:54] >> mysql_query( Connection handle: 1 )

[22:45:54] CMySQLHandler::Query(UPDATE `users` SET `heal` = 42.527000, `x` = 251.001358,`y` = -158.046692,`z` = 1.570322,`a` = 106.713684,`interior` = 0, `vw` = 0, time = time+39 WHERE `name` = "Maximilien_Maurizio") - Successfully executed.

[22:59:58] >> mysql_free_result( Connection handle: 1 )

[22:59:58] CMySQLHandler::FreeResult() - The result is already empty.

[22:59:58] >> mysql_query( Connection handle: 1 )

[22:59:58] CMySQLHandler::Query(SELECT * FROM `banlist` WHERE `banned` = "Vittorio_Benedetto") - An error has occured. (Error ID: 2006, MySQL server has gone away)

[22:59:58] >> mysql_store_result( Connection handle: 1 )

[22:59:58] CMySQLHandler::StoreResult() - No data to store.

[22:59:58] >> mysql_num_rows( Connection handle: 1 )

[22:59:58] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[22:59:58] >> mysql_free_result( Connection handle: 1 )

[22:59:58] CMySQLHandler::FreeResult() - The result is already empty.

[22:59:58] >> mysql_query( Connection handle: 1 )

[22:59:58] CMySQLHandler::Query(SELECT * FROM `banlist` WHERE `banned` = "Vittorio_Benedetto") - An error has occured. (Error ID: 2006, MySQL server has gone away)

[22:59:58] >> mysql_store_result( Connection handle: 1 )

[22:59:58] CMySQLHandler::StoreResult() - No data to store.

[22:59:58] >> mysql_fetch_row_format( Connection handle: 1 )

[22:59:58] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
Reply

try onqueryerror and check for connection lost>? then reconnect and redo the query
Reply

Код:
public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle)
{
	switch(errorid)
	{
		case CR_SERVER_LOST:
		{
		    print("[MYSQL-DEATH]");
		    mysql_reconnect();
		}
	}
}
I tried this, but it doesn't get called.
Reply

I don't know why your server is disconnecting but add CR_SERVER_GONE_ERROR it might help with the second one
Reply

Thanks Donya!
Now it tries to reconnect, but the problem is still alive in an other form, see:

Код:
[17:16:59] CMySQLHandler::Query(UPDATE vehicles SET gas=34.9,km=13.590893,health=1000.0,engine=0,lights=1,doors=-1,boot=-1 WHERE carid = 877) - Successfully executed.

[17:16:59] >> mysql_format( Connection handle: 1 )

[17:16:59] >> mysql_query( Connection handle: 1 )

[17:16:59] CMySQLHandler::Query(SELECT `job` FROM `jobs` WHERE `name` = "Sylar_Fukuda") - Successfully executed.

[17:16:59] >> mysql_free_result( Connection handle: 1 )

[17:16:59] CMySQLHandler::FreeResult() - Result was successfully free'd.

[17:16:59] >> mysql_store_result( Connection handle: 1 )

[17:16:59] CMySQLHandler::StoreResult() - Result was stored.

[17:16:59] >> mysql_num_rows( Connection handle: 1 )

[17:16:59] CMySQLHandler::NumRows() - Returned 0 row(s)

[17:17:01] >> mysql_query( Connection handle: 1 )

[17:17:01] CMySQLHandler::Query(UPDATE vehicles SET gas=34.9,km=13.590893,health=1000.0,engine=1,lights=1,doors=-1,boot=-1 WHERE carid = 877) - An error has occured. (Error ID: 2006, MySQL server has gone away)

[17:17:01] OnQueryError() - Called.

[17:17:01] >> mysql_reconnect( Connection handle: 1 )

[17:17:01] CMySQLHandler::Disconnect() - Connection was closed.

[17:17:02] CMySQLHandler::Connect() - Can't connect to MySQL server on '91.82.84.98' (10061) (Error ID: 2003)

[17:17:05] >> mysql_query( Connection handle: 1 )

[17:17:05] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[17:17:05] >> mysql_format( Connection handle: 1 )

[17:17:05] >> mysql_query( Connection handle: 1 )

[17:17:05] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[17:17:05] >> mysql_free_result( Connection handle: 1 )

[17:17:05] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[17:17:05] >> mysql_store_result( Connection handle: 1 )

[17:17:05] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[17:17:05] >> mysql_num_rows( Connection handle: 1 )

[17:17:05] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[17:17:05] >> mysql_fetch_int( Connection handle: 1 )

[17:17:05] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Connection is dead)

[17:17:05] >> mysql_free_result( Connection handle: 1 )

[17:17:05] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[17:17:07] >> mysql_format( Connection handle: 1 )

[17:17:07] >> mysql_query( Connection handle: 1 )

[17:17:07] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)
Reply

Quote:
Originally Posted by Sergei
Посмотреть сообщение
Just put _ there.

Код:
mysql_format(_,.....);
I don't think you can use the underscore, you would get an error about the argument not having a default value.


PS. Thanks for the update and goodbye GetEscName().
Reply

Quote:
Originally Posted by HP
Посмотреть сообщение
I don't think you can use the underscore
Yes you can.
Reply

Quote:
Originally Posted by [NoV]LaZ
Посмотреть сообщение
Yes you can.
Instead of making an argument, you could simply point out how. You will get an error about the argument not having a default value, unless you add extra code or make any other modifications in the script.
Reply

which R6-2 plugin do we use on CentOS... there's only unbuto or w/e and x86
Reply

Hey help me plz! I am trying to start my server with the plugin but see this:

I have the DLL in the folder plugins/mysql.dll
I have it in server.cfg: plugins mysql
I have libmysql.dll in the executable folder
I have the GM in config.cfg and in the folder gamemodes

and this messages appears:

"File or function is not found"

"loading plugin mysql
Failed
Loaded 0 plugins"


whats up ? =s

OS Windows Server 2003

Thanks!!
Reply

Quote:
Originally Posted by Donya
Посмотреть сообщение
which R6-2 plugin do we use on CentOS... there's only unbuto or w/e and x86
The x86 plugin should run on all distros, but surprisingly it didn't work too well for me. So I compiled the plugin for CentOS and already PMed the topic author with it, but I don't know if I'm allowed to post it here.
Reply

Quote:
Originally Posted by AndreT
Посмотреть сообщение
The x86 plugin should run on all distros, but surprisingly it didn't work too well for me. So I compiled the plugin for CentOS and already PMed the topic author with it, but I don't know if I'm allowed to post it here.
Okay thanks, but i'll wait for the CentOS compiled version s:
Reply

Quote:
Originally Posted by HP
Посмотреть сообщение
Instead of making an argument, you could simply point out how. You will get an error about the argument not having a default value, unless you add extra code or make any other modifications in the script.
pawn Код:
mysql_format(_, query, "SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%e';", playername, password);
Reply

I get Failed (with RC 6) (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)

My OS is: Debian 5.0 Lenny 64 bit

Please fix the error.
Reply

Quote:
Originally Posted by The_Godboy
Посмотреть сообщение
I get Failed (with RC 6) (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)

My OS is: Debian 5.0 Lenny 64 bit

Please fix the error.
RC6 has 2 compiled versions which would run on Debian 5.0, try switching between them. Which plugin are you using right now?
Reply

I try all the Debian 5 versions.. nothing of that is going to load.

The RC 5 of the MySQL Plugin loading perfect, but not RC 6.
Reply

If this normal, example:

I registered in server with nick Raimis_R

Then i connecting in server with nick Raimis_r - This user name will by alternative to Raimis_R.
Reply

Quote:
Originally Posted by GhoulSlayeR
Посмотреть сообщение
Is it just me or are negatives not handled correctly using mysql_format and %d/%i?

pawn Код:
new string[32], posi = 1, negi = -1;
mysql_format(MainPipeline, string, "Positive: %d, Negative: %d", posi, negi);
print(string);
Console prints out:
Код:
Positive: 1, Negative:
Notice the blank in Negative when it should be -1.

Might be just me, but anyone else getting this? I'm on Windows 7 x64.
I can confirm this.
Reply

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

How to fix? : ))
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)