mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-06 18:56:40 -04:00
Set Statement move constractor to default; fix #347
This commit is contained in:
parent
6da299db12
commit
2800b65ac6
@ -54,7 +54,7 @@ public:
|
||||
* @param[in] aStmtPtr Shared pointer to the prepared SQLite Statement Object.
|
||||
* @param[in] aIndex Index of the column in the row of result, starting at 0
|
||||
*/
|
||||
Column(Statement::TStatementPtr& aStmtPtr, int aIndex) noexcept;
|
||||
explicit Column(Statement::TStatementPtr& aStmtPtr, int aIndex) noexcept;
|
||||
|
||||
// default destructor: the finalization will be done by the destructor of the last shared pointer
|
||||
// default copy constructor and assignment operator are perfectly suited :
|
||||
@ -246,7 +246,7 @@ public:
|
||||
*
|
||||
* @see getString
|
||||
*/
|
||||
operator std::string() const
|
||||
explicit operator std::string() const
|
||||
{
|
||||
return getString();
|
||||
}
|
||||
|
@ -79,7 +79,8 @@ public:
|
||||
*
|
||||
* @param[in] aStatement Statement to move
|
||||
*/
|
||||
Statement(Statement&& aStatement) noexcept;
|
||||
Statement(Statement&& aStatement) noexcept = default;
|
||||
Statement& operator=(Statement&& aStatement) noexcept = default;
|
||||
|
||||
// Statement is non-copyable
|
||||
Statement(const Statement&) = delete;
|
||||
|
@ -28,20 +28,6 @@ Statement::Statement(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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
@ -342,7 +328,7 @@ std::string Statement::getExpandedSQL() {
|
||||
Statement::TStatementPtr Statement::prepareStatement()
|
||||
{
|
||||
sqlite3_stmt* statement;
|
||||
const int ret = sqlite3_prepare_v2(mpSQLite, mQuery.c_str(), static_cast<int>(mQuery.size()), &statement, NULL);
|
||||
const int ret = sqlite3_prepare_v2(mpSQLite, mQuery.c_str(), static_cast<int>(mQuery.size()), &statement, nullptr);
|
||||
if (SQLITE_OK != ret)
|
||||
{
|
||||
throw SQLite::Exception(mpSQLite, ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user