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

Quote:
Originally Posted by MySQL R28 changelog
[...]
- edited threading design: plugin uses one thread fewer; connections to the MySQL server are now established/closed in real-time
- added optional parameter "autoreconnect" to mysql_connect to control whether the plugin should reconnect automatically if connection is lost
[...]
Added that yesterday. The only mysql functions executed in a separate thread are mysql_connect and mysql_close, which are also called only if autoreconnect = true.
Oh, and
Quote:
Originally Posted by MySQL R28 changelog
- re-added our old and beloved native mysql_errno
inb4 why didn't you did this earlier
inb4 you said it isn't possible
Sorry :/
Reply

Oh, I'm never up-to-date with such things. But good stuff!
Reply

pawn Code:
#include <a_samp>
#define MYSQL_USE_YINLINE
#include <a_mysql>
#include <fixes>
#include <sscanf2>
#include <streamer>
#define  MAILER_URL "localhost/mailer.php"
#include <mailer>
#include <GVAR>
#include <YSI\y_commands>
#include <YSI\y_td>
#include <YSI\y_dialog>
#include <YSI\y_inline>
#include <YSI\y_hooks>
#include <YSI\y_timers>
#include <YSI\y_iterate>
Code:
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(189) : warning 201: redefinition of constant/macro (symbol "e_CALLBACK_FLAGS")
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(192) : error 021: symbol already defined: "e_CALLBACK_FLAGS_PUSHED"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(196) : error 021: symbol already defined: "e_CALLBACK_FLAGS_PUBLIC"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(199) : warning 201: redefinition of constant/macro (symbol "E_CALLBACK_DATA")
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(200) : error 021: symbol already defined: "E_CALLBACK_DATA_FLAGS"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(348) : error 021: symbol already defined: "_Inline_FixCompiler@@"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(360) : error 021: symbol already defined: "_Inline_GetOpCodesX"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(607) : error 021: symbol already defined: "Inline_Loop"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(677) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(678) : error 021: symbol already defined: "Callback_Get"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(913) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(914) : error 021: symbol already defined: "Callback_Release"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(922) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(923) : error 021: symbol already defined: "Callback_Call"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1132) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1133) : error 021: symbol already defined: "Callback_Array"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1322) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1323) : error 021: symbol already defined: "Callback_Block"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(93) : error 009: invalid array size (negative, zero or out of bounds)
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(220) : error 009: invalid array size (negative, zero or out of bounds)
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(220) : warning 217: loose indentation
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(220) : error 036: empty statement
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(221) : warning 217: loose indentation
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(221) : error 017: undefined symbol "data"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(223) : error 017: undefined symbol "data"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(288) : error 046: unknown array size (variable "YSI_g_sDialogInfo")
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(288) : warning 215: expression has no effect
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(315) : error 047: array sizes do not match, or destination array is too small
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(324) : error 009: invalid array size (negative, zero or out of bounds)
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(324) : warning 217: loose indentation
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(324) : error 036: empty statement
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(325) : warning 217: loose indentation
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_dialog.inc(325) : error 017: undefined symbol "dat"
Reply

Remove "#include <YSI\y_inline>" from your code.
Reply

Quote:
Originally Posted by Pain123
View Post
Remove "#include <YSI\y_inline>" from your code.
pawn Code:
//==============[INCLUDE]=============//
#include <a_samp>
#include <fixes>
#include <sscanf2>
#include <streamer>
#define  MAILER_URL "localhost/mailer.php"
#include <mailer>
#include <GVAR>
#include <YSI\y_commands>
#include <YSI\y_td>
#include <YSI\y_dialog>
//#include <YSI\y_inline>
#include <YSI\y_hooks>
#include <YSI\y_timers>
#include <YSI\y_iterate>
#define MYSQL_USE_YINLINE
#include <a_mysql>
Code:
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(189) : warning 201: redefinition of constant/macro (symbol "e_CALLBACK_FLAGS")
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(192) : error 021: symbol already defined: "e_CALLBACK_FLAGS_PUSHED"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(196) : error 021: symbol already defined: "e_CALLBACK_FLAGS_PUBLIC"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(199) : warning 201: redefinition of constant/macro (symbol "E_CALLBACK_DATA")
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(200) : error 021: symbol already defined: "E_CALLBACK_DATA_FLAGS"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(348) : error 021: symbol already defined: "_Inline_FixCompiler@@"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(360) : error 021: symbol already defined: "_Inline_GetOpCodesX"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(607) : error 021: symbol already defined: "Inline_Loop"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(677) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(678) : error 021: symbol already defined: "Callback_Get"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(913) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(914) : error 021: symbol already defined: "Callback_Release"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(922) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(923) : error 021: symbol already defined: "Callback_Call"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1132) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1133) : error 021: symbol already defined: "Callback_Array"
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1322) : error 025: function heading differs from prototype
I:\SA-MP\SERVER MYSQL\pawno\include\YSI\y_inline.inc(1323) : error 021: symbol already defined: "Callback_Block"
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(105) : error 009: invalid array size (negative, zero or out of bounds)
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(109) : error 009: invalid array size (negative, zero or out of bounds)
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(109) : error 036: empty statement
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(110) : error 017: undefined symbol "InlineData"
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(113) : error 046: unknown array size (variable "g_MySQL_InlineData")
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(113) : error 017: undefined symbol "InlineData"
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(113) : warning 215: expression has no effect
I:\SA-MP\SERVER MYSQL\pawno\include\a_mysql.inc(130) : error 047: array sizes do not match, or destination array is too small
Reply

