31.01.2014, 08:01
Which version are you using?
What does your code look like? Come over to scripting help
What does your code look like? Come over to scripting help
Код:
[04:03:26] [DEBUG] mysql_set_charset - charset: "cp1251", connection: 1 [04:03:26] [DEBUG] mysql_query - connection: 1, query: "SET NAMES cp1251;", use_cache: false [04:03:26] [DEBUG] CMySQLQuery::Execute - starting query execution [04:03:26] [DEBUG] CMySQLQuery::Execute - query was successful [04:03:26] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [04:03:26] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [04:03:26] [DEBUG] mysql_query - connection: 1, query: "SET SESSION character_set_server='cp1251';", use_cache: false [04:03:26] [DEBUG] CMySQLQuery::Execute - starting query execution [04:03:26] [DEBUG] CMySQLQuery::Execute - query was successful [04:03:26] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [04:03:26] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [04:03:26] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "description", data: "??????? ??????? ? 2-? ???????? ????????" |
Bug here!
mysql_set_charset("cp1251") doesn't work in R35 with mysql_tquery or mysql_pquery. Fix it pls. [...] |
I had very strange results with R35 on a simple SELECT query:
[...] |
Already reported CuervO, thanks for the information though it will help pain
|
[debug] Server crashed while executing Kcnr.amx [20:21:11] [debug] AMX backtrace: [20:21:11] [debug] #0 native mysql_reconnect () [b7281b90] from mysql_static_.so [20:21:11] [debug] #1 001c6c48 in public OnQueryError (0x000007d6, 0x0053bdec, 0x0053bd94, 0x0053bc30, 0x00000001) from Kcnr.amx [20:21:11] [debug] Native backtrace: [20:21:11] [debug] #0 b665d31b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [20:21:11] [debug] #1 b66577c2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so [20:21:11] [debug] #2 b66583ac in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so [20:21:11] [debug] #3 b6658856 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [20:21:11] [debug] #4 b665cf6c in ?? () from plugins/crashdetect.so [20:21:11] [debug] #5 b7799600 in ?? () [20:21:11] [debug] #6 b3f00098 in ?? () from `v·–v·t%яіt%яіu%яіt%яі%'яіt'яі4w· [20:21:11] [debug] #7 b72bc7f0 in mysql_real_connect () from plugins/mysql_static_.so [20:21:11] [debug] #8 b726a45d in _ZN16CMySQLConnection7ConnectEv () from plugins/mysql_static_.so [20:21:11] [debug] #9 b7270cbc in _ZN11CMySQLQuery7ExecuteEv () from plugins/mysql_static_.so [20:21:11] [debug] #10 b726a7ec in _ZN12CMySQLHandle14ProcessQueriesEv () from plugins/mysql_static_.so [20:21:11] [debug] #11 b726c1c7 in _ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0Iv12CMySQLHandleEENS2_5list1INS2_5valueIPS6_EEEEEEE3runEv () from plugins/mysql_static_.so [20:21:11] [debug] #12 b72905c1 in ?? () from plugins/mysql_static_.so [20:21:11] [debug] #13 b7779954 in ?? () from /lib/i386-linux-gnu/libpthread.so.0 [20:21:11] [debug] #14 b75ca95e in clone () from /lib/i386-linux-gnu/libc.so.6
[20:21:35] EID: 2006 | Error: MySQL server has gone away | Query: SELECT * FROM `Player_Bans` WHERE `Name` = 'Zatona' OR IP = '217.55.121.31' LIMIT 0,1 [20:21:35] [debug] Server crashed due to an unknown error [20:21:35] [debug] Native backtrace: [20:21:35] [debug] #0 b660931b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [20:21:35] [debug] #1 b66037c2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so [20:21:35] [debug] #2 b66043ac in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so [20:21:35] [debug] #3 b6604856 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [20:21:35] [debug] #4 b6608f6c in ?? () from plugins/crashdetect.so [20:21:35] [debug] #5 b7745600 in ?? () [20:21:35] [debug] #6 b3e00098 in ?? () from `Xq·Vq·Д,ВіД,ВіЕ,ВіД,Віu.ВіД.Ві4Уq· [20:21:35] [debug] #7 b72687f0 in mysql_real_connect () from plugins/mysql_static_.so [20:21:35] [debug] #8 b721645d in _ZN16CMySQLConnection7ConnectEv () from plugins/mysql_static_.so [20:21:35] [debug] #9 b721ccbc in _ZN11CMySQLQuery7ExecuteEv () from plugins/mysql_static_.so [20:21:35] [debug] #10 b72167ec in _ZN12CMySQLHandle14ProcessQueriesEv () from plugins/mysql_static_.so [20:21:35] [debug] #11 b72181c7 in _ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0Iv12CMySQLHandleEENS2_5list1INS2_5valueIPS6_EEEEEEE3runEv () from plugins/mysql_static_.so [20:21:35] [debug] #12 b723c5c1 in ?? () from plugins/mysql_static_.so [20:21:35] [debug] #13 b7725954 in ?? () from /lib/i386-linux-gnu/libpthread.so.0 [20:21:35] [debug] #14 b757695e in clone () from /lib/i386-linux-gnu/libc.so.6
[debug] Server crashed due to an unknown error [03:39:15] [debug] Native backtrace: [03:39:15] [debug] #0 b665431b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [03:39:15] [debug] #1 b664e7c2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so [03:39:15] [debug] #2 b664f3ac in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so [03:39:15] [debug] #3 b664f856 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [03:39:15] [debug] #4 b6653f6c in ?? () from plugins/crashdetect.so [03:39:15] [debug] #5 b7790600 in ?? () [03:39:15] [debug] #6 b7517667 in gsignal () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #7 b751aa52 in abort () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #8 b755398d in ?? () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #9 b755da8a in ?? () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #10 b7560c02 in ?? () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #11 b75624bc in __libc_malloc () from /lib/i386-linux-gnu/libc.so.6 [03:39:15] [debug] #12 b76cd7b5 in _Znwj () from /usr/lib/i386-linux-gnu/libstdc++.so.6 [03:39:15] [debug] #13 b6717d14 in ?? () from plugins/irc.so [03:39:15] [debug] #14 b6702d49 in ?? () from plugins/irc.so [03:39:15] [debug] #15 b6703fcb in ?? () from plugins/irc.so [03:39:15] [debug] #16 b670e977 in ?? () from plugins/irc.so [03:39:15] [debug] #17 b67205be in ?? () from plugins/irc.so [03:39:15] [debug] #18 b671bcab in ?? () from plugins/irc.so [03:39:15] [debug] #19 b6726c44 in ?? () from plugins/irc.so [03:39:15] [debug] #20 b66ed840 in ?? () from plugins/irc.so [03:39:15] [debug] #21 b7770954 in ?? () from /lib/i386-linux-gnu/libpthread.so.0 [03:39:15] [debug] #22 b75c195e in clone () from /lib/i386-linux-gnu/libc.so.6
#define mysql_host "127.0.0.1"
#define mysql_user "PowerPC603"
#define mysql_password "MyPass"
#define mysql_database "ppctrucking"
public OnFilterScriptInit()
{
// Connect to the MySQL database and store the connection-handle
mysql_debug(1);
SQL_db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
if (SQL_db)
printf("MySQL connection successful");
else
printf("MySQL failed to connect");
format(Query, sizeof(Query), "SHOW DATABASES LIKE '%s'", mysql_database);
mysql_query(SQL_db, Query);
mysql_store_result(SQL_db);
if (mysql_num_rows(SQL_db) == 1)
printf("Connecting to MySQL was successful, database \"%s\" exists", mysql_database);
else
{
printf("ERROR: Connecting to MySQL failed, database \"%s\" doesn't exist", mysql_database);
printf("Shutting down server...");
mysql_free_result(SQL_db);
mysql_close(SQL_db);
SetTimer("ShutdownServer", 5000, false);
return 1;
}
SQL_db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
if (!mysql_errno(SQL_db)) printf("MySQL connection successful");
else printf("MySQL failed to connect");
I'm using R34 of your plugin and I have a question.
Why does "mysql_connect" return 1, even when MySQL isn't running? ... |
Returns Connection handle. |
mysql_connect("127.0.0.1", "root", "mydatabase", "mypass");
if(mysql_errno() != 0)
print("Could not connect to database!");
If I change pool_size in mysql_connect() to 20 and I'll use mysql_pquery, then this will be very fast?
If server will use lot of resources, it doesn't matter. |
I'm using R34 of your plugin and I have a question.
Why does "mysql_connect" return 1, even when MySQL isn't running?[...] |
SQL_db = mysql_connect(mysql_host, mysql_user, "ppctrucking", mysql_password);
mysql_query(SQL_db, "CREATE DATABASE IF NOT EXISTS `ppctrucking`");
MySQL creates a mysql database, which it uses to store users and privileges. |
If you intend to put it in your gamemode, don't. Most of people using it are using some sort of shared hosting where they don't have power over their db name, and of course aren't allowed to create a new one.
Connecting to that database combined even with a single SQLi is not wise - usually that db is available only to root user, and using root account for your game connection is not wise as well. |
#define mysql_host "127.0.0.1"
#define mysql_user "PowerPC603"
#define mysql_password "MyPass"
#define mysql_database "ppctrucking"
new SQL_db; // Will hold the connectionhandle to the database
public OnFilterScriptInit()
{
SQL_db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
// Check if there were errors after trying to connect
if (mysql_errno() == 0)
{
printf("Connecting to MySQL was successful");
}
else // The database doesn't exist, so close the connection and shutdown the server after 5 seconds
{
printf("ERROR: Connecting to MySQL failed, shutting down server...");
printf(" ");
printf(" ");
printf(" ");
mysql_close(SQL_db);
SetTimer("ShutdownServer", 5000, false);
return 1;
}
// Rest of code
}
// This timer is used to shutdown the server if connecting to the database failed
forward ShutdownServer();
public ShutdownServer()
{
SendRconCommand("exit");
return 1;
}
Yup, that's the best option. You might want to add option for tablename prefixes (few small servers using same database).
|
Last friday I downloaded R35 version on github but now I can't find it again.
Anyone got a direct link for linux please ? |