Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
PreparedStatement.h
浏览该文件的文档.
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
35 virtual ~PreparedStatement() noexcept = default;
36
40 virtual ResultSet::Ptr executeQuery() noexcept = 0;
44 virtual int64_t executeUpdate() noexcept = 0;
45
50 virtual bool setDouble(uint32_t index, const double &value) noexcept = 0;
55 virtual bool setFloat(uint32_t index, const float &value) noexcept = 0;
60 virtual bool setInteger(uint32_t index, const int32_t &value) noexcept = 0;
65 virtual bool setLong(uint32_t index, const int64_t &value) noexcept = 0;
70 virtual bool setText(uint32_t index, const char *value) noexcept = 0;
74 virtual bool setNull(uint32_t index) noexcept = 0;
79 virtual bool setDateTime(uint32_t index, const sese::DateTime &value) noexcept = 0;
84 virtual bool getColumnType(uint32_t index, MetadataType &type) noexcept = 0;
88 virtual int64_t getColumnSize(uint32_t index) noexcept = 0;
89
92 [[nodiscard]] virtual int getLastError() const noexcept = 0;
93
96 [[nodiscard]] virtual const char *getLastErrorMessage() const noexcept = 0;
97
100 }
101 };
102}// namespace sese::db