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 R6 - 09/07/11 - _[HuN]_Epsilon_ - 13.07.2011

mysql_ping function crashes sometimes my server. :-$

Код:
	if(mysql_ping() ==-1)
	{
	    print("[MYSQL-DEAD] Reconnect");
	    mysql_reconnect();
	}



Re: [REL] MySQL Plugin R6 - 09/07/11 - PawnNewCommer - 14.07.2011

I'm doing in my script, save the data in the player database.
Makes a request of this kind in Public updateaccount:

Код:
new query[MAX_STRING];
format(query,sizeof(query)," UPDATE players SET PlayerLevel=%d,AdminLevel=%d,Sex=%d,Age=%d,Money=%d,Kills=%d,...,..., etc. a lot of data (over 35)  WHERE id=%d",
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pSex],
PlayerInfo[playerid][pAge],
PlayerInfo[playerid][pCash],
PlayerInfo[playerid][pKills],
....
etc. a lot of data (over 50)
....
PlayerInfo[playerid][pSQLID]);
mysql_query(query);
When I compile the mod, I get an error:
Код:
error 075: input line too long (after substitutions)
in line:
Код:
format(query,sizeof(query)," UPDATE players SET PlayerLevel=%d,AdminLevel=%d,Sex=%d,Age=%d,Money=%d,Kills=%d,...,..., etc. a lot of data (over 35)  WHERE id=%d",
How to make a long query?
That request to be as fast, optimized, does not create lag and did not create big server load and server mysql load.


Re: [REL] MySQL Plugin R6 - 09/07/11 - kacper55331 - 14.07.2011

Save the database to the variables that you use all the time. eg position, cash. etc. And such adminlvl save only when you change it, eg by a command.


Re: [REL] MySQL Plugin R6 - 09/07/11 - Jon_De - 14.07.2011

Quote:
Originally Posted by PawnNewCommer
Посмотреть сообщение
I'm doing in my script, save the data in the player database.
Makes a request of this kind in Public updateaccount:

Код:
new query[MAX_STRING];
format(query,sizeof(query)," UPDATE players SET PlayerLevel=%d,AdminLevel=%d,Sex=%d,Age=%d,Money=%d,Kills=%d,...,..., etc. a lot of data (over 35)  WHERE id=%d",
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pSex],
PlayerInfo[playerid][pAge],
PlayerInfo[playerid][pCash],
PlayerInfo[playerid][pKills],
....
etc. a lot of data (over 50)
....
PlayerInfo[playerid][pSQLID]);
mysql_query(query);
When I compile the mod, I get an error:
Код:
error 075: input line too long (after substitutions)
in line:
Код:
format(query,sizeof(query)," UPDATE players SET PlayerLevel=%d,AdminLevel=%d,Sex=%d,Age=%d,Money=%d,Kills=%d,...,..., etc. a lot of data (over 35)  WHERE id=%d",
How to make a long query?
That request to be as fast, optimized, does not create lag and did not create big server load and server mysql load.
Use strcat


Re: [REL] MySQL Plugin R6 - 09/07/11 - Whitetiger - 14.07.2011

Quote:
Originally Posted by _[HuN]_Epsilon_
Посмотреть сообщение
mysql_ping function crashes sometimes my server. :-$

Код:
	if(mysql_ping() ==-1)
	{
	    print("[MYSQL-DEAD] Reconnect");
	    mysql_reconnect();
	}
Hi, our problems seem very similar (read my post on the previous page) It may be a problem with reconnecting instead of what I thought (reloading fs), hopefully this will be fixed, in the meantime, i'm using R5. does yours work in R5?


Re: [REL] MySQL Plugin R6 - 09/07/11 - Johnson_boy - 14.07.2011

I changed to R6 plugin. It still says R5 plugin loaded when I run the server.
Is there wrong file compiled, or is it just forgotten to change that text in plugin?


Re: [REL] MySQL Plugin R6 - 09/07/11 - xxmitsu - 14.07.2011

Quote:
Originally Posted by Johnson_boy
Посмотреть сообщение
I changed to R6 plugin. It still says R5 plugin loaded when I run the server.
Is there wrong file compiled, or is it just forgotten to change that text in plugin?
....

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
If you compiled it from source, the version string isn't updated/changed with the string "R6" (if that annoys you, you can change that yourself).

But if you compare the source code with the previous version(R5), you'll see that there's a mutex implementation.
Код:
	while(true) {
		Mutex::getInstance()->_lockMutex();
And yes, It's just something that was forgot to be changed in the source code. The compiled binaries are just fine.



Re: [REL] MySQL Plugin R6 - 09/07/11 - _[HuN]_Epsilon_ - 15.07.2011

Quote:
Originally Posted by whitetigerswt
Посмотреть сообщение
Hi, our problems seem very similar (read my post on the previous page) It may be a problem with reconnecting instead of what I thought (reloading fs), hopefully this will be fixed, in the meantime, i'm using R5. does yours work in R5?
It crashes on both versions. (R5,R6)


Re: [REL] MySQL Plugin R6 - 09/07/11 - mariomako - 15.07.2011

where to put libmysqlclient.so.15

i have only ftp acces and start/stop server


Re: [REL] MySQL Plugin R6 - 09/07/11 - Donya - 15.07.2011

something like.. onquerystart and mysql_is_result_stored?

pawn Код:
native mysql_is_stored_result( [connectionHandle = 1] );
forward OnQueryStart( query[], resultid, extraid, connectionHandle );
pawn Код:
public OnQueryStart(query[], resultid, extraid, connectionHandle)
{
    if(mysql_is_result_stored()) mysql_free_result();
    return 1;
}



Re: [REL] MySQL Plugin R6 - 09/07/11 - mariomako - 16.07.2011

where to put libmysqlclient.so.15

i have only ftp acces and start/stop server


Re: [REL] MySQL Plugin R6 - 09/07/11 - Lightning[SV] - 17.07.2011

The debian x86 version doesn't load on debian 5:

Failed (/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by plugins/mysql.so))

R5 x86 works fine, can someone recompile it please?


Re: [REL] MySQL Plugin R6 - 09/07/11 - mariomako - 17.07.2011

why i have this error:

Код:
[10:56:19]  Loading plugin: mysql.so
[10:56:19]   Failed (plugins/mysql.so: symbol _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i, version GLIBCXX_3.4.9 not defined in file libstdc++.so.6 with link time reference)
R5 and why i can't load R6 i have error: cant load libmysqlclient_r.so.16


Re: [REL] MySQL Plugin R6 - 09/07/11 - Ronaldo_raul™ - 17.07.2011

Getting this..??
Код:
[00:46:02]  

[00:46:02] ---------------------------

[00:46:02] MySQL Debugging activated (07/19/11)

[00:46:02] ---------------------------

[00:46:02]  

[00:46:02] >> mysql_connect( )

[00:46:02] CMySQLHandler::CMySQLHandler() - constructor called.

[00:46:02] CMySQLHandler::CMySQLHandler() - Connecting to "sql102.0fees.net" | DB: "fees0_8346974_jban" | Username: "fees0_8346974" ...

[00:46:23] CMySQLHandler::Connect() - Can't connect to MySQL server on 'sql102.0fees.net' (10060) (Error ID: 2003)

[00:46:23] >> mysql_ping( Connection handle: 1 )

[00:46:23] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[00:46:23] CMySQLHandler::~CMySQLHandler() - deconstructor called.

[00:46:23] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[00:46:23] CMySQLHandler::Disconnect() - You cannot call this function now. (Reason: Connection is dead)



Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Gh0sT_ - 17.07.2011

so, now I need to use mysql_format instead of format when Im sending queries?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Donya - 17.07.2011

is this mysql_format faster than format?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - Calgon - 18.07.2011

Yay for mysql_format(), no point in declaring over 9000 strings with over 9000 cells for formatting queries.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - [L3th4l] - 18.07.2011

Whats wrong here? I get tag mismatch on the mysql_format line:
pawn Код:
mysql_format(iQuery2, "INSERT INTO `playerbans` (`BannedName`, `BannedIP`, `Reason`, `Date`, `Admin`) VALUES ('%s', '%e', '%s', '%s', '%e')", "IP Ban", params, "No Reason Given", iStamp(), PNames[playerid]);

//format(iQuery2, sizeof(iQuery2), "INSERT INTO `playerbans` (`BannedName`, `BannedIP`, `Reason`, `Date`, `Admin`) VALUES ('%s', '%s', '%s', '%s', '%s')", "IP Ban", params, "No Reason Given", iStamp(), PNames[playerid]);

mysql_query(iQuery2);
Normal format works fine.


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - nemesis- - 23.07.2011

If I understand this correctly, mysql_format() does the escaping for you so there's no need to sanitize inputs before using them and formats the string all in one?


Re: [REL] MySQL Plugin R6-2 - 17/07/11 - [NoV]LaZ - 23.07.2011

Quote:
Originally Posted by nemesis-
Посмотреть сообщение
If I understand this correctly, mysql_format() does the escaping for you so there's no need to sanitize inputs before using them and formats the string all in one?
Yes.