matador::basic_dialect Class Referenceabstract

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.
 

Detailed Description

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.

Member Enumeration Documentation

◆ t_compile_type

Enum representing the compile type.

Enumerator
PREPARED 

Compile type for prepared statements

DIRECT 

Compile type for direct execute statements

Constructor & Destructor Documentation

◆ basic_dialect()

matador::basic_dialect::basic_dialect ( detail::basic_dialect_compiler *  compiler,
detail::basic_dialect_linker *  linker 
)
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

Parameters
compilerThe dialect compiler object
linkerThe dialect linker object

Member Function Documentation

◆ direct()

std::string matador::basic_dialect::direct ( const sql &  s)

Build a sql statement for direct execution.

Parameters
sThe sql object to be compiled and linked
Returns
The sql string for direct execution

◆ escape_quotes_in_identifier()

void matador::basic_dialect::escape_quotes_in_identifier ( std::string &  str)

Escape identifier quotes inside identifiers.

Parameters
strIdentifier to be escaped

◆ escape_quotes_in_literals()

void matador::basic_dialect::escape_quotes_in_literals ( std::string &  str) const

Escape quotes in string literals

Parameters
strString literal to be escaped

◆ identifier_closing_quote()

char matador::basic_dialect::identifier_closing_quote ( ) const

Return the identifier closing quote

Returns
Identifier closing quote.

◆ identifier_escape_type()

virtual dialect_traits::identifier matador::basic_dialect::identifier_escape_type ( ) const
pure virtual

Returns how the identifier quotes should be escaped.

Returns
How the identifier quotes should be escaped

◆ identifier_opening_quote()

char matador::basic_dialect::identifier_opening_quote ( ) const

Return the identifier opening quote

Returns
Identifier opening quote.

◆ next_placeholder()

virtual std::string matador::basic_dialect::next_placeholder ( ) const
virtual

Generates a next placeholder string. default is questionmark '?'

Returns
Placeholder string

◆ prepare()

detail::statement_context matador::basic_dialect::prepare ( const sql &  s)

Build a sql statement as a prepared statement.

Parameters
sThe sql object to be compiled and linked
Returns
The sql string as a prepared statement

◆ prepare_identifier()

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

Parameters
strThe identifier string to be prepared
Returns
The prepared string

◆ prepare_literal()

std::string matador::basic_dialect::prepare_literal ( const std::string &  str) const

Prepare string literal

Parameters
strString literal to be prepared

◆ quote_identifier()

void matador::basic_dialect::quote_identifier ( std::string &  str)

Wrap identifier quotes around a sql identifier keyword

Parameters
strIdentifier to put quotes around

◆ token_at()

std::string matador::basic_dialect::token_at ( detail::token::t_token  tok) const

Return database specific sql token

Parameters
tokRequested token
Returns
Database specific sql token

The documentation for this class was generated from the following file:
  • matador/sql/basic_dialect.hpp