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:
@@ -29,16 +29,18 @@
|
||||
|
||||
namespace Sqlite {
|
||||
|
||||
template<int ResultCount>
|
||||
class ReadStatement final : protected StatementImplementation<BaseStatement, ResultCount>
|
||||
template<int ResultCount, int BindParameterCount = 0>
|
||||
class ReadStatement final
|
||||
: protected StatementImplementation<BaseStatement, ResultCount, BindParameterCount>
|
||||
{
|
||||
using Base = StatementImplementation<BaseStatement, ResultCount>;
|
||||
using Base = StatementImplementation<BaseStatement, ResultCount, BindParameterCount>;
|
||||
|
||||
public:
|
||||
ReadStatement(Utils::SmallStringView sqlStatement, Database &database)
|
||||
: Base{sqlStatement, database}
|
||||
{
|
||||
checkIsReadOnlyStatement();
|
||||
Base::checkBindingParameterCount(BindParameterCount);
|
||||
Base::checkColumnCount(ResultCount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user