lintel 0.2.0
Loading...
Searching...
No Matches
PreparedStatement.h
Go to the documentation of this file.
1#ifndef LINTEL_POSTGRESQL_PREPAREDSTATEMENT_H
2#define LINTEL_POSTGRESQL_PREPAREDSTATEMENT_H
3
4#include <string_view>
5
6#include "Connection.h"
7
8namespace lintel {
9namespace postgresql {
19 {
20 private:
21 bool m_closed = false;
22 const Connection &m_connection;
23 const int32_t m_nParams;
24 const std::string m_statementName;
25 const std::string m_statement;
26
27 public:
33 static constexpr int32_t initNParams(std::string_view tempStatement)
34 {
35 int32_t count = 0;
36 for (const char c : tempStatement) {
37 if (c == '?') { ++count; }
38 }
39 return count;
40 }
41
47 static std::string initStatement(const std::string &tempStatement);
48
51 {
53 std::string name;
55 std::string statement;
56 };
57
64
82
88 std::shared_ptr<Result> execute(const std::vector<std::string> &params);
89
91 void close();
92 };
93}// namespace postgresql
94}// namespace lintel
95#endif// LINTEL_POSTGRESQL_PREPAREDSTATEMENT_H
Definition Connection.h:31
Definition PreparedStatement.h:19
static constexpr int32_t initNParams(std::string_view tempStatement)
Definition PreparedStatement.h:33
PreparedStatement(const Connection &connection, const Definition &definition)
static std::string initStatement(const std::string &tempStatement)
std::shared_ptr< Result > execute(const std::vector< std::string > &params)
Definition Result.h:16
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9
Definition PreparedStatement.h:51
std::string statement
Definition PreparedStatement.h:55
std::string name
Definition PreparedStatement.h:53