diff options
Diffstat (limited to 'src/dal/mysqldataprovider.cpp')
-rw-r--r-- | src/dal/mysqldataprovider.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/dal/mysqldataprovider.cpp b/src/dal/mysqldataprovider.cpp index d297c95b..c1f45731 100644 --- a/src/dal/mysqldataprovider.cpp +++ b/src/dal/mysqldataprovider.cpp @@ -216,6 +216,9 @@ void MySqlDataProvider::disconnect() // deinitialize the MySQL client library. mysql_library_end(); + // Clean potential active binds + cleanBinds(); + mDb = 0; mIsConnected = false; } @@ -372,11 +375,7 @@ bool MySqlDataProvider::prepareSql(const std::string &sql) LOG_DEBUG("MySqlDataProvider::prepareSql Preparing SQL statement: " << sql); - if (mBind) - { - delete[] mBind; - mBind = 0; - } + cleanBinds(); if (mysql_stmt_prepare(mStmt, sql.c_str(), sql.size()) != 0) return false; @@ -520,4 +519,13 @@ void MySqlDataProvider::bindValue(int place, MYSQL_BIND* bind) "Attempted bind index out of range"); } +void MySqlDataProvider::cleanBinds() +{ + if (mBind) + { + delete[] mBind; + mBind = 0; + } +} + } // namespace dal |