|
| query ()=default |
| Create a new query.
|
|
query & | create (const std::string &table_name) |
|
query & | create (const std::string &table_name, T obj) |
|
query & | create (const std::string &table_name, std::initializer_list< std::shared_ptr< column > > column_list) |
| Create a table with given name.
|
|
query & | drop (const std::string &table_name) |
|
template<class LocalType = T, typename = typename std::enable_if<!std::is_same<LocalType, row>::value>::type> |
query & | insert (const std::string &table_name) |
|
template<class LocalType = T, typename = typename std::enable_if<!std::is_same<LocalType, row>::value>::type> |
query & | insert (const std::string &table_name, T &obj) |
|
template<class LocalType = T, typename = typename std::enable_if<std::is_same<LocalType, row>::value>::type> |
query & | insert (const std::string &table_name, const std::initializer_list< std::string > &column_names) |
| Create an insert statement for given columns.
|
|
template<class LocalType = T, typename = typename std::enable_if<std::is_same<LocalType, row>::value>::type> |
query & | insert (const std::string &table_name, const std::vector< std::string > &column_names) |
| Create an insert statement for given columns.
|
|
template<class LocalType = T, typename = typename std::enable_if<std::is_same<LocalType, row>::value>::type> |
query & | values (const std::initializer_list< matador::any > &values) |
|
template<class LocalType = T, typename = typename std::enable_if<!std::is_same<LocalType, row>::value>::type> |
query & | select () |
|
query & | select (const std::initializer_list< std::string > &column_names) |
|
query & | select (const std::vector< std::string > &column_names) |
|
query & | select (matador::columns cols) |
| Creates a select statement with the given columns.
|
|
template<class Type > |
void | prepare_select_prototype (Type &, const std::shared_ptr< columns > &) |
|
void | prepare_select_prototype (row &obj, const std::shared_ptr< columns > &cols) |
|
template<class LocalType = T, typename = typename std::enable_if<!std::is_same<LocalType, row>::value>::type> |
query & | update (const std::string &table_name) |
|
template<class LocalType = T, typename = typename std::enable_if<!std::is_same<LocalType, row>::value>::type> |
query & | update (const std::string &table_name, T &obj) |
|
query & | update (const std::string &table_name, const std::initializer_list< std::pair< std::string, matador::any > > &column_values) |
|
query & | from (const std::string &table_name) |
| Specifies the from token of a query.
|
|
query & | from (detail::basic_query &q) |
| Specifies the from token of a query.
|
|
query & | remove (const std::string &table_name) |
|
template<class COND > |
query & | where (const COND &c) |
|
query & | order_by (const std::string &col) |
|
query & | asc () |
|
query & | desc () |
|
query & | limit (std::size_t l) |
|
query & | as (const std::string &alias) |
|
query & | group_by (const std::string &col) |
|
query & | column (const std::string &column, data_type type, size_t index) |
|
query & | reset (t_query_command query_command) |
| Resets the query.
|
|
result< T > | execute (connection &conn) |
|
statement< T > | prepare (connection &conn) |
|
| basic_query () |
|
void | reset_query (t_query_command query_command) |
|
std::string | str (bool prepared) |
|
std::string | str (connection &conn, bool prepared) |
|
const sql & | stmt () const |
|
std::string | tablename () const |
|
template<
class T = row>
class matador::query< T >
Creates a SQL query.
The query class represents a SQL query for any database provided by the backend driver libraries.
With this class at hand you can create
- create
- drop
- select
- insert
- update
- delete
statements. These statements can be created manually by adding each part of the statement by hand or you can create them using serializable based class or instances.
The class uses a chain mechanism. Each method representing a part of a query returns the reference to itself. So you can concatenate your query parts by calling the methods in a chain (concatenated by dots).