Clang: Fix reset for write and execute in the sqlite statement

We were not reset a statement if we got an exception. There are now test
for it.

Change-Id: Ife7b4437fece9369767605ba7387bd0564c1bb8d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-04-04 10:41:11 +02:00
parent 9d7225d283
commit 42ecd2ed3d
6 changed files with 52 additions and 14 deletions

View File

@@ -60,7 +60,6 @@ public:
bool next() const;
void step() const;
void execute() const;
void reset() const;
int fetchIntValue(int column) const;
@@ -159,6 +158,13 @@ class StatementImplementation : public BaseStatement
public:
using BaseStatement::BaseStatement;
void execute()
{
Resetter resetter{*this};
BaseStatement::next();
resetter.reset();
}
void bindValues()
{
}
@@ -172,8 +178,10 @@ public:
template<typename... ValueType>
void write(const ValueType&... values)
{
Resetter resetter{*this};
bindValuesByIndex(1, values...);
BaseStatement::execute();
BaseStatement::next();
resetter.reset();
}
template<typename... ValueType>
@@ -185,8 +193,10 @@ public:
template<typename... ValueType>
void writeNamed(const ValueType&... values)
{
Resetter resetter{*this};
bindValuesByName(values...);
BaseStatement::execute();
BaseStatement::next();
resetter.reset();
}
template <typename ResultType,