diff --git a/include/SQLiteCpp/Statement.h b/include/SQLiteCpp/Statement.h index b467cf4a..c81e215d 100644 --- a/include/SQLiteCpp/Statement.h +++ b/include/SQLiteCpp/Statement.h @@ -79,7 +79,7 @@ class Statement * * @param[in] aStatement Statement to move */ - Statement(Statement&& aStatement) noexcept = default; + Statement(Statement&& aStatement) noexcept; Statement& operator=(Statement&& aStatement) noexcept = default; // Statement is non-copyable diff --git a/src/Statement.cpp b/src/Statement.cpp index 677cf895..64e16d2d 100644 --- a/src/Statement.cpp +++ b/src/Statement.cpp @@ -28,6 +28,21 @@ Statement::Statement(const Database& aDatabase, const char* apQuery) : mColumnCount = sqlite3_column_count(mpPreparedStatement.get()); } +Statement::Statement(Statement&& aStatement) noexcept : + mQuery(std::move(aStatement.mQuery)), + mpSQLite(aStatement.mpSQLite), + mpPreparedStatement(std::move(aStatement.mpPreparedStatement)), + mColumnCount(aStatement.mColumnCount), + mbHasRow(aStatement.mbHasRow), + mbDone(aStatement.mbDone), + mColumnNames(std::move(aStatement.mColumnNames)) +{ + aStatement.mpSQLite = nullptr; + aStatement.mColumnCount = 0; + aStatement.mbHasRow = false; + aStatement.mbDone = false; +} + // Reset the statement to make it ready for a new execution (see also #clearBindings() bellow) void Statement::reset() {