Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
SqlitePreparedStatementImpl.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/util/Util.h>
25
26#include <set>
27
28namespace sese::db::impl {
29
32 public:
33 explicit SqlitePreparedStatementImpl(sqlite3_stmt *stmt, size_t count) noexcept;
34 ~SqlitePreparedStatementImpl() noexcept override;
35
36 ResultSet::Ptr executeQuery() noexcept override;
37 int64_t executeUpdate() noexcept override;
38 bool setDouble(uint32_t index, const double &value) noexcept override;
39 bool setFloat(uint32_t index, const float &value) noexcept override;
40 bool setLong(uint32_t index, const int64_t &value) noexcept override;
41 bool setInteger(uint32_t index, const int32_t &value) noexcept override;
42 bool setText(uint32_t index, const char *value) noexcept override;
43 bool setNull(uint32_t index) noexcept override;
44 bool setDateTime(uint32_t index, const sese::DateTime &value) noexcept override;
45
46 bool getColumnType(uint32_t index, MetadataType &type) noexcept override;
47 int64_t getColumnSize(uint32_t index) noexcept override;
48
49 [[nodiscard]] int getLastError() const noexcept override;
50 [[nodiscard]] const char *getLastErrorMessage() const noexcept override;
51
52 protected:
53 sqlite3_stmt *stmt;
54 bool stmtStatus = false;
55 bool *isManual;
56 size_t count = 0;
57 void **buffer;
58
59 static std::string splitBefore(const std::string &str);
60 static const char *INTEGER_AFFINITY_SET[];
61 static const char *TEXT_AFFINITY_SET[];
62 static const char *REAL_AFFINITY_SET[];
63 };
64
65}// namespace sese::db::impl