1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Update Data.cpp

Make callback processing more robust
This commit is contained in:
Sandu Liviu Catalin 2021-02-09 15:21:26 +02:00
parent c9dbd38255
commit b897cde9e5

View File

@ -427,15 +427,18 @@ static void Register_POCO_Data_Binding(HSQUIRRELVM vm, Table & ns, const SQChar
}
// ------------------------------------------------------------------------------------------------
static void ProcessPocoData(SQInteger ms)
static void ProcessPocoData()
{
// Go over all statement results and try to update them
for (SqDataStatementResult * inst = SqDataStatementResult::sHead; inst && inst->mNext != SqDataStatementResult::sHead; inst = inst->mNext)
{
if (inst->mRes.tryWait(static_cast< long >(ms)))
if (inst->mRes.available())
{
// Forward the callback with the result
inst->mFunc(inst->mStmt, inst->mRes.data());
if (!inst->mFunc.IsNull())
{
inst->mFunc.Execute(inst->mStmt, inst->mRes.data());
}
// Stop processing this result
inst->UnchainInstance();
// Release script resources