mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Style cleanup on top of PR #86
This commit is contained in:
parent
9a07f3918d
commit
bcdbea2cf8
@ -68,15 +68,15 @@ public:
|
||||
*/
|
||||
Statement(Database& aDatabase, const std::string& aQuery);
|
||||
|
||||
// Require C++11
|
||||
#if ( __cplusplus>= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) )
|
||||
#define Statement_CAN_MOVE 1
|
||||
#if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1600) ) // C++11: Visual Studio 2010
|
||||
/**
|
||||
* @breif Move Constructor
|
||||
* @brief Move Constructor
|
||||
*
|
||||
* (Allows inserting into STL containers that may need to move memory when growing.)
|
||||
* Allows inserting into STL containers that may need to move memory when growing.
|
||||
*
|
||||
* @param aOther Statement to move to
|
||||
*/
|
||||
Statement(Statement &&other);
|
||||
Statement(Statement&& aOther);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -113,6 +113,7 @@ public:
|
||||
// This is under-optimized for static data (a static text define in code)
|
||||
// as well as for dynamic allocated buffer which could be transfer to sqlite
|
||||
// instead of being copied.
|
||||
// => if you now what you are doing, use bindNoCopy()
|
||||
|
||||
/**
|
||||
* @brief Bind an int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||
@ -140,7 +141,7 @@ public:
|
||||
/**
|
||||
* @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||
*
|
||||
* @note This uses the SQLITE_STATIC flag, NOT making a copy of the data. It must exist while executing the statement.
|
||||
* @note This uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||
*/
|
||||
void bindNoCopy(const int aIndex, const std::string& aValue);
|
||||
|
||||
|
@ -43,15 +43,15 @@ Statement::Statement(Database &aDatabase, const std::string& aQuery) :
|
||||
mColumnCount = sqlite3_column_count(mStmtPtr);
|
||||
}
|
||||
|
||||
#ifdef Statement_CAN_MOVE
|
||||
#if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1600) ) // C++11: Visual Studio 2010
|
||||
// Move Constructor
|
||||
Statement::Statement(Statement &&other):
|
||||
mQuery(std::move(other.mQuery)),
|
||||
mStmtPtr(other.mStmtPtr),
|
||||
mColumnCount(other.mColumnCount),
|
||||
mColumnNames(std::move(other.mColumnNames)),
|
||||
mbOk(other.mbOk),
|
||||
mbDone(other.mbDone)
|
||||
Statement::Statement(Statement&& aOther):
|
||||
mQuery(std::move(aOther.mQuery)),
|
||||
mStmtPtr(aOther.mStmtPtr), // TODO: need a move operator
|
||||
mColumnCount(aOther.mColumnCount),
|
||||
mColumnNames(std::move(aOther.mColumnNames)),
|
||||
mbOk(aOther.mbOk),
|
||||
mbDone(aOther.mbDone)
|
||||
{
|
||||
// other.mStmtPtr = nullptr; // doesn't support reassigning
|
||||
other.mColumnCount = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user