This class represents a wrapper around a (reference-counted) pointer to a Dv::Sql::boolexp. More...
#include <select_exp.h>
Public Member Functions | |
SelectExp (const boolexp *e) | |
Constructor. | |
const boolexp & | exp () const |
Return underlying Dv::Sql::boolexp. | |
std::ostream & | print (std::ostream &os, const Dv::Sql::Db &db) const |
Print the expression in sql format. | |
const Dv::Sql::Table::Set & | tables () const |
The set of tables involved in this expression. | |
std::string | from () const |
Return "from" clause corresponding to this expression. | |
std::string | where (const Dv::Sql::Db &db) const |
Return where clause corresponding to this epression. | |
std::string | query (const Dv::Sql::Table::Ref &table, const std::string &rest="") const |
Return a complete select statement corresponding to this expression and a table. | |
std::string | from_where (Dv::Sql::Db &db, const std::string &rest="") const |
Return "from .. where .. " part of an sql select statement corresponding to this expression. | |
Static Public Member Functions | |
static SelectExp | true_exp () |
Return "true" SelectExp. | |
Private Attributes | |
Dv::shared_ptr< const boolexp > | exp_ |
This class represents a wrapper around a (reference-counted) pointer to a Dv::Sql::boolexp.
Dv::Sql::Table::Column col1; Dv::Sql::Table::Column col2; int i; std::string s; Dv::Sql::SelectExp exp( col1 > i && col2 == s );
Definition at line 356 of file select_exp.h.
Dv::Sql::SelectExp::SelectExp | ( | const boolexp * | e | ) | [inline] |
Constructor.
It simply wraps a (reference-counted) pointer to an expression.
e | pointer to expression to be wrapped |
Definition at line 362 of file select_exp.h.
const boolexp& Dv::Sql::SelectExp::exp | ( | ) | const [inline] |
Return underlying Dv::Sql::boolexp.
Definition at line 367 of file select_exp.h.
References exp_.
Referenced by Dv::Sql::complex_boolexp::complex_boolexp().
std::ostream& Dv::Sql::SelectExp::print | ( | std::ostream & | os, | |
const Dv::Sql::Db & | db | |||
) | const |
Print the expression in sql format.
os | stream to print on | |
db | to use for escaping string values |
const Dv::Sql::Table::Set& Dv::Sql::SelectExp::tables | ( | ) | const [inline] |
The set of tables involved in this expression.
Definition at line 379 of file select_exp.h.
References exp_.
std::string Dv::Sql::SelectExp::from | ( | ) | const [inline] |
Return "from" clause corresponding to this expression.
from table_1 , table_2 , .. , table_n
table_1
, .. , table_n
are the names of the tables mentioned in the expression. Definition at line 391 of file select_exp.h.
References exp_.
std::string Dv::Sql::SelectExp::where | ( | const Dv::Sql::Db & | db | ) | const [inline] |
Return where clause corresponding to this epression.
db | database connection (needed for DBMS-dependent escape for string values). |
where condition
condition
is generated by Dv::Sql::boolexp::print. Definition at line 403 of file select_exp.h.
References exp_.
std::string Dv::Sql::SelectExp::query | ( | const Dv::Sql::Table::Ref & | table, | |
const std::string & | rest = "" | |||
) | const [inline] |
Return a complete select statement corresponding to this expression and a table.
The statement retrieves all columns (using "select distinct") of the table.
table | for which the columns need to be retrieved | |
rest | optional suffix for the statement. |
Definition at line 417 of file select_exp.h.
References exp_.
std::string Dv::Sql::SelectExp::from_where | ( | Dv::Sql::Db & | db, | |
const std::string & | rest = "" | |||
) | const [inline] |
Return "from .. where .. " part of an sql select statement corresponding to this expression.
db | database connection (needed for DBMS-dependent escape for string values). | |
rest | optional suffix to append to the generated string. |
Customer::Row cust; ... Dv::Sql::SelectExp e = acct_cust.match_target(cust) && acct_cust.match() && trans_acct.match(); Dv::Sql::Object total(db, "select sum(transaction.amount) as total" + e.from_where(db));
Definition at line 444 of file select_exp.h.
References exp_.
static SelectExp Dv::Sql::SelectExp::true_exp | ( | ) | [static] |
Dv::shared_ptr<const boolexp> Dv::Sql::SelectExp::exp_ [private] |
Definition at line 456 of file select_exp.h.
Referenced by exp(), from(), from_where(), query(), tables(), and where().
dvmysql-1.0.3 | [17 November, 2010] |