#include <storage/GenericIterable.h>
Inheritance diagram for SSQLBuilder:
SQL APIs | |
Convenience functions for building SQL strings, and virtuals you can override to extend or modify its behavior. | |
status_t | BuildSQLString (SString *outSql, SValue *inoutArgs, const SString &dbname) const |
Convert an SValue query to a SQL query. | |
status_t | BuildSQLSubStrings (SString *outSelect, SString *outWhere, SString *outOrderBy, SValue *inoutArgs) const |
Lower-level version of BuildSQLQuery, to extract individual strings. | |
virtual SValue | CreateSQLFilter (const SValue &filter) const |
Override to convert a BV_ITERABLE_FILTER into the corresponding WHERE construct. | |
virtual void | MapSQLColumn (SValue *inoutColumn) const |
Override to map column names in the query arguments to other column(s) in the SQL string. | |
virtual void | MapSQLOrderColumn (SValue *inoutColumnName, SValue *inoutOrder) const |
Override to map column names in the "order by" argument to other column(s) in the SQL string. | |
Bookkeeping | |
Creation, destruction, etc. | |
SSQLBuilder () | |
virtual | ~SSQLBuilder () |
|
|
|
|
|
Convert an SValue query to a SQL query. Takes an SValue query (containing the mappings BV_ITERABLE_SELECT, BV_ITERABLE_FILTER, BV_ITERABLE_WHERE, and BV_ITERABLE_ORDER_BY) and generates the corresponding SQL query string.
|
|
Lower-level version of BuildSQLQuery, to extract individual strings.
|
|
Override to convert a BV_ITERABLE_FILTER into the corresponding WHERE construct. The default implementation simply returns B_UNDEFINED_VALUE, meaning the filters are not supported. You should override to return a BV_ITERABLE_WHERE SValue mapping to perform the appropriate query for your iterator. Reimplemented in BSchemaTableNode::QueryIterator, and BGenericIterable::GenericIterator. |
|
Override to map column names in the query arguments to other column(s) in the SQL string. The default implementation simply leaves inoutColumn as-is. You implement this to change the column name supplied by the client to a different column name to be used in the SQL query. If you change inoutColumn to B_NULL_VALUE, it will be silently ignored. If you change inoutColumn to an SValue containing a status code that error will be returned. Reimplemented in BGenericIterable::GenericIterator. |
|
Override to map column names in the "order by" argument to other column(s) in the SQL string. The input inoutColumnName is the column being sorted, and inoutOrder is how to sort (these correspond to {column_name->order} in BV_ITERABLE_ORDER_BY). The default implementation simply calls MapSQLColumn to change the name of inoutColumnName. You can use this for fine-grained control of how ordering happens for a column. To map the input columns to multiple columns in the SQL query, change inoutColumnName to a complex mapping of the same form as BV_ITERABLE_ORDER_BY. In that case, inoutOrder will be ignored. Like MapSQLColumn(), you can set inoutColumnName to B_NULL_VALUE or an error code to skip the column or return an error, respectively. Reimplemented in BSchemaTableNode, and BGenericIterable::GenericIterator. |