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

Rvalues are inherently unsuitable for no-copy binding, because their lifetime cannot be guarnateed.
Separately declare, and delete, all overloads of bindNoCopy() that take a std::string rvalue.
This commit is contained in:
Marcel Ebmer 2024-06-18 19:04:37 +02:00
parent bcb4c78fed
commit 94c74ed931

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)
*