mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-05 02:06:02 -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);
|
Statement(Database& aDatabase, const std::string& aQuery);
|
||||||
|
|
||||||
// Require C++11
|
#if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1600) ) // C++11: Visual Studio 2010
|
||||||
#if ( __cplusplus>= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) )
|
|
||||||
#define Statement_CAN_MOVE 1
|
|
||||||
/**
|
/**
|
||||||
* @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
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,6 +113,7 @@ public:
|
|||||||
// This is under-optimized for static data (a static text define in code)
|
// 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
|
// as well as for dynamic allocated buffer which could be transfer to sqlite
|
||||||
// instead of being copied.
|
// 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)
|
* @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)
|
* @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);
|
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);
|
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
|
// Move Constructor
|
||||||
Statement::Statement(Statement &&other):
|
Statement::Statement(Statement&& aOther):
|
||||||
mQuery(std::move(other.mQuery)),
|
mQuery(std::move(aOther.mQuery)),
|
||||||
mStmtPtr(other.mStmtPtr),
|
mStmtPtr(aOther.mStmtPtr), // TODO: need a move operator
|
||||||
mColumnCount(other.mColumnCount),
|
mColumnCount(aOther.mColumnCount),
|
||||||
mColumnNames(std::move(other.mColumnNames)),
|
mColumnNames(std::move(aOther.mColumnNames)),
|
||||||
mbOk(other.mbOk),
|
mbOk(aOther.mbOk),
|
||||||
mbDone(other.mbDone)
|
mbDone(aOther.mbDone)
|
||||||
{
|
{
|
||||||
// other.mStmtPtr = nullptr; // doesn't support reassigning
|
// other.mStmtPtr = nullptr; // doesn't support reassigning
|
||||||
other.mColumnCount = 0;
|
other.mColumnCount = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user