Dmitigr Pgfe  1.1beta
The modern C++ API to PostgreSQL
sql_string.hpp
1 // -*- C++ -*-
2 // Copyright (C) Dmitry Igrishin
3 // For conditions of distribution and use, see files LICENSE.txt or pgfe.hpp
4 
5 #ifndef DMITIGR_PGFE_SQL_STRING_HPP
6 #define DMITIGR_PGFE_SQL_STRING_HPP
7 
8 #include "dmitigr/pgfe/basics.hpp"
9 #include "dmitigr/pgfe/parameterizable.hpp"
10 #include "dmitigr/pgfe/internal/dll.hxx"
11 
12 #include <memory>
13 #include <string>
14 
15 namespace dmitigr::pgfe {
16 
39 class Sql_string : public Parameterizable {
40 public:
43 
55  static DMITIGR_PGFE_API std::unique_ptr<Sql_string> APIENTRY make(const std::string& input);
56 
60  virtual std::unique_ptr<Sql_string> clone() const = 0;
61 
63 
67  virtual bool is_empty() const = 0;
68 
73  virtual bool is_query_empty() const = 0;
74 
90  virtual bool is_parameter_missing(std::size_t index) const = 0;
91 
98  virtual bool has_missing_parameters() const = 0;
99 
114  virtual void append(const Sql_string* appendix) = 0;
115 
119  virtual void append(const std::string& appendix) = 0;
120 
136  virtual void replace_parameter(const std::string& name, const Sql_string* replacement) = 0;
137 
141  virtual void replace_parameter(const std::string& name, const std::string& replacement) = 0;
142 
146  virtual std::string to_string() const = 0;
147 
151  virtual std::string to_query_string() const = 0;
152 
242  virtual Composite* extra() = 0;
243 
247  virtual const Composite* extra() const = 0;
248 
249 private:
250  friend detail::iSql_string;
251 
252  Sql_string() = default;
253 };
254 
255 } // namespace dmitigr::pgfe
256 
257 #endif // DMITIGR_PGFE_SQL_STRING_HPP
virtual std::unique_ptr< Sql_string > clone() const =0
virtual bool is_parameter_missing(std::size_t index) const =0
Public API.
Definition: array_conversions.hpp:12
virtual bool is_query_empty() const =0
virtual bool has_missing_parameters() const =0
Represents an abstraction of a composite type.
Definition: composite.hpp:25
Represents preparsed SQL strings.
Definition: sql_string.hpp:39
Represents an interface of parameterizable types.
Definition: parameterizable.hpp:22
virtual std::string to_query_string() const =0
virtual void replace_parameter(const std::string &name, const Sql_string *replacement)=0
Replaces the parameter named by the name with the specified sql_string.
static DMITIGR_PGFE_API std::unique_ptr< Sql_string > APIENTRY make(const std::string &input)
Constructs the new sql string.
virtual bool is_empty() const =0
virtual void append(const Sql_string *appendix)=0
Appends the specified SQL string to this instance.
virtual Composite * extra()=0
virtual std::string to_string() const =0