Abstract base class for a concrete sql dialect. More...
#include <basic_dialect.hpp>
Public Types | |
enum | t_compile_type { PREPARED , DIRECT } |
Enum representing the compile type. More... | |
Public Member Functions | |
std::string | direct (const sql &s) |
Build a sql statement for direct execution. | |
detail::statement_context | prepare (const sql &s) |
Build a sql statement as a prepared statement. | |
std::string | prepare_identifier (const std::string &str) |
std::string | prepare_literal (const std::string &str) const |
void | quote_identifier (std::string &str) |
void | escape_quotes_in_identifier (std::string &str) |
void | escape_quotes_in_literals (std::string &str) const |
virtual dialect_traits::identifier | identifier_escape_type () const =0 |
virtual std::string | next_placeholder () const |
char | identifier_opening_quote () const |
char | identifier_closing_quote () const |
std::string | token_at (detail::token::t_token tok) const |
Protected Member Functions | |
basic_dialect (detail::basic_dialect_compiler *compiler, detail::basic_dialect_linker *linker) | |
Creates a new dialect. | |
Abstract base class for a concrete sql dialect.
This class acts as an abstract base class for a concrete sql dialect.
It is used as the statement builder to build sql statement strings from a sql object.
The statement can be build for direct execution or for a prepared statement.
Internally it held a map of all sql dialect tokens which could eventually overwritten by the concrete dialect.
|
explicitprotected |
Creates a new dialect.
Creates a new dialect consisting of a dialect compiler and dialect linker class. Their are default implementations of these classes, but they could be overwritten by the concrete dialect impementation
compiler | The dialect compiler object |
linker | The dialect linker object |
std::string matador::basic_dialect::direct | ( | const sql & | s | ) |
Build a sql statement for direct execution.
s | The sql object to be compiled and linked |
void matador::basic_dialect::escape_quotes_in_identifier | ( | std::string & | str | ) |
Escape identifier quotes inside identifiers.
str | Identifier to be escaped |
void matador::basic_dialect::escape_quotes_in_literals | ( | std::string & | str | ) | const |
Escape quotes in string literals
str | String literal to be escaped |
char matador::basic_dialect::identifier_closing_quote | ( | ) | const |
Return the identifier closing quote
|
pure virtual |
Returns how the identifier quotes should be escaped.
char matador::basic_dialect::identifier_opening_quote | ( | ) | const |
Return the identifier opening quote
|
virtual |
Generates a next placeholder string. default is questionmark '?'
detail::statement_context matador::basic_dialect::prepare | ( | const sql & | s | ) |
Build a sql statement as a prepared statement.
s | The sql object to be compiled and linked |
std::string matador::basic_dialect::prepare_identifier | ( | const std::string & | str | ) |
Prepare sql dialect identifier for execution and escape quotes and quote the identifier string
str | The identifier string to be prepared |
std::string matador::basic_dialect::prepare_literal | ( | const std::string & | str | ) | const |
Prepare string literal
str | String literal to be prepared |
void matador::basic_dialect::quote_identifier | ( | std::string & | str | ) |
Wrap identifier quotes around a sql identifier keyword
str | Identifier to put quotes around |
std::string matador::basic_dialect::token_at | ( | detail::token::t_token | tok | ) | const |
Return database specific sql token
tok | Requested token |