Skip to content

Commit 807485c

Browse files
Add more queries to debugging logs
1 parent fb0945a commit 807485c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/CMySQLResult.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const char *CMySQLResult::GetFieldName(unsigned int idx)
1414
}
1515
else
1616
{
17-
CLog::Get()->LogFunction(LOG_WARNING, "CMySQLResult::GetFieldName", "invalid field index ('%d')", idx);
17+
CLog::Get()->LogFunction(LOG_WARNING, "CMySQLResult::GetFieldName", "invalid field index ('%d') (Query: \"%s\")", idx, m_Query.c_str());
1818
return NULL;
1919
}
2020
}
@@ -45,13 +45,13 @@ const char *CMySQLResult::GetRowDataByName(unsigned int row, const char *field)
4545
{
4646
if(row >= m_Rows || m_Fields == 0)
4747
{
48-
CLog::Get()->LogFunction(LOG_ERROR, "CMySQLResult::GetRowDataByName()", "invalid row index ('%d')", row);
48+
CLog::Get()->LogFunction(LOG_ERROR, "CMySQLResult::GetRowDataByName()", "invalid row index ('%d') (Query: \"%s\")", row, m_Query.c_str());
4949
return NULL;
5050
}
5151

5252
if(field == NULL)
5353
{
54-
CLog::Get()->LogFunction(LOG_ERROR, "CMySQLResult::GetRowDataByName()", "empty field name specified");
54+
CLog::Get()->LogFunction(LOG_ERROR, "CMySQLResult::GetRowDataByName()", "empty field name specified (Query: \"%s\")", m_Query.c_str());
5555
return NULL;
5656
}
5757

@@ -70,7 +70,7 @@ const char *CMySQLResult::GetRowDataByName(unsigned int row, const char *field)
7070
return m_Data[row][i];
7171
}
7272
}
73-
CLog::Get()->LogFunction(LOG_WARNING, "CMySQLResult::GetRowDataByName", "field not found (\"%s\")", field);
73+
CLog::Get()->LogFunction(LOG_WARNING, "CMySQLResult::GetRowDataByName", "field not found (\"%s\") (Query: \"%s\")", field, m_Query.c_str());
7474
return NULL;
7575
}
7676

src/CScripting.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ AMX_DECLARE_NATIVE(Native::mysql_pquery)
855855
return ERROR_INVALID_CONNECTION_HANDLE("mysql_pquery", connection_id);
856856

857857
if (cb_format != NULL && strlen(cb_format) != ((params[0] / 4) - ConstParamCount))
858-
return CLog::Get()->LogFunction(LOG_ERROR, "mysql_pquery", "callback parameter count does not match format specifier length");
858+
return CLog::Get()->LogFunction(LOG_ERROR, "mysql_pquery", "callback parameter count does not match format specifier length (Query: \"%s\")", query_str ? query_str : "");
859859

860860

861861
CMySQLHandle *Handle = CMySQLHandle::GetHandle(connection_id);
@@ -898,7 +898,7 @@ AMX_DECLARE_NATIVE(Native::mysql_tquery)
898898
return ERROR_INVALID_CONNECTION_HANDLE("mysql_tquery", connection_id);
899899

900900
if (cb_format != NULL && strlen(cb_format) != ((params[0] / 4) - ConstParamCount))
901-
return CLog::Get()->LogFunction(LOG_ERROR, "mysql_tquery", "callback parameter count does not match format specifier length (Query: \"%s\")", query_str);
901+
return CLog::Get()->LogFunction(LOG_ERROR, "mysql_tquery", "callback parameter count does not match format specifier length (Query: \"%s\")", query_str ? query_str : "");
902902

903903

904904
CMySQLHandle *Handle = CMySQLHandle::GetHandle(connection_id);
@@ -1338,8 +1338,6 @@ AMX_DECLARE_NATIVE(Native::mysql_errno)
13381338
ERROR_INVALID_CONNECTION_HANDLE("mysql_errno", connection_id);
13391339
return -1; //don't return 0 since it means that there are no errors
13401340
}
1341-
1342-
13431341
return static_cast<cell>(mysql_errno(CMySQLHandle::GetHandle(connection_id)->GetMainConnection()->GetMysqlPtr()));
13441342
}
13451343

0 commit comments

Comments
 (0)