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!) - Aprezt - 08.03.2015

Forbidden

You don't have permission to access /mysql/rel/R7/ubuntu/mysql.so on this server.
Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


Respuesta: [REL] MySQL Plugin (Now on github!) - Ezzy - 08.03.2015

Link doesnt work


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

Quote:
Originally Posted by Vince
Посмотреть сообщение
Getting a lot of segfaults lately which are apparently always caused by __kernel_vsyscall, whatever that may be. Not at all familiar with C++ so I'm not sure what the actual problem is.

Crashlog
How frequent are those segfaults? Do you remember changing anything that could have led to these crashes?


Re: [REL] MySQL Plugin (Now on github!) - Vince - 08.03.2015

Thrice so far in a three week timespan. Though I do have to mention that it involves a development server currently running 0.3.7 RC2 which isn't frequently populated. The crashes seem to happen quite randomly and only when the gamemode changes. I run the Mini-Missions server so the gamemode does change frequently.

The events prior to that last crash:
Код:
[12:55:45]   Loading gamemode...
[12:55:45]   [mysql] gamemode@127.0.0.1:3306 with database "minimissions" - connecting ...
[12:55:45]   [mysql] connected - id: 3
[12:55:45] Number of vehicle models: 0
[02:20:15] Incoming connection: ***:61969 id: 0
[02:22:00] Incoming connection: ***:62564 id: 0
[02:22:02] [join] iRolex has joined the server (0:***)
[02:22:40] [part] iRolex has left the server (0:0)
[02:23:20] Incoming connection: ***:61773 id: 0
[02:23:21] [join] iRolex has joined the server (0:***)
[02:27:25]   [info] driver.amx - now loading mission 4 ...
[02:27:25]   [info] driver.amx - also added 5 missions to queue.

[02:27:25]   [mysql] closed - id: 3
When the gamemode starts a connection is opened and when it ends the connection is closed again. Two other connections in two different filterscripts (admin system and the "driver") are kept open all the time.


Re: [REL] MySQL Plugin (Now on github!) - Vince - 09.03.2015

You can concatenate the results of different columns in a SELECT statement, but actually storing multiple values in one column is inherently wrong.


Re: [REL] MySQL Plugin (Now on github!) - Evocator - 09.03.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
You can concatenate the results of different columns in a SELECT statement, but actually storing multiple values in one column is inherently wrong.
Whats bad with that? Rather than having 15 fields i could use one and split the values..


Re: [REL] MySQL Plugin (Now on github!) - Kyle - 09.03.2015

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Whats bad with that? Rather than having 15 fields i could use one and split the values..
It's just bad practice.


Re: [REL] MySQL Plugin (Now on github!) - Vince - 09.03.2015

Main drawback is that you can't sort or group that column and you can't use an index. If you have a lot of data and you need a better overview, consider splitting up one table into multiple tables and link them with 1-on-1 relations. Although it doesn't have to be 1-on-1 because most of time it useful to store extra information.

Let's say you create a table "kills_and_deaths" with fields: victim [int unsigned foreign key references accounts], killer [int unsigned foreign key references accounts], weapon [tinyint unsigned foreign key references weapon_names].

You can then insert a new row each time a kill occurs (in OnPlayerDeath). Then, if you want to find out the amount of deaths for a player you can do:
PHP код:
SELECT COUNT(*) FROM kills_and_deaths WHERE victim = %d
Or even:
PHP код:
SELECT victimweaponcount(*) from kills_and_deaths where victim = %d group by victimweapon 
To produce a list of how many times the player was killed by different weapons.


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

Quote:
Originally Posted by Vince
Посмотреть сообщение
Thrice so far in a three week timespan. Though I do have to mention that it involves a development server currently running 0.3.7 RC2 which isn't frequently populated. The crashes seem to happen quite randomly and only when the gamemode changes. I run the Mini-Missions server so the gamemode does change frequently.

The events prior to that last crash:
Код:
[12:55:45]   Loading gamemode...
[12:55:45]   [mysql] gamemode@127.0.0.1:3306 with database "minimissions" - connecting ...
[12:55:45]   [mysql] connected - id: 3
[12:55:45] Number of vehicle models: 0
[02:20:15] Incoming connection: ***:61969 id: 0
[02:22:00] Incoming connection: ***:62564 id: 0
[02:22:02] [join] iRolex has joined the server (0:***)
[02:22:40] [part] iRolex has left the server (0:0)
[02:23:20] Incoming connection: ***:61773 id: 0
[02:23:21] [join] iRolex has joined the server (0:***)
[02:27:25]   [info] driver.amx - now loading mission 4 ...
[02:27:25]   [info] driver.amx - also added 5 missions to queue.

[02:27:25]   [mysql] closed - id: 3
When the gamemode starts a connection is opened and when it ends the connection is closed again. Two other connections in two different filterscripts (admin system and the "driver") are kept open all the time.
I assume you are using R39-2, right?


Re: [REL] MySQL Plugin (Now on github!) - Vince - 09.03.2015

Yes.


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

What operating system is your SA-MP server running on (Ubuntu 12.04 i386, Fedora 21 x86_64, ...)?


Re: [REL] MySQL Plugin (Now on github!) - Vince - 09.03.2015

Linux debian7 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u1 i686 GNU/Linux


Re: [REL] MySQL Plugin (Now on github!) - Kar - 09.03.2015

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
How frequent are those segfaults? Do you remember changing anything that could have led to these crashes?
Any ideas? https://sampforum.blast.hk/showthread.php?tid=489120


Re: [REL] MySQL Plugin (Now on github!) - dugi - 09.03.2015

Quote:
Originally Posted by SiripIkan
Посмотреть сообщение
Does anyone have a compiled R39-3 MySQL plugin for Ubuntu?

Would be grateful if someone could share/compile it..
R39-3 binaries compiled on debian 7 32 bit:
https://dugi.pl/mysql.so
https://dugi.pl/mysql_static.so

Both work on Ubuntu 12.04.1 LTS


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

Quote:
Originally Posted by Kar
Посмотреть сообщение
No, this isn't caused by that bug. The stacktrace shows, that it crashes in the kernel's "write" function, which is used to send network data.

@Vince: You aren't the first one reporting this, and for some reason this bug occurs really rarely and I never managed to fix it completely. But you can try this version I just made, maybe it'll fix the crashes:
mysql-r39-2s-linux.zip (compiled on Debian 7 i686)


Re: [REL] MySQL Plugin (Now on github!) - Vince - 09.03.2015

Okay thanks, I'm testing it. Will report back if the issue arises again.


Re: [REL] MySQL Plugin (Now on github!) - SilentReader - 10.03.2015

Quote:
Originally Posted by dugi
Посмотреть сообщение
R39-3 binaries compiled on debian 7 32 bit:
https://dugi.pl/mysql.so
https://dugi.pl/mysql_static.so

Both work on Ubuntu 12.04.1 LTS
Ah finally.. thank you so much


Re: [REL] MySQL Plugin (Now on github!) - Juliusz - 10.03.2015

I can't download this.
Repair this fast


Re: [REL] MySQL Plugin (Now on github!) - Vince - 13.03.2015

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
No, this isn't caused by that bug. The stacktrace shows, that it crashes in the kernel's "write" function, which is used to send network data.

@Vince: You aren't the first one reporting this, and for some reason this bug occurs really rarely and I never managed to fix it completely. But you can try this version I just made, maybe it'll fix the crashes:
mysql-r39-2s-linux.zip (compiled on Debian 7 i686)
Sorry, but it actually seems like that made it even worse. It still crashes at __kernel_vsyscal. Can it be related to the connection being idle for a while?


Re: [REL] MySQL Plugin (Now on github!) - Evocator - 14.03.2015

Hi, i need a bit of help.
I'm using the callback OnQueryError and checking if its CR_SERVER_GONE_ERROR, to lock the server and avoid trouble. But the problem is that we lost connection with the database, but the server was kept on.

Errors: http://pastebin.com/fvBNWfQc
Script:
Code:
public OnQueryError(errorid, error[], callback[], qquery[], connectionHandle)
{
	switch (errorid)
	{
		case CR_SERVER_GONE_ERROR:
		{
			printf(">>>>>>>>>>>>>>>>>>>> Lost connection to MYSQL, trying reconnect...");
			mysql_reconnect(connectionHandle);

			if (mysql_errno() != 0)
   			{
				//lock the server
			}
			else
			{
				//unlock it
			}

		}
	}
	return 1;
}