Sqlite: Introduce BindParameterCount template parameter

The BindParameterCount is checked at compile time and then again for
the construction of the statement. So we provide an early error instead of
an some error later or even stranger behavior.

Change-Id: I860ca1f78645c222ae1accf5c7a469c77befc3bd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2021-12-07 17:28:38 +01:00
parent 4e69b0a689
commit d4c6f06a63
22 changed files with 389 additions and 387 deletions

View File

@@ -26,10 +26,11 @@
#pragma once
#include <sqlitebasestatement.h>
class SqliteTestStatement : public Sqlite::StatementImplementation<Sqlite::BaseStatement, 1>
template<int ResultCount, int BindParameterCount = 0>
class SqliteTestStatement
: public Sqlite::StatementImplementation<Sqlite::BaseStatement, ResultCount, BindParameterCount>
{
using Base = Sqlite::StatementImplementation<Sqlite::BaseStatement, 1>;
using Base = Sqlite::StatementImplementation<Sqlite::BaseStatement, ResultCount, BindParameterCount>;
public:
explicit SqliteTestStatement(Utils::SmallStringView sqlStatement, Sqlite::Database &database)