diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dal/mysqldataprovider.cpp | 18 | ||||
-rw-r--r-- | src/dal/mysqldataprovider.h | 3 |
2 files changed, 16 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 diff --git a/src/dal/mysqldataprovider.h b/src/dal/mysqldataprovider.h index 4850a146..a35d35e8 100644 --- a/src/dal/mysqldataprovider.h +++ b/src/dal/mysqldataprovider.h @@ -181,6 +181,9 @@ class MySqlDataProvider: public DataProvider */ void bindValue(int place, MYSQL_BIND* bind); + /** Clean potential binds */ + void cleanBinds(); + /** defines the name of the hostname config parameter */ static const std::string CFGPARAM_MYSQL_HOST; /** defines the name of the server port config parameter */ |