SA-MP Forums Archive
[Plugin] [REL] MySQL Plugin (Now on github!) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MySQL Plugin (Now on github!) (/showthread.php?tid=56564)



Re: [REL] MySQL Plugin (Now on github!) - Jeroen52 - 28.08.2016

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
If you're talking about a compile-time check: CMake already takes care of this. It simply won't generate any makefiles if the compiler doesn't support all required C++11 features.
If you're talking about a run-time check: that's not possible. If you load a plugin linked to a libstdcpp which has a higher version than the one provided on your system, you'll get a "version GLIBCXX_3.4.15 not found" error or similar.
I meant with the makefile.


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 28.08.2016

Yes, CMake takes care of this. The "old GCC version"-problem is also really only a problem on CentOS 6, since it deliberately uses older packages to ensure stability (GCC 4.4.7 is over 4 years old btw). Every other "newer" (> 2013) Linux distribution already has 4.8, including CentOS 7.


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 05.09.2016

R40 has been (finally) released.
This release has code-breaking changes! Refer to the bottom of this post for a tutorial on how to update your scripts.
Changelog: For a tutorial on how to convert your scripts to R40, see here.
I've also created a new wiki page for R40, available here.

Downloads, as usual, here.

Thanks to everyone who helped me in any way during the development of R40!


Re: [REL] MySQL Plugin (Now on github!) - Doritoss - 05.09.2016

With R40, how do you do loops now? Before I could do i.e:

Код:
for(new i = 0; i != cache_get_row_count(); i++)
{
  // load fields.
}
Anyone have an example?


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 05.09.2016

Код:
new rows;
cache_get_row_count(rows);
for(new i = 0; i != rows; i++)
{
  // load fields.
}
or
Код:
for(new i = 0; i != cache_num_rows(); i++)
{
  // load fields.
}



Re: [REL] MySQL Plugin (Now on github!) - jlalt - 05.09.2016

Edit:
NVM LOL
didn't know its R40 : p, well done sir D: I like your works xd.


Re: [REL] MySQL Plugin (Now on github!) - Doritoss - 05.09.2016

I recently upgraded to R40, and now converted everything but the only issue I have right now is this:

Код:
[03:43:28] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
Here is my crash detect version: CrashDetect v4.15.1 is OK.
Any clues?


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 06.09.2016

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
There is 2 log.core when download plugin and in log.core where is https://sampforum.blast.hk/showthread.php?tid=603175 which download?
Use the newest one. If you're not sure which is the newest, you can download the latest log-core here (download the runtime package): https://github.com/maddinat0r/samp-log-core/releases


Re: [REL] MySQL Plugin (Now on github!) - MerryDeer - 06.09.2016

My server also crash during mysql_tquery how that your function can be crash reason?


Re: [REL] MySQL Plugin (Now on github!) - Luis- - 06.09.2016

Great to see this is still being developed. Thankfully the script i'm working on isn't big, so it wont take me long to convert.


Re: [REL] MySQL Plugin (Now on github!) - CodeStyle175 - 06.09.2016

How to change it, that it will just return int and float.


Re: [REL] MySQL Plugin (Now on github!) - vannesenn - 06.09.2016

I don't understand what is log core. What it does?


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 07.09.2016

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
My server also crash during mysql_tquery how that your function can be crash reason?
I need the mysql.log with debug logs to help you further.

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
How to change it, that it will just return int and float.
Write your own wrapper functions.

Quote:
Originally Posted by vannesenn
Посмотреть сообщение
I don't understand what is log core. What it does?
https://github.com/maddinat0r/samp-l...what-is-this--


Re: [REL] MySQL Plugin (Now on github!) - Thomas. - 07.09.2016

I've written a few quick and dirty regular expressions I used to convert my own scripts. You can use these in practically any editor which supports regular expression replacements (I used Notepad++).

Search for:
Код:
([^ \t]+)[ \t]*=[ \t]*cache_get_row_(int|float)\(([^,]+), ([^,]+)(, [^ \)]+)?\)
Replace with:
Код:
cache_get_value_index_$2\($3, $4, $1\)
---------------------------

Search for:
Код:
cache_get_row\(([^,]+), ([^,]+), ([^,]+), (?:[^,]+)(, [^,]+)?\)
Replace with:
Код:
cache_get_value_index\($1, $2, $3$4\)
---------------------------

Search for:
Код:
([^ \t]+)[ \t]*=[ \t]*cache_get_([^_]+)_count\([^ \)]*\)
Replace with:
Код:
cache_get_$2_count\($1\)



Re: [REL] MySQL Plugin (Now on github!) - morris91 - 08.09.2016

Updating to R40. Any idea why im getting this error?

Loading plugin: mysql.so
[21:33:47] Failed (log-core.so: cannot open shared object file: No such file or directory)


Re: [REL] MySQL Plugin (Now on github!) - IstuntmanI - 08.09.2016

Quote:
Originally Posted by morris91
Посмотреть сообщение
Updating to R40. Any idea why im getting this error?

Loading plugin: mysql.so
[21:33:47] Failed (log-core.so: cannot open shared object file: No such file or directory)
As far as I know, you have to place log-core.so in your main directory. You can find it here: https://github.com/maddinat0r/samp-l...ses/tag/v0.2.2 .


Re: [REL] MySQL Plugin (Now on github!) - TommyB - 08.09.2016

I'm experiencing a crash whenever I run a specific query.

