Dynamic SQL select request builder. More...
#include <selectBuilder.hpp>
Public Member Functions | |
virtual | ~SelectBuilder () |
SelectBuilder & | distinct () |
anch::sql::FieldsBuilder | field (const std::string &column) |
anch::sql::FieldsBuilder | groupBy (const std::string &column) |
anch::sql::FieldsBuilder | orderBy (const std::string &column) |
SelectBuilder & | having (anch::sql::ClausesBuilder &clauses) |
SelectBuilder & | unionOnce (SelectBuilder &other) |
SelectBuilder & | unionAll (SelectBuilder &other) |
SelectBuilder & | offset (int64_t offset) |
SelectBuilder & | fetch (uint64_t limit) |
SelectBuilder & | windowByRowNumber (const std::string &alias, const std::string &rowColumn, const std::string &order, uint32_t min, uint32_t max) |
SelectBuilder & | windowByRank (const std::string &alias, const std::string &rowColumn, const std::string &order, uint32_t min, uint32_t max) |
anch::sql::SQLQuery | build () |
Friends | |
SelectBuilder | anch::sql::select () |
std::ostream & | operator<< (std::ostream &stream, const SelectBuilder &builder) |
Dynamic SQL select request builder.
Dynamic SQL select request builder
|
virtual |
SelectBuilder destructor
anch::sql::SQLQuery anch::sql::SelectBuilder::build | ( | ) |
Build SQL query
SelectBuilder & anch::sql::SelectBuilder::distinct | ( | ) |
Add DISTINCT
command
this
SelectBuilder & anch::sql::SelectBuilder::fetch | ( | uint64_t | limit | ) |
Add FETCH FIRST n ROWS ONLY
limit | the limit value |
this
anch::sql::FieldsBuilder anch::sql::SelectBuilder::field | ( | const std::string & | column | ) |
Intialize a new fields builder
anch::sql::FieldsBuilder anch::sql::SelectBuilder::groupBy | ( | const std::string & | column | ) |
Add SQL GROUP BY
command
column | the first column to group by |
SelectBuilder & anch::sql::SelectBuilder::having | ( | anch::sql::ClausesBuilder & | clauses | ) |
Add SQL HAVING
command and its clauses if not empty
clauses | the clauses |
this
SelectBuilder & anch::sql::SelectBuilder::offset | ( | int64_t | offset | ) |
Add OFFSET n ROWS
offset | the offset value |
this
anch::sql::FieldsBuilder anch::sql::SelectBuilder::orderBy | ( | const std::string & | column | ) |
Add SQL ORDER BY
command
column | the first column to group by |
SelectBuilder & anch::sql::SelectBuilder::unionAll | ( | SelectBuilder & | other | ) |
Add UNION
to other SQL request
other | the other SQL request |
this
SelectBuilder & anch::sql::SelectBuilder::unionOnce | ( | SelectBuilder & | other | ) |
Add UNION
to other SQL request
other | the other SQL request |
this
SelectBuilder & anch::sql::SelectBuilder::windowByRank | ( | const std::string & | alias, |
const std::string & | rowColumn, | ||
const std::string & | order, | ||
uint32_t | min, | ||
uint32_t | max ) |
Modify current query to add apply rank
window function as define in SQL:2003 standard.
alias | the current query table alias |
rowColumn | the row column alias |
order | the ORDER instruction |
min | the minimum row number value |
max | the maximum row number value |
this
SelectBuilder & anch::sql::SelectBuilder::windowByRowNumber | ( | const std::string & | alias, |
const std::string & | rowColumn, | ||
const std::string & | order, | ||
uint32_t | min, | ||
uint32_t | max ) |
Modify current query to add apply row_number
window function as define in SQL:2003 standard.
alias | the current query table alias |
rowColumn | the row column alias |
order | the ORDER instruction |
min | the minimum row number value |
max | the maximum row number value |
this
|
friend |
SelectBuilder stream insertion operator
stream | the output stream |
builder | the SelectBuilder |