09.05.2015, 11:59
Hey there! I have one small problem with my query for saving businesses.
When OnGamemodeInit gets called, it loads all businesses and everything works perfectly. But when OnGamemodeExit gets called, it tries to save the businesses and the server crashes.
Here is my saving function:
Am I doing something wrong in those formats?
Oh, and here's the mysql log:
It looks like database disconnects before the queries are over and I have no idea is it suppose to be like that.
Thank you!
When OnGamemodeInit gets called, it loads all businesses and everything works perfectly. But when OnGamemodeExit gets called, it tries to save the businesses and the server crashes.
Here is my saving function:
pawn Код:
SaveBusinesses()
{
new query[256];
for(new i; i < MAX_BIZ; i++)
{
if(BizInfo[i][Created] == false)
continue;
mysql_format(mysql, query, sizeof(query), "UPDATE `businesses` SET `Type`='%d', `Owner`='%e', `Name`='%e', `Locked`='%d', `X`='%.2f' WHERE `ID`='%d'",\
BizInfo[i][Type], BizInfo[i][Owner], BizInfo[i][Name], BizInfo[i][Locked], BizInfo[i][Position][0], BizInfo[i][ID]);
mysql_tquery(mysql, query, "", "");
mysql_format(mysql, query, sizeof(query), "UPDATE `businesses` SET `Y`='%.2f', `Z`='%.2f', `Price`='%d' WHERE `ID`='%d'",\
BizInfo[i][Position][1], BizInfo[i][Position][2], BizInfo[i][Price], BizInfo[i][ID]);
mysql_tquery(mysql, query, "", "");
}
return 1;
}
Oh, and here's the mysql log:
pawn Код:
[13:54:21] [DEBUG] mysql_format - connection: 1, len: 256, format: "UPDATE `businesses` SET `Type`='%d', `Owner`='%e', `Name`='%e', `Locked`='%d', `X`='%.2f' WHERE `ID`='%d'"
[13:54:21] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `businesses` SET `Type`='0', `Owner`='The State', `Name`=", callback: "(null)", format: "(null)"
[13:54:21] [DEBUG] mysql_format - connection: 1, len: 256, format: "UPDATE `businesses` SET `Y`='%.2f', `Z`='%.2f', `Price`='%d' WHERE `ID`='%d'"
[13:54:21] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `businesses` SET `Y`='-1722.94', `Z`='13.54', `Price`='42", callback: "(null)", format: "(null)"
[13:54:21] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[13:54:21] [DEBUG] CMySQLConnection::Disconnect - connection was closed
[13:54:21] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 39.945 milliseconds
[13:54:21] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
Thank you!