forked from lix-project/lix
SQLiteStmt: Use std::string_view
This commit is contained in:
parent
3b489e8843
commit
7a9687ba30
|
@ -95,10 +95,10 @@ SQLiteStmt::Use::~Use()
|
||||||
sqlite3_reset(stmt);
|
sqlite3_reset(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteStmt::Use & SQLiteStmt::Use::operator () (const std::string & value, bool notNull)
|
SQLiteStmt::Use & SQLiteStmt::Use::operator () (std::string_view value, bool notNull)
|
||||||
{
|
{
|
||||||
if (notNull) {
|
if (notNull) {
|
||||||
if (sqlite3_bind_text(stmt, curArg++, value.c_str(), -1, SQLITE_TRANSIENT) != SQLITE_OK)
|
if (sqlite3_bind_text(stmt, curArg++, value.data(), -1, SQLITE_TRANSIENT) != SQLITE_OK)
|
||||||
throwSQLiteError(stmt.db, "binding argument");
|
throwSQLiteError(stmt.db, "binding argument");
|
||||||
} else
|
} else
|
||||||
bind();
|
bind();
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct SQLiteStmt
|
||||||
~Use();
|
~Use();
|
||||||
|
|
||||||
/* Bind the next parameter. */
|
/* Bind the next parameter. */
|
||||||
Use & operator () (const std::string & value, bool notNull = true);
|
Use & operator () (std::string_view value, bool notNull = true);
|
||||||
Use & operator () (const unsigned char * data, size_t len, bool notNull = true);
|
Use & operator () (const unsigned char * data, size_t len, bool notNull = true);
|
||||||
Use & operator () (int64_t value, bool notNull = true);
|
Use & operator () (int64_t value, bool notNull = true);
|
||||||
Use & bind(); // null
|
Use & bind(); // null
|
||||||
|
|
Loading…
Reference in a new issue