diff --git a/dlls/sqlite/sqlitepp/SqliteDriver.cpp b/dlls/sqlite/sqlitepp/SqliteDriver.cpp index a65a5ea6..b49447ba 100644 --- a/dlls/sqlite/sqlitepp/SqliteDriver.cpp +++ b/dlls/sqlite/sqlitepp/SqliteDriver.cpp @@ -7,6 +7,10 @@ #if defined WIN32 #define snprintf _snprintf #define strncasecmp strnicmp +#define WINDOWS_LEAN_AND_MEAN +#include +#else +#include #endif using namespace SourceMod; @@ -21,6 +25,17 @@ const char *SqliteDriver::NameString() return "sqlite"; } +int busy_handler(void *unused1, int unused2) +{ +#if defined __linux__ + usleep(100000); +#else + Sleep(100); +#endif + + return 1; +} + IDatabase *SqliteDriver::Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) { sqlite3 *pSql; @@ -38,7 +53,9 @@ IDatabase *SqliteDriver::Connect(DatabaseInfo *info, int *errcode, char *error, sqlite3_close(pSql); return NULL; } else { + sqlite3_busy_handler(pSql, busy_handler, NULL); SqliteDatabase *pDb = new SqliteDatabase(pSql, this); return static_cast(pDb); } } +