Explicitly =delete; Statement::bindNoCopy(..., std::string&&) (#469)

Rvalues are inherently unsuitable for no-copy binding, because their
lifetime cannot be guaranteed. Separately declare, and delete, all
overloads of bindNoCopy() that take a std::string rvalue.
This commit is contained in:
Sébastien Rombauts 2024-08-15 19:21:09 +02:00 committed by GitHub
commit c6032d8a7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,6 +178,11 @@ public:
* @warning 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 void* apValue, const int aSize);
/**
* @brief Deleted, because the value's lifetime could not be guaranteed. Use bind().
*/
void bindNoCopy(const int aIndex, std::string&& aValue) = delete;
/**
* @brief Bind a NULL value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*
@ -271,6 +276,10 @@ public:
{
bindNoCopy(getIndex(apName), apValue, aSize);
}
/**
* @brief Deleted, because the value's lifetime could not be guaranteed. Use bind().
*/
void bindNoCopy(const char* apName, std::string&& aValue) = delete;
/**
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*
@ -368,6 +377,10 @@ public:
{
bindNoCopy(aName.c_str(), apValue, aSize);
}
/**
* @brief Deleted, because the value's lifetime could not be guaranteed. Use bind().
*/
void bindNoCopy(const std::string& aName, std::string&& aValue) = delete;
/**
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*