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)



AW: [REL] MySQL Plugin (****** Project) - Mellnik - 27.06.2013

Thank you.


Re: [REL] MySQL Plugin (****** Project) - kurta999 - 29.06.2013

Please add cache_errno() because I have command which I can run query from game, and with this it was very easy to check that the query was successful or not.


Re: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Is there still the bug where you cannot load data into multidimensional arrays with cache_get_field_content?


Re: [REL] MySQL Plugin (****** Project) - IstuntmanI - 29.06.2013

Quote:
Originally Posted by GiamPy.
View Post
Is there still the bug where you cannot load strings into multidimensional arrays with cache_get_field_content?
It's not a bug with the MySQL Plugin, but with pawno (sort of). You should set manually the max_len in the cache_get_field_content if you use an array.


Re: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by IstuntmanI
View Post
It's not a bug with the MySQL Plugin, but with pawno (sort of). You should set manually the max_len in the cache_get_field_content if you use an array.
Thank you, appreciated. It was a pain in the ass using cache_get_row, mainly because when I had to add new columns in the database I'd had to modify all the columns IDs.


Re: [REL] MySQL Plugin (****** Project) - AndreT - 29.06.2013

Or you could of just have put them into the end of your field list in the query and not have to change every single index


Re: [REL] MySQL Plugin (****** Project) - VendenTTa - 29.06.2013

Hello,
my english is not good to say it first.
R6 your script using mysql.
r7 it to want to upgrade, but mysql_query undef ... I get the error.

r6 way I use

Code:
  format(string, sizeof(string), "SELECT * FROM `hesaplar` WHERE `isim` = '%s'", GetPlayerNameEx(playerid));
		mysql_query(string);
		mysql_store_result();
and

Code:
public OyuncuKaydetInt(playerid, sutun[], deger)
{
    new string[128];
	format(string, sizeof(string), "UPDATE `hesaplar` SET `%s` = '%d' WHERE `isim` = '%s'", sutun, deger, GetPlayerNameEx(playerid));
    mysql_query(string);
}
Can you give it to the style of the translated script r7.


Re: [REL] MySQL Plugin (****** Project) - IstuntmanI - 29.06.2013

In R7 (I suggest you to update to R26) non-threaded queries compatibility has been removed, you have to use cache + thread. In R26 you have mysql_tquery.

Here's a tutorial for R7: https://sampforum.blast.hk/showthread.php?tid=337810


Re: [REL] MySQL Plugin (****** Project) - IstuntmanI - 29.06.2013

I've never seen the point of using mysql_close ... try without it.


Re: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by IstuntmanI
View Post
I've never seen the point of using mysql_close ... try without it.
I used to not use it like months ago but it fucked up the server once I had to restart it.
Like, a shitload of bugs that you cannot imagine, obviously related to MySQL.

Quote:
Originally Posted by RealCop228
View Post
I see that mysql_close() isn't at the bottom of your OnGameModeExit(). Try putting it at the bottom and giving it another go.
It still persists.


AW: [REL] MySQL Plugin (****** Project) - maddinat0r - 29.06.2013

Hm, I couldn't reproduce your crash with sending the "exit" command, but I caused another crash under unnormal circumstances where I called "mysql_close" directly after calling all "mysql_function_query" functions and then fetching the result after the connection was closed. Maybe you are doing this?


Re: AW: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by Pain123
View Post
Hm, I couldn't reproduce your crash with sending the "exit" command, but I caused another crash under unnormal circumstances where I called "mysql_close" directly after calling all "mysql_function_query" functions and then fetching the result after the connection was closed. Maybe you are doing this?
Nope.

I am just closing the server after all the big loading at the beginning is done, not earlier.


AW: [REL] MySQL Plugin (****** Project) - maddinat0r - 29.06.2013

Could you create a small gamemode where you execute 10-20 queries, wait a bit and then close the server with the "exit" command and also calling mysql_close in OnGameModeExit? I don't know if this is a problem with the plugin, your gamemode or your MySQL server.

EDIT: Are you using Linux or Windows?


