Fixed threaded queries not having an IQuery assignment

This commit is contained in:
David Anderson 2006-09-15 23:11:35 +00:00
parent 1f0778b14e
commit 57160763af
2 changed files with 10 additions and 6 deletions

View File

@ -377,7 +377,8 @@ static cell AMX_NATIVE_CALL SQL_FieldNumToName(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL SQL_GetQueryString(AMX *amx, cell *params)
{
AmxQueryInfo *qInfo = (AmxQueryInfo *)GetHandle(params[1], Handle_Query);
if (!qInfo)
if (!qInfo || !qInfo->pQuery)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid query handle: %d", params[1]);
return 0;

View File

@ -172,15 +172,13 @@ void MysqlThread::RunThread(IThreadHandle *pHandle)
if (m_qrInfo.query_success && m_qrInfo.amxinfo.info.rs)
{
m_atomicResult.CopyFrom(m_qrInfo.amxinfo.info.rs);
m_qrInfo.amxinfo.pQuery = NULL;
m_qrInfo.amxinfo.pQuery = pQuery;
m_qrInfo.amxinfo.info.rs = &m_atomicResult;
}
if (pQuery)
{
} else {
pQuery->FreeHandle();
pQuery = NULL;
}
if (pDatabase)
{
pDatabase->FreeHandle();
@ -248,6 +246,11 @@ void MysqlThread::Execute()
(cell)0,
data_addr,
m_datalen);
/* this should always be true I think */
if (m_qrInfo.amxinfo.pQuery)
{
m_qrInfo.amxinfo.pQuery->FreeHandle();
}
FreeHandle(hndl);
}
}