Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
PreparedStatement.h
Go to the documentation of this file.
1// Copyright 2024 libsese
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
19
20#pragma once
21
22#include <sese/db/ResultSet.h>
23#include <sese/db/Metadata.h>
25#include <sese/util/ErrorCode.h>
26
27namespace sese::db {
28
31 public:
32 using Ptr = std::unique_ptr<PreparedStatement>;
33
34 virtual ~PreparedStatement() noexcept = default;
35
39 virtual ResultSet::Ptr executeQuery() noexcept = 0;
43 virtual int64_t executeUpdate() noexcept = 0;
44
49 virtual bool setDouble(uint32_t index, const double &value) noexcept = 0;
54 virtual bool setFloat(uint32_t index, const float &value) noexcept = 0;
59 virtual bool setInteger(uint32_t index, const int32_t &value) noexcept = 0;
64 virtual bool setLong(uint32_t index, const int64_t &value) noexcept = 0;
69 virtual bool setText(uint32_t index, const char *value) noexcept = 0;
73 virtual bool setNull(uint32_t index) noexcept = 0;
78 virtual bool setDateTime(uint32_t index, const sese::DateTime &value) noexcept = 0;
83 virtual bool getColumnType(uint32_t index, MetadataType &type) noexcept = 0;
87 virtual int64_t getColumnSize(uint32_t index) noexcept = 0;
88
91 [[nodiscard]] virtual int getLastError() const noexcept = 0;
92
96 [[nodiscard]] virtual const char *getLastErrorMessage() const noexcept = 0;
97
100 }
101 };
102}// namespace sese::db