Код:
mysql_format(conn, mquery, sizeof(mquery), "SELECT VehicleModel FROM vehicles WHERE NeedsRecovery = 1 AND OwnerSQLID = %i", SQLID[playerid]);
mysql_pquery(conn, mquery, "MyCarsRecovery", "iis", playerid, Vcount, gstr);
I get the following error from crashdetect.

Код:
[21:14:18] [debug] Server crashed while executing RCRP_MySQL.amx
[21:14:18] [debug] AMX backtrace:
[21:14:18] [debug] #0 native mysql_pquery () from mysql.DLL
[21:14:18] [debug] #1 001d09c4 in public cmd_mycars (playerid=1, ... <1 argument>) at C:\Users\TommyB\Desktop\servers\redcountyrp\gamemodes\RCRP_MySQL.pwn:32719
[21:14:18] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:14:18] [debug] #3 00009588 in public OnPlayerCommandText (playerid=1, cmdtext[]=@02b8eeec "/mycars") at C:\Users\TommyB\Desktop\servers\redcountyrp\pawno\include\zcmd.inc:78
[21:14:18] [debug] Native backtrace:
[21:14:18] [debug] #0 6435658a in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #1 64357ec8 in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #2 64371aec in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #3 6437655e in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #4 004010b6 in ?? () from samp-server.exe
[21:14:18] [debug] #5 64c862ca in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #6 64c88b28 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #7 64c809c7 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #8 64c8631a in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #9 64294509 in ?? () from plugins\streamer.DLL
[21:14:18] [debug] #10 004746be in ?? () from samp-server.exe
[21:14:18] [debug] #11 004010b6 in ?? () from samp-server.exe
[21:14:18] [debug] #12 64c862ca in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #13 64c88b28 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #14 64c809c7 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #15 64c8631a in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #16 64294509 in ?? () from plugins\streamer.DLL
[21:14:18] [debug] #17 0046dd10 in ?? () from samp-server.exe
[21:14:18] [debug] #18 00452270 in ?? () from samp-server.exe
[21:14:18] [debug] #19 0049eef9 in ?? () from samp-server.exe
[21:14:18] [debug] #20 004aa31e in ?? () from samp-server.exe
This also prints into log-core.log
Код:
[21:14:18] [ERROR] exception 0XC0000005 (ACCESS_VIOLATION) from Vectored Exception Handler catched; shutting log-core down



Re: [REL] MySQL Plugin (Now on github!) - MerryDeer - 08.09.2016

Yes there is somewhere mistake, because i too get server crash on querie, just mysql querie like you, it means this function have mistake.


Re: [REL] MySQL Plugin (Now on github!) - maddinat0r - 08.09.2016

Quote:
Originally Posted by TommyB
Посмотреть сообщение
I'm experiencing a crash whenever I run a specific query.

Код:
mysql_format(conn, mquery, sizeof(mquery), "SELECT VehicleModel FROM vehicles WHERE NeedsRecovery = 1 AND OwnerSQLID = %i", SQLID[playerid]);
mysql_pquery(conn, mquery, "MyCarsRecovery", "iis", playerid, Vcount, gstr);
I get the following error from crashdetect.

Код:
[21:14:18] [debug] Server crashed while executing RCRP_MySQL.amx
[21:14:18] [debug] AMX backtrace:
[21:14:18] [debug] #0 native mysql_pquery () from mysql.DLL
[21:14:18] [debug] #1 001d09c4 in public cmd_mycars (playerid=1, ... <1 argument>) at C:\Users\TommyB\Desktop\servers\redcountyrp\gamemodes\RCRP_MySQL.pwn:32719
[21:14:18] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:14:18] [debug] #3 00009588 in public OnPlayerCommandText (playerid=1, cmdtext[]=@02b8eeec "/mycars") at C:\Users\TommyB\Desktop\servers\redcountyrp\pawno\include\zcmd.inc:78
[21:14:18] [debug] Native backtrace:
[21:14:18] [debug] #0 6435658a in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #1 64357ec8 in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #2 64371aec in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #3 6437655e in ?? () from plugins\mysql.DLL
[21:14:18] [debug] #4 004010b6 in ?? () from samp-server.exe
[21:14:18] [debug] #5 64c862ca in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #6 64c88b28 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #7 64c809c7 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #8 64c8631a in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #9 64294509 in ?? () from plugins\streamer.DLL
[21:14:18] [debug] #10 004746be in ?? () from samp-server.exe
[21:14:18] [debug] #11 004010b6 in ?? () from samp-server.exe
[21:14:18] [debug] #12 64c862ca in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #13 64c88b28 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #14 64c809c7 in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #15 64c8631a in ?? () from plugins\crashdetect.DLL
[21:14:18] [debug] #16 64294509 in ?? () from plugins\streamer.DLL
[21:14:18] [debug] #17 0046dd10 in ?? () from samp-server.exe
[21:14:18] [debug] #18 00452270 in ?? () from samp-server.exe
[21:14:18] [debug] #19 0049eef9 in ?? () from samp-server.exe
[21:14:18] [debug] #20 004aa31e in ?? () from samp-server.exe
This also prints into log-core.log
Код:
[21:14:18] [ERROR] exception 0XC0000005 (ACCESS_VIOLATION) from Vectored Exception Handler catched; shutting log-core down
Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Yes there is somewhere mistake, because i too get server crash on querie, just mysql querie like you, it means this function have mistake.
I need a mysql.log with debug output, otherwise I can't narrow down the crash. So please enable full logging ("mysql_log(ALL);"), reproduce that crash and send me the mysql.log per PM.


Re: [REL] MySQL Plugin (Now on github!) - MerryDeer - 08.09.2016

What difference between

cache_num_rows

and

cache_get_row_count ?