forked from qt-creator/qt-creator
Sqlite: Add variadic bind and write functions
You can now write
SqliteWriteStatement statement("UPDATE test SET name=?, number=?
WHERE rowid=?", database);
statement.write("see", 7.23, 1);
and
SqliteWriteStatement statement("UPDATE test SET name=@name, number=@number
WHERE rowid=@id", database);
statement.writeNamed("@name", "see", "@number", 7.23, "@id", 1);
This is more type safe than using variants and performant too.
Change-Id: Ie1ed2a6d326b956be5c4ec056214f3f5b1531f45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -33,13 +33,17 @@ struct sqlite3;
|
||||
|
||||
namespace Sqlite {
|
||||
|
||||
class SqliteDatabase;
|
||||
|
||||
class SQLITE_EXPORT SqliteDatabaseBackend
|
||||
{
|
||||
public:
|
||||
|
||||
SqliteDatabaseBackend();
|
||||
SqliteDatabaseBackend(SqliteDatabase &database);
|
||||
~SqliteDatabaseBackend();
|
||||
|
||||
SqliteDatabaseBackend(const SqliteDatabase &database) = delete;
|
||||
SqliteDatabase &operator=(const SqliteDatabase &database) = delete;
|
||||
|
||||
void setMmapSize(qint64 defaultSize, qint64 maximumSize);
|
||||
void activateMultiThreading();
|
||||
void activateLogging();
|
||||
@@ -59,8 +63,6 @@ public:
|
||||
void setTextEncoding(TextEncoding textEncoding);
|
||||
TextEncoding textEncoding();
|
||||
|
||||
|
||||
|
||||
Utils::SmallStringVector columnNames(Utils::SmallStringView tableName);
|
||||
|
||||
int changesCount();
|
||||
@@ -105,6 +107,7 @@ protected:
|
||||
Q_NORETURN void throwException(const char *whatHasHappens) const;
|
||||
|
||||
private:
|
||||
SqliteDatabase &m_database;
|
||||
sqlite3 *m_databaseHandle;
|
||||
TextEncoding m_cachedTextEncoding;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user