Sqlite: Improve Sqlite wrapper

It is now possible to read values at once.

for (auto [name, value] : statement.tupleValues<String, int>(1000, "foo", 20))
   ....

Change-Id: I3d4bc5218810b4620e1df625126aa490f30bbc71
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-08-17 15:33:25 +02:00
parent 8617f497bc
commit 1a25b61576
24 changed files with 769 additions and 277 deletions

View File

@@ -38,7 +38,7 @@ class SQLITE_EXPORT SqlStatementBuilder
{
using BindingPair = std::pair<Utils::SmallString, Utils::SmallString>;
public:
SqlStatementBuilder(Utils::SmallString &&m_sqlTemplate);
SqlStatementBuilder(Utils::SmallStringView m_sqlTemplate);
void bindEmptyText(Utils::SmallString &&name);
void bind(Utils::SmallString &&name, Utils::SmallString &&text);
@@ -79,8 +79,8 @@ protected:
Q_NORETURN static void throwException(const char *whatHasHappened, const char *errorMessage);
private:
Utils::SmallString m_sqlTemplate;
mutable Utils::SmallString m_sqlStatement;
Utils::BasicSmallString<510> m_sqlTemplate;
mutable Utils::BasicSmallString<510> m_sqlStatement;
mutable std::vector<BindingPair> m_bindings;
};