diff --git a/extensions/mysql/mysql/MyDatabase.cpp b/extensions/mysql/mysql/MyDatabase.cpp index 74825bfb..84f34537 100644 --- a/extensions/mysql/mysql/MyDatabase.cpp +++ b/extensions/mysql/mysql/MyDatabase.cpp @@ -101,6 +101,9 @@ MyDatabase::MyDatabase(MYSQL *mysql, const DatabaseInfo *info, bool persistent) m_Info.driver = NULL; m_Info.maxTimeout = info->maxTimeout; m_Info.port = info->port; + + // DBI, for historical reasons, guarantees an initial refcount of 1. + AddRef(); } MyDatabase::~MyDatabase() diff --git a/extensions/sqlite/driver/SqDatabase.cpp b/extensions/sqlite/driver/SqDatabase.cpp index 91811aa5..e0f13e80 100644 --- a/extensions/sqlite/driver/SqDatabase.cpp +++ b/extensions/sqlite/driver/SqDatabase.cpp @@ -36,6 +36,8 @@ SqDatabase::SqDatabase(sqlite3 *sq3, bool persistent) : m_sq3(sq3), m_Persistent(persistent) { + // DBI, for historical reasons, guarantees an initial refcount of 1. + AddRef(); } SqDatabase::~SqDatabase()