I've been using R7 since it was released and haven't upgraded, because things seem to be going backwards. Why was mysql_ping removed? How can you check if the connection is a success..? Why remove stuff that isn't broken? For fuck's sake. At least make mysql_connect return -1 if the connection failed..
Reply

Quote:
Originally Posted by MP2
View Post
I've been using R7 since it was released and haven't upgraded, because things seem to be going backwards. Why was mysql_ping removed? How can you check if the connection is a success..? Why remove stuff that isn't broken? For fuck's sake.
Using R5 since it's release, far more convenient than other versions.
Reply

Quote:
Originally Posted by Ronaldo_raul™
View Post
Using R5 since it's release, far more convenient than other versions.
You should be running at least R7. Using non-threaded queries these days is a waste.
Reply

Thanks For R29 ! Good Revision !

I have discovered a bug , and my server doesn't working with R29.

In my Database I have 'id' and I load 'id' column as :

cache_get_field_content_int( 0, "Id" );

not

cache_get_field_content_int( 0, "id" );

And it causes crash .

Now I am asking why with R27 =< versions can load cache_get_field_content_int( 0, "Id" ); not
cache_get_field_content_int( 0, "id" ); . Can you explain this ?

But i solved that problem .
Reply

Really good releases, thanks for your work. :P
Reply

Quote:
Originally Posted by MP2
Посмотреть сообщение
Why was it removed in the first place?
Because of the multi-threading. At first the mysql_errno call in the plugin was not protected with a mutex (which is the main reason for not having a mysql_errno native). Then I saw in R26 that it caused problems with the OnQueryError callback and protected the call. And finally while developing R28 I realized that some things were quite unnecessary, changed some code and reimplemented mysql_errno.


Quote:
Originally Posted by Kar
Посмотреть сообщение
My server locked up here (Windows)

pawn Код:
[02:22:39] [DEBUG] Calling callback "Thread_OnPlayerDrugPlantsLoad"..
[02:22:39] [DEBUG] cache_get_data - connection handle: 1
[02:22:39] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[02:23:03] [DEBUG] mysql_tquery - connection handle: 1
[02:23:03] [DEBUG] mysql_tquery - scheduling query "UPDATE `Houses` SET `LastVisitDate` = UNIX_TIMESTAMP() WHERE `Houseid` = 5 LIMIT 1"..
[02:23:03] [DEBUG] ExecuteT[()] - starting query execution
[02:23:04] [DEBUG] ExecuteT[()] - query was successful
[02:23:04] [DEBUG] ExecuteT[()] - no callback specified, skipping result saving
I've been getting issues since r28 with NPCS (debug is on)

pawn Код:
[16/07/2013 02:29:48] NPC Connect: Bad player ID (127.0.0.1)
[16/07/2013 02:29:48] NPC Connect: Bad player ID (127.0.0.1)
[16/07/2013 02:29:48] NPC Connect: Bad player ID (127.0.0.1)
I'll take a look at it.


Quote:
Originally Posted by MP2
Посмотреть сообщение
Could you add 'fake natives' for mysql_function_query etc. (function macros) so they show up in pawno? Thanks. (define them as a native function inside a comment block (not sure if single lines work))
Sure, no problem.

Quote:
Originally Posted by []Allex[]
Посмотреть сообщение
I have discovered a bug , and my server doesn't working with R29.

In my Database I have 'id' and I load 'id' column as :

cache_get_field_content_int( 0, "Id" );

not

cache_get_field_content_int( 0, "id" );

And it causes crash .

Now I am asking why with R27 =< versions can load cache_get_field_content_int( 0, "Id" ); not
cache_get_field_content_int( 0, "id" ); . Can you explain this ?

But i solved that problem .
You should treat MySQL as case sensitive (well it actually ignores case sensitivity on Windows, but does not on Linux).


EDIT:
Quote:
Originally Posted by GiamPy.
Посмотреть сообщение
New crash when using "exit" on server disconnection.
Thanks for reporting, this crash is now fixed in R30.

