#ifdef __WXDEBUG__
extern wxList TablesInUse;
+ extern wxCriticalSection csTablesInUse;
#endif
// SQL Log defaults to be used by GetDbConnection
wxASSERT(nTables == 0);
#ifdef __WXDEBUG__
- wxTablesInUse *tiu;
- wxList::compatibility_iterator pNode;
- pNode = TablesInUse.GetFirst();
- wxString s,s2;
- while (pNode)
{
- tiu = (wxTablesInUse *)pNode->GetData();
- if (tiu->pDb == this)
+ wxCriticalSectionLocker lock(csTablesInUse);
+ wxTablesInUse *tiu;
+ wxList::compatibility_iterator pNode;
+ pNode = TablesInUse.GetFirst();
+ wxString s,s2;
+ while (pNode)
{
- s.Printf(wxT("(%-20s) tableID:[%6lu] pDb:[%p]"),
- tiu->tableName, tiu->tableID, wx_static_cast(void*, tiu->pDb));
- s2.Printf(wxT("Orphaned table found using pDb:[%p]"), wx_static_cast(void*, this));
- wxLogDebug(s.c_str(),s2.c_str());
+ tiu = (wxTablesInUse *)pNode->GetData();
+ if (tiu->pDb == this)
+ {
+ s.Printf(wxT("(%-20s) tableID:[%6lu] pDb:[%p]"),
+ tiu->tableName, tiu->tableID, wx_static_cast(void*, tiu->pDb));
+ s2.Printf(wxT("Orphaned table found using pDb:[%p]"), wx_static_cast(void*, this));
+ wxLogDebug(s.c_str(),s2.c_str());
+ }
+ pNode = pNode->GetNext();
}
- pNode = pNode->GetNext();
}
#endif
return false;
}
- pColInf[colNum].sqlDataType = Sqllen;
switch (Sqllen)
{
#if wxUSE_UNICODE
#ifdef __WXDEBUG__
wxList TablesInUse;
+ wxCriticalSection csTablesInUse;
#endif
tableInUse->tableName = tblName;
tableInUse->tableID = tableID;
tableInUse->pDb = pDb;
- TablesInUse.Append(tableInUse);
+ {
+ wxCriticalSectionLocker lock(csTablesInUse);
+ TablesInUse.Append(tableInUse);
+ }
#endif
pDb->WriteSqlLog(s);
bool found = false;
wxList::compatibility_iterator pNode;
- pNode = TablesInUse.GetFirst();
- while (pNode && !found)
{
- if (((wxTablesInUse *)pNode->GetData())->tableID == tableID)
+ wxCriticalSectionLocker lock(csTablesInUse);
+ pNode = TablesInUse.GetFirst();
+ while (!found && pNode)
{
- found = true;
- delete (wxTablesInUse *)pNode->GetData();
- TablesInUse.Erase(pNode);
+ if (((wxTablesInUse *)pNode->GetData())->tableID == tableID)
+ {
+ found = true;
+ delete (wxTablesInUse *)pNode->GetData();
+ TablesInUse.Erase(pNode);
+ }
+ else
+ pNode = pNode->GetNext();
}
- else
- pNode = pNode->GetNext();
}
if (!found)
{