lintel 0.2.0
Loading...
Searching...
No Matches
Statement.h
Go to the documentation of this file.
1#ifndef LINTEL_POSTGRESQL_STATEMENT_H
2#define LINTEL_POSTGRESQL_STATEMENT_H
3
4#include <string_view>
5
6#include "Connection.h"
7
8namespace lintel {
9namespace db {
10 class Statement;
11 class Cursor;
12}// namespace db
13
14namespace postgresql {
19 {
20 private:
21 const Connection &m_connection;
22
28 static constexpr int32_t initNParams(std::string_view tempStatement)
29 {
30 int32_t count = 0;
31 for (const char c : tempStatement) {
32 if (c == '?') { ++count; }
33 }
34 return count;
35 }
36
42 static std::string initStatement(const std::string &tempStatement);
43
44 friend class db::Statement;
45 friend class db::Cursor;
46
47 public:
52 explicit Statement(const Connection &connection);
53
59 std::shared_ptr<Result> execute(const std::string &query);
60
67 std::shared_ptr<Result> execute(const std::string &query, const std::vector<std::string> &params);
68 };
69}// namespace postgresql
70
71}// namespace lintel
72#endif// LINTEL_POSTGRESQL_STATEMENT_H
Definition Cursor.h:32
Definition Statement.h:17
Definition Connection.h:31
Definition Statement.h:19
Statement(const Connection &connection)
std::shared_ptr< Result > execute(const std::string &query)
std::shared_ptr< Result > execute(const std::string &query, const std::vector< std::string > &params)
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9