Quote:
Originally Posted by Drake1994
Посмотреть сообщение
I think found the crash reason. I set the player name when it's logged like this:
[...]
E1.: I don't know why, but if i create a local variable, and fill it with cache_get_field_content, it work fine, but if i use an array, like: PlayerInfo[playerid][pNev] to store, it does not fill up.
This is a well known "bug" with enum-arrays (like your PlayerInfo array) which exists since R8. Just specify the max_len in the native (it's an optional parameter) or use the method you already said (storing it into a temporary variable and then copy the content of the temporary variable into the enum-array).
Reply

Today I get this crash:

Line:
Код:
	SetPVarInt(playerid, "fPlayerID", cache_get_row_int(0, 0));
Код:
[2013/07/16 16:34:35] [debug] Server crashed while executing nmss.amx
[2013/07/16 16:34:35] [debug] AMX backtrace:
[2013/07/16 16:34:35] [debug] #0 0009ce58 in public THREAD_Findplayer_1 (playerid=11, queue=17) at C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SERVER\gamemodes\nmss.pwn:14695
[2013/07/16 16:34:35] [debug] System backtrace:
[2013/07/16 16:34:35] [debug] #0 f7416f41 in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #1 f740d41f in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #2 f740b963 in _ZN11crashdetect15SystemExceptionEPv () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #3 f74163c1 in ?? () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #4 f7737410 in __kernel_rt_sigreturn () from linux-gate.so.1
[2013/07/16 16:34:35] [debug] #5 f74af506 in ?? () from /lib/libc.so.6
[2013/07/16 16:34:35] [debug] #6 f7182501 in _ZN5boost12lexical_castIiPcEET_RKT0_ () from plugins/mysql_static.so
[2013/07/16 16:34:35] [debug] #7 f717e161 in _ZN6Native17cache_get_row_intEP6tagAMXPi () from plugins/mysql_static.so
[2013/07/16 16:34:35] [debug] #8 f741ba33 in amx_Exec () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #9 f740c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #10 f7414699 in ?? () from plugins/crashdetect.so
[2013/07/16 16:34:35] [debug] #11 f71841d1 in amx_Exec () from plugins/mysql_static.so
[2013/07/16 16:34:35] [debug] #12 f7166db7 in _ZN9CCallback16ProcessCallbacksEv () from plugins/mysql_static.so
[2013/07/16 16:34:35] [debug] #13 f718a497 in ProcessTick () from plugins/mysql_static.so
[2013/07/16 16:34:35] [debug] #14 080c5df2 in ?? () from ./samp03svr
[2013/07/16 16:34:35] [debug] #15 080b5b7a in ?? () from ./samp03svr
[2013/07/16 16:34:35] [debug] #16 080b1453 in ?? () from ./samp03svr
[2013/07/16 16:34:35] [debug] #17 f74473d5 in __libc_start_main () from /lib/libc.so.6
Reply

Are you using R29?

EDIT:
@Kar, are you sure the MySQL plugin causes this?
Reply

Quote:
Originally Posted by Pain123
Посмотреть сообщение
Are you using R29?

EDIT:
@Kar, are you sure the MySQL plugin causes this?
Yes.
Reply

Okay, your crashdetect report says that the datatype conversion is the problem. I changed the datatype conversion again, so that shouldn't happen anymore. I'll release R30 with that bugfix when I've dealt with Kar's problem.
Reply

Okey thanks.

Anyway if I log into mysql the chat and commands then this shouldn't cause any laggs, shouldn't? (ex. 2chat msg, 2cmdtext per 1sec)
Because the plugin uses multithread.

And example, if I want to send 1000queries then I should use sleep() before them or can I send it at the same time?


EDIT: About Kar's locked up problem, I get very often lag on my server and it's now unplayable. So If this caused by plugin, then I can confirn it. With the r28 no lagg, but when I updated to r29 i get lagg very often. I think this is host problem, but if Kar says this caused by the plugin then not.
Reply

It shouldn't cause any lags.
You can send 1000 queries at the same time, but prepare for small lags (like 1sec or so).

EDIT:
Kar said he has a complete lockdown, you just seem to have some lags. These laggs should be also fixed in R30.

EDIT2:
R30 is released.
Changes:
- changed datatype conversion again (method in R29 was slow and still bugging)
- fixed some log messages
- fixed crash when unloading the plugin
- code improvements
Reply

Since mysql_ping is no longer a function, what is the best way to determine if the connection to the MySQL server was successful?


I've been attempting to deploy my server onto a Linux machine but anytime I start the server, I get these errors:

Код:
[13:02:05] [ERROR] ExecuteT[OnLoadDynamicDoors()] - (error #2006) MySQL server has gone away
[13:02:05] [ERROR] CMySQLHandle::ConnectT - (error #1045) Access denied for user 'samp'@'localhost' (using password: YES)
Login is correct. I've checked the user and database permissions. Nothing seems to be incorrect there.
Reply

thanks but what are the best kind of queries? threaded or unthreaded cuz i don't know nothing about mysql.
Reply

Quote:
Originally Posted by caoraivoso3
Посмотреть сообщение
thanks but what are the best kind of queries? threaded or unthreaded cuz i don't know nothing about mysql.
Threaded, the ones which this plugin offers.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)