Posts: 845
Threads: 3
Joined: Jun 2010
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.
Posts: 845
Threads: 3
Joined: Jun 2010
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:
- code-breaking changes:
- removed connection handle parameter from all cache functions
- added 'MySQL' tag to all connection handle parameters
- removed redundant prefixes from enumerations (e.g. 'LOG_ERROR -> ERROR')
- moved 'MySQL:handle' parameter in functions 'mysql_escape_string', 'mysql_stat' and 'mysql_get_charset' (it's the last parameter now)
- swapped places of parameters 'password[]' and 'database[]' in function 'mysql_connect'
- moved all connection options from 'mysql_connect' to its own system ('mysql_init_options' and 'mysql_set_option' for more information)
- renamed 'mysql_option' to 'mysql_global_options'
- removed 'cache_get_data' (use 'cache_get_*_count')
- removed parameter 'clearvars' in 'orm_delete' (see 'orm_clear_vars' for more information)
- renamed 'cache_get_row' to 'cache_get_value_index' ('_int' and '_float' likewise)
- renamed 'cache_get_field_content' to 'cache_get_value_name' ('_int' and '_float' likewise)
- all 'cache_get_*' (e.g. 'cache_get_value_index_bool' or 'cache_get_row_count') functions now return their value through a reference parameter instead of returning it directly
- the 'logtype' parameter in 'mysql_log' has been removed; there is no HTML-logging anymore
- all y_inline support code has been outsourced, see samp-mysql-yinline-include
- 'cache_set_active(Cache:0)' doesn't unset the active cache, see 'cache_unset_active()'
- removed 'mysql_reconnect'
- removed 'mysql_current_handle'
- major system changes:
- stored cache results are now handled globally, not per-connection (as before); that means you can now share stored results between filterscripts and gamemodes
- the plugin doesn't force-auto-reconnect now (background: the plugin stored the login credentials internally to basically perform a disconnect and immediate connect on specific error cases; now the plugin doesn't store any credentials anymore)
- all natives now indicate their execution status through their return value (e.g. return 1 on success, 0 on failure)
- new features:
- support for multiple result sets
- support for passing arrays and references to result callbacks (format specifier 'a' and 'r') ('a' expects 'i'/'d' after itself to provide the array size; the size format specifier is also passed as a callback argument)
- brand new logging system:
- automatic detection of debug info (compiled with '-d2'/'-d3'): if the log system detects any debug information within the script, plugin native logs will have the script file name and line number displayed within the according log line
- threaded logging: the new log system is now completely threaded and crash-safe, resulting in a faster logging experience (especially when logging with all log levels enabled)
- third-party compatible: other plugin authors can incorporate this new logging system into their plugins and take advantage of fast, safe and managed text logging
- ability to create SSL-encrypted connections
- 'orm_update' and 'orm_delete' now accept callbacks
- 'mysql_query_file': send unthreaded queries from a .sql file
- 'mysql_connect_file': create a connection handle using a file (which has all the credentials and options stored in an INI-like format)
- 'orm_clear_vars': sets all registered variables to 0
- 'cache_is_value_null': returns true if the value is 'NULL'
- 'cache_get_value_bool': returns 'false' if the value is 0, otherwise 'true'
- 'cache_get_value' overloads: instead of calling e.g. 'cache_get_value_index_int(0, 0)' one can now just omit the 'index'/'name' part: 'cache_get_value_int(0, 0)' (this will correctly translate to the former call)
same goes for all other 'cache_get_value' natives (and 'cache_is_value_null')
- 'cache_get_field_type': returns the type of a field
- 'cache_unset_active': unsets the active cache
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!
Posts: 845
Threads: 3
Joined: Jun 2010
Код:
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.
}
Posts: 1,266
Threads: 6
Joined: Oct 2014
Edit:
NVM LOL
didn't know its R40 : p, well done sir D: I like your works xd.
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by MerryDeer
|
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
Posts: 723
Threads: 366
Joined: Jun 2016
My server also crash during mysql_tquery how that your function can be crash reason?
Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
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.
Posts: 455
Threads: 29
Joined: Apr 2014
How to change it, that it will just return int and float.
Posts: 607
Threads: 90
Joined: Feb 2011
Reputation:
0
I don't understand what is log core. What it does?
Posts: 845
Threads: 3
Joined: Jun 2010
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--
Posts: 140
Threads: 12
Joined: Feb 2008
Reputation:
0
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)
Posts: 192
Threads: 2
Joined: Sep 2010
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
Posts: 723
Threads: 366
Joined: Jun 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.
Posts: 845
Threads: 3
Joined: Jun 2010
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.
Posts: 723
Threads: 366
Joined: Jun 2016
What difference between
cache_num_rows
and
cache_get_row_count ?