PDA

View Full Version : MySQL Error


Leighton
13/08/2013, 06:42 AM
This part coloured in red is the error i receive after i run samp-server.exe

public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
printf("[sampgta] Query Error - (ErrorID: %d) (Handle: %d)", errorid, connectionHandle);
print("[sampgta] Check /logs/querydump.log to review the query that threw the error.");
SQL_Log(query, error);

if(errorid == 2013 || errorid == 2014 || errorid == 2006 || errorid == 2027 || errorid == 2055)
{
print("[sampgta] Connection Error Detected in Threaded Query");
//mysql_query(query, resultid, extraid, MainPipeline);
}
}


Here is the script which i'm not sure which i should change now?

// Custom Functions
// g_mysql_Init()
// Description: Called with Gamemode Init.
stock g_mysql_Init()
{
new SQL_HOST[64], SQL_DB[64], SQL_USER[32], SQL_PASS[128], iValue;
new SQL_SHOST[64], SQL_SDB[64], SQL_SUSER[32], SQL_SPASS[128];
new fileString[128], File: fileHandle = fopen("mysql.cfg", io_read);

while(fread(fileHandle, fileString, sizeof(fileString))) {
if(ini_GetValue(fileString, "HOST", SQL_HOST, sizeof(SQL_HOST))) continue;
if(ini_GetValue(fileString, "DB", SQL_DB, sizeof(SQL_DB))) continue;
if(ini_GetValue(fileString, "USER", SQL_USER, sizeof(SQL_USER))) continue;
if(ini_GetValue(fileString, "PASS", SQL_PASS, sizeof(SQL_PASS))) continue;
if(ini_GetValue(fileString, "SHOST", SQL_SHOST, sizeof(SQL_SHOST))) continue;
if(ini_GetValue(fileString, "SDB", SQL_SDB, sizeof(SQL_SDB))) continue;
if(ini_GetValue(fileString, "SUSER", SQL_SUSER, sizeof(SQL_SUSER))) continue;
if(ini_GetValue(fileString, "SPASS", SQL_SPASS, sizeof(SQL_SPASS))) continue;
if(ini_GetInt(fileString, "SERVER", servernumber)) continue;
if(ini_GetInt(fileString, "DEBUG", iValue)) continue;
}
fclose(fileHandle);

mysql_debug(iValue);
MainPipeline = mysql_connect("localhost", "root", "sampgta", "");
setproperty(.name = "pipeline", .value = MainPipeline);

printf("[sampgta] (Main Pipelines) Connecting to %s...", SQL_HOST);

if(mysql_ping(MainPipeline) == -1)
{
printf("[sampgta] (MainPipeline) Nhan duoc loi! Khong the connect voi MySQL: Host %s - DB: %s - User: %s", SQL_HOST, SQL_USER, SQL_DB);
print("[sampgta] Luu y: Hay chat chan rang ban da cung cap thong tin ket noi chinh xac.");
SendRconCommand("exit");
}
else
{
print("[sampgta] (MainPipeline) Connection successful toward MySQL Database Server!");
}

#if defined SHOPAUTOMATED
ShopPipeline = mysql_connect(SQL_SHOST, SQL_SUSER, SQL_SDB, SQL_SPASS);

printf("[sampgta] (Shop Pipelines) Connecting to %s...", SQL_SHOST);

if(mysql_ping(ShopPipeline) == -1)
{
printf("[sampgta] (ShopPipeline) Nhan duoc loi! Khong the connect voi MySQL: Host %s - DB: %s - User: %s", SQL_SHOST, SQL_SDB, SQL_SUSER);
print("[sampgta] Luu y: Hay chat chan rang ban da cung cap thong tin ket noi chinh xac.");
//SendRconCommand("exit");
}
else
{
print("[sampgta] (ShopPipeline) Da ket noi thanh cong voi MySQL Database Server!");
}
#endif

return 1;

What would you recommend changing? :picard:

Leighton
13/08/2013, 03:12 PM
Bump