[BUG] 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [BUG] MySql Plugin (Now on github!) (
/showthread.php?tid=536003)
[BUG] MySql Plugin (Now on github!) -
FloxX - 06.09.2014
Excuse me , i want load some my data with function mysql_tquery, but the callback doesn't called. Here's my code:
Код:
public OnFilterScriptInit()
{
print( "> Connecting to MySQL server..." );
sqlconn = mysql_connect( "127.0.0.1", "root", "samp", "thepassistrue" );
ManualVehicleEngineAndLights();
mysql_tquery( sqlconn, "SELECT * FROM `prices`;", "CarPriceLoadInit" );
return 1;
}
forward CarPriceLoadInit();
public CarPriceLoadInit()
{
new tmp[16];
print("Loading Car Prices data.....");
for( new i = 0; i < cache_get_row_count( sqlconn ); i++ ) {
cache_get_field_content( i, "model", tmp, sqlconn ); VehInfo[i][Model] = strval(tmp);
cache_get_field_content( i, "type", tmp, sqlconn ); VehInfo[i][Type] = strval(tmp);
cache_get_field_content( i, "name", VehInfo[i][Name], sqlconn, 64 );
cache_get_field_content( i, "price", tmp, sqlconn ); VehInfo[i][Price][0] = strval(tmp);
}
printf("|- %d Car Prices loaded from database. -|", cache_get_row_count( sqlconn ));
return 1;
}
And here's the log: (from mysql_log.txt)
Код:
[23:01:24] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `prices`;", callback: "CarPriceLoadInit", format: "(null)"
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - starting query execution
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - query was successfully executed within 0.580 milliseconds
[23:01:24] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:01:24] [DEBUG] Calling callback "CarPriceLoadInit"..
[23:01:24] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
And this one from server_log.txt:
Код:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3z-R4, ©2005-2014 SA-MP Team
[23:02:09]
[23:02:09] Server Plugins
[23:02:09] --------------
[23:02:09] Loading plugin: streamer
[23:02:09] Loaded.
[23:02:09] Loading plugin: sscanf
[23:02:09]
[23:02:09] ===============================
[23:02:09] sscanf plugin loaded.
[23:02:09] Version: 2.8.1
[23:02:09] © 2012 Alex "******" Cole
[23:02:09] ===============================
[23:02:09] Loaded.
[23:02:09] Loading plugin: mysql
[23:02:09] >> plugin.mysql: R39-2 successfully loaded.
[23:02:09] Loaded.
[23:02:09] Loaded 3 plugins.
[23:02:09]
[23:02:09] Filterscripts
[23:02:09] ---------------
[23:02:09] Loading filterscript 'ls_mall.amx'...
[23:02:09] Loading filterscript 'ls_elevator.amx'...
[23:02:09] Loading filterscript 'VehSys.amx'...
[23:02:09]
[23:02:09] > Connecting to MySQL server...
[23:02:09] Loaded 3 filterscripts.
[23:02:09] Loaded 3 vehicles from: vehicles/trains.txt
[23:02:09] Loaded 3 vehicles from: vehicles/pilots.txt
[23:02:09] Loaded 15 vehicles from: vehicles/lv_law.txt
[23:02:09] Loaded 39 vehicles from: vehicles/lv_airport.txt
[23:02:09] Loaded 255 vehicles from: vehicles/lv_gen.txt
[23:02:09] Loaded 38 vehicles from: vehicles/sf_law.txt
[23:02:09] Loaded 35 vehicles from: vehicles/sf_airport.txt
[23:02:09] Loaded 353 vehicles from: vehicles/sf_gen.txt
[23:02:09] Loaded 24 vehicles from: vehicles/ls_law.txt
[23:02:09] Loaded 37 vehicles from: vehicles/ls_airport.txt
[23:02:09] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt
[23:02:09] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt
[23:02:09] Loaded 71 vehicles from: vehicles/whetstone.txt
[23:02:09] Loaded 168 vehicles from: vehicles/bone.txt
[23:02:09] Loaded 61 vehicles from: vehicles/flint.txt
[23:02:09] Loaded 96 vehicles from: vehicles/tierra.txt
[23:02:09] Loaded 96 vehicles from: vehicles/red_county.txt
[23:02:09] Total vehicles from files: 1781
[23:02:09]
---------------------------------------
[23:02:09] Running Grand Larceny - by the SA-MP team
[23:02:09] ---------------------------------------
[23:02:09] Number of vehicle models: 173
[23:02:10]
Thanks sorry for my bad english speak
Re: [BUG] MySql Plugin (Now on github!) -
WopsS - 06.09.2014
Tip: Please put that after
mysql_connect and see if it is connected to database or not.
pawn Код:
if(sqlconn && mysql_errno(sqlconn) == 0)
print("Connection to database was established!");
else
print("Connection to database failed!");
Edit: I try to find the problem. But I can't, on my PC it work.
Edit #2: I reproduced your problem.
This isn't a MySQL Bug, it is a function which is defined already in another FS of GM. Change name of your callback or find it in other filterscripts or gamemode and includes.