forked from qt-creator/qt-creator
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:
@@ -45,10 +45,11 @@ namespace Sqlite {
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
template<int ResultCount>
|
||||
template<int ResultCount, int BindParameterCount>
|
||||
class ReadStatement;
|
||||
template<int BindParameterCount>
|
||||
class WriteStatement;
|
||||
template<int ResultCount>
|
||||
template<int ResultCount, int BindParameterCount>
|
||||
class ReadWriteStatement;
|
||||
|
||||
class SQLITE_EXPORT Database final : public TransactionInterface, public DatabaseInterface
|
||||
@@ -59,11 +60,12 @@ class SQLITE_EXPORT Database final : public TransactionInterface, public Databas
|
||||
|
||||
public:
|
||||
using MutexType = std::mutex;
|
||||
template<int ResultCount>
|
||||
using ReadStatement = Sqlite::ReadStatement<ResultCount>;
|
||||
using WriteStatement = Sqlite::WriteStatement;
|
||||
template<int ResultCount = 0>
|
||||
using ReadWriteStatement = Sqlite::ReadWriteStatement<ResultCount>;
|
||||
template<int ResultCount, int BindParameterCount = 0>
|
||||
using ReadStatement = Sqlite::ReadStatement<ResultCount, BindParameterCount>;
|
||||
template<int BindParameterCount>
|
||||
using WriteStatement = Sqlite::WriteStatement<BindParameterCount>;
|
||||
template<int ResultCount = 0, int BindParameterCount = 0>
|
||||
using ReadWriteStatement = Sqlite::ReadWriteStatement<ResultCount, BindParameterCount>;
|
||||
using BusyHandler = DatabaseBackend::BusyHandler;
|
||||
|
||||
Database();
|
||||
|
||||
Reference in New Issue
Block a user