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

Quote:
Originally Posted by The501legion
Посмотреть сообщение
Is there any way to get a simple function which saves the results of a query directly in its parameters? This function should skip the entire callback-part like
Код:
sqlQuery("select userID from users where userName = 'Test';", "i", id, handle);
id should now contain the selected userID from user Test.
Sure:
Код:
sqlQuery(handle, const query[], &var)
{
	new Cache:result = mysql_query(handle, query);
	var = cache_get_row_int(0, 0);
	cache_delete(result);
	return 1;
}
Just make sure that your query executes quick enough (since this is an unthreaded query), e.g. add a "LIMIT 1" statement at the end of your query.


Quote:
Originally Posted by _Zume
Посмотреть сообщение
Код:
[15:19:57] [debug] Server crashed due to an unknown error 
[15:19:57] [debug] Native backtrace: 
[15:19:57] [debug] #0 00e0f50b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so 
[15:19:57] [debug] #1 00e0820f in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so 
[15:19:57] [debug] #2 00e093fc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so 
[15:19:57] [debug] #3 00e09866 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so 
[15:19:57] [debug] #4 00e0f15c in ?? () from plugins/crashdetect.so 
[15:19:57] [debug] #5 0013e410 in ?? () 
[15:19:57] [debug] #6 005be806 in ?? () from /lib/libc.so.6 
[15:19:57] [debug] #7 00f55254 in _ZN11CMySQLQuery11StoreResultEP8st_mysqlP12st_mysql_res () from plugins/mysql_static.so 
[15:19:57] [debug] #8 00f55657 in _ZN11CMySQLQuery7ExecuteEP8st_mysql () from plugins/mysql_static.so 
[15:19:57] [debug] #9 00f4c9e4 in _ZN16CMySQLConnection14ProcessQueriesEv () from plugins/mysql_static.so 
[15:19:57] [debug] #10 00f4d2e7 in _ZN5boost6detail11thread_dataINS_3_bi6bind_tIvNS_4_mfi3mf0Iv16CMySQLConnectionEENS2_5list$ 
[15:19:57] [debug] #11 00ff65a8 in ?? () from plugins/mysql_static.so 
[15:19:57] [debug] #12 001c7b69 in ?? () from /lib/libpthread.so.0 
[15:19:57] [debug] #13 00569cce in clone () from /lib/libc.so.6
what's wrong with this?
Quote:
Originally Posted by LatinZ
Посмотреть сообщение
The r39-3 and r39-4 version is not compatible with the latest detect crash, this incompatibility causes the fall of the server.

EDIT:

The crash occurs for the 64-bit version. " mysql_static.so " I'll let the problem here:
Hm, this seems like a real issue now. How often does this crash occur (for both of you)?


Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Hi, this:

mysql_log(LOG_ALL, LOG_TYPE_HTML);
g_SQL = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);

Gives this:
https://i.gyazo.com/2ed55a4a110d8017...f00ea3a4cb.png

And it is working as a .txt file, any help please?
Could you provide that faulty html file? (through pastebin please)
Reply

Hey,i've got problem,why mydql cant connect to database ..

Help me,pm meh if u know what'is problem
Reply

Quote:
Originally Posted by norton2
Посмотреть сообщение
Which is the best option?

Option 1:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "UPDATE `players` SET `Money`=%d WHERE `ID`=%d", pInfo[playerid][pMoney],pInfo[playerid][pID]);
mysql_tquery(MySQLCon, QuerY);
Option 2:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "UPDATE `players` SET `Money`=%d WHERE `ID`=%d", pInfo[playerid][pMoney],pInfo[playerid][pID]);
mysql_pquery(MySQLCon, QuerY);
pQuery or tQuery for Update? In table `players` are over 4,000+ created accounts.
Anyone?
Reply

use tQuery

pQuery is for on mulitple connection
Reply

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
use tQuery

pQuery is for on mulitple connection
Ok, thank you!
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Sure:
Код:
sqlQuery(handle, const query[], &var)
{
	new Cache:result = mysql_query(handle, query);
	var = cache_get_row_int(0, 0);
	cache_delete(result);
	return 1;
}
Just make sure that your query executes quick enough (since this is an unthreaded query), e.g. add a "LIMIT 1" statement at the end of your query.





Hm, this seems like a real issue now. How often does this crash occur (for both of you)?



Could you provide that faulty html file? (through pastebin please)
Check this: https://sampforum.blast.hk/showthread.php?tid=595073

Cheers.
Reply

[18:17:11] [WARNING] CMySQLConnection:isconnect - no connection available
Reply

I saw now you added mysql_unprocessed_queries & mysql_format. If you compile it then I can test it on my live server.
Reply

Whenever I connect to mysql, It creates a process in mysql process list, then when I use mysql_close it won't kill the process therefore after a while error will occur: "Too many connections"...

Why mysql_close won't kill the process?
Reply

Because mysql_close closes the connection to the database, not the process itself.
Reply

I don't know what you are doing in order to open too many connections. Unless your connection limit is, like, 5. The plugin only opens as many connections as has been set in the poolsize parameter in mysql_connect (default 2) and it should close all of them on disconnect.
Reply

The number of direct database connections per connection handle is 2 (un/threaded connections for mysql_(t)query) + pool size (mysql_pquery), thus the default number of connections is actually 4.
Reply

I've move to an Ubuntu 64bit
I get this error I've searched for it but don't know what to do with the file:

Код:
Loading plugin: mysql.so
Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
* Both mysql.so and a_mysql.inc are version R7,
* I've recompiled my FS too.
Reply

Quote:
Originally Posted by amirm3hdi
Посмотреть сообщение
I've move to an Ubuntu 64bit
I get this error I've searched for it but don't know what to do with the file:

Код:
Loading plugin: mysql.so
Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
* Both mysql.so and a_mysql.inc are version R7,
* I've recompiled my FS too.
R7 is ancient, get a newer revision.
Reply

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
R7 is ancient, get a newer revision.
What do you mean? There's only R7, can't see a newer version...
Reply

Quote:
Originally Posted by amirm3hdi
Посмотреть сообщение
What do you mean? There's only R7, can't see a newer version...
Quote:
Originally Posted by BlueG
Посмотреть сообщение
It's currently being developed by Pain123/maddinat0r; you'll find all older versions, including source codes and sample scripts, from R5 to R7 at the bottom of this post and the latest release here.
4char
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
4char
I have assisted him with finding it.

He's having a problem with loading the gamemode now, all of the plugins seem to be loading correctly.
Reply

Callback OnQueryError not caused. What to do? Version: Linux, R39-4
Reply

Код:
[13:50:23] [ERROR] CMySQLQuery::Execute[] - (error #1054) Unknown column 'nan' in 'field list'
this happens when I disconnect from the server. the query executes though. i've double-checked it and there is not any length or query error.

nvm, solved.
Reply

Please help me: https://sampforum.blast.hk/showthread.php?tid=600815
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)