Re: AW: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by Pain123
View Post
Could you create a small gamemode where you execute 10-20 queries, wait a bit and then close the server with the "exit" command and also calling mysql_close in OnGameModeExit? I don't know if this is a problem with the plugin, your gamemode or your MySQL server.

EDIT: Are you using Linux or Windows?
Windows.

pawn Code:
public OnGameModeInit()
{
    new connection = mysql_connect("localhost", "root", "server", "");
   
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(1, 2)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(3, 4)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(5, 6)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(7, 8)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(9, 10)", false, "", "");

    mysql_function_query(connection, "UPDATE `testing` SET `testingcol1` = 1, `testingcol2` = 2 WHERE test = 1", false, "", "");
    mysql_function_query(connection, "UPDATE `testing` SET `testingcol1` = 1, `testingcol2` = 2 WHERE test = 3", false, "", "");
    mysql_function_query(connection, "UPDATE `testing` SET `testingcol1` = 1, `testingcol2` = 2 WHERE test = 5", false, "", "");
   
    mysql_function_query(connection, "DELETE FROM `testing` WHERE test = 2", false, "", "");
    mysql_function_query(connection, "DELETE FROM `testing` WHERE test = 4", false, "", "");
   
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(456, 78945)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(687, 456489)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(6387, 657)", false, "", "");
   
    mysql_function_query(connection, "DELETE FROM `testing` WHERE testingcol1 > 750", false, "", "");
    mysql_function_query(connection, "DELETE FROM `testing` WHERE testingcol2 < 450", false, "", "");

    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(5, 6)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(7, 8)", false, "", "");
    mysql_function_query(connection, "INSERT INTO `testing` (testingcol1, testingcol2) VALUES(9, 10)", false, "", "");

    SetGameModeText("Blank Script");
    return 1;
}
Quote:

Console input: exit
[19:37:12] --- Server Shutting Down.
[19:37:12] NF 0
[19:37:12] NF 1
[19:37:12] NF 2
[19:37:12] NF 3
[19:37:12] NF 4
[19:37:12] plugin.mysql: Unloading plugin...
[19:37:12] [debug] Server crashed due to an unknown error
[19:37:12] [debug] Native backtrace:
[19:37:12] [debug] #0 71cda891 in ?? () from C:\Users\Administrator\Server\plugins\mysql.DLL
[19:37:12] [debug] #1 71cc36d0 in ?? () from C:\Users\Administrator\Server\plugins\mysql.DLL
[19:37:12] [debug] #2 71cd1093 in ?? () from C:\Users\Administrator\Server\plugins\mysql.DLL
[19:37:12] [debug] #3 004693bb in ?? () from C:\Users\Administrator\Server\samp-server.exe
[19:37:12] [debug] #4 00488b66 in ?? () from C:\Users\Administrator\Server\samp-server.exe




AW: [REL] MySQL Plugin (****** Project) - maddinat0r - 29.06.2013

Could you please try this version? http://www.solidfiles.com/d/397713a7d1/
It's a debug version, thus very very slow, but it should help me to find out more. There is also a .pdb file, copy it in the plugin folder AND in the root folder (where the samp-server.exe is). Then let it crash again and post the crashdetect results here.


Re: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

I have some issues with solidfiles, could you please use something else?


AW: [REL] MySQL Plugin (****** Project) - maddinat0r - 29.06.2013

https://code.******.com/p/sa-mp-mysq...27-win_dbg.rar


Re: AW: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by Pain123
View Post
Funny.

It didn't crash ahah.


AW: [REL] MySQL Plugin (****** Project) - maddinat0r - 29.06.2013

Very interesting..
Did you updated your libmysql.dll?
Could you also provide me a crashdump? http://www.solidfiles.com/d/2bebfcd366/
Download this package, extract it to your server root directory (where the samp-server.exe is). Then edit the file paths in the start.bat file. Execute this bat file and you should get a .dmp file when the server crashes. Send me this file via PM. But do all of this with R26, not the one I gave you.


Re: [REL] MySQL Plugin (****** Project) - GiamPy. - 29.06.2013

Quote:
Originally Posted by Pain123
View Post
Did you updated your libmysql.dll?
I did with the one provided in ****** code.

Could you please use another file hosting?
For some reason solidfiles doesn't work for me.