Module: DB Interface Module Group: Data Manipulation Classes
RWDBSelector RWDBSelectorBase
#include <rw/db/select.h> RWDBSelector select = myDbase.selector();
RWDBSelector is an encapsulation of an SQL SELECT statement. Its methods provide an application with explicit control over the SELECT statement's select list, as well as its FROM, WHERE, ORDER BY, and GROUP BY clauses. The set operators +, *, and - (union, intersection, and difference) may be applied to RWDBSelectors in order to achieve the semantics of the SQL UNION, INTERSECTION, and DIFFERENCE operations. See the entry for RWDBCompoundSelector. An RWDBSelector may be used to instantiate an RWDBExpr, so subqueries are also supported. See the entry for RWDBExpr.
The insertion operator << is used to add items to an RWDBSelector select list; the where() method is used to specify a WHERE clause. The items which are inserted into an RWDBSelector are RWDBExprs, which may be any combination of constants, column references, predefined functions, or RWDBSelectors combined by arithmetic or functional operators. The WHERE clause is encapsulated by an RWDBCriterion, which is some number of RWDBExprs combined with logical operators.
The result of an SQL SELECT statement is an SQL table expression. The DB Interface Module represents this concept as a ResultTable. Hence, the following are equivalent:
(1) RWDBReader rdr = selector.execute().table().reader(); (2) RWDBReader rdr = selector.reader();
RWDBSelector also derives from RWDBSelectorBase so that RWDBSelector and RWDBCompoundSelector may be handled in a uniform manner.
RWDBSelector is designed around the Interface/Implementation paradigm. An RWDBSelector instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBSelector implementation is a base class from which a family of database-specific selector implementations is derived.
Most RWDBSelector methods return a reference to self. This allows calls to be stacked, as in:
select.where(...).orderBy(...).groupBy(...), etc.
Assuming that dBase is a valid RWDBDatabase, we can encapsulate the SQL statement:
SELECT myTable.name, yourTable.city FROM myTable, yourTable WHERE myTable.key = yourTable.key
as follows:
RWDBTable myTable = dBase.table("myTable"); RWDBTable yourTable = dBase.table("yourTable"); RWDBSelector select = dBase.selector(); select << myTable["name"] << yourTable["city"]; select.where(myTable["key"] == yourTable["key"]);
Notice that it is not necessary to specify the FROM clause. The DB Interface Module deduces what tables to select from the column references in the select list; it generates a member of the FROM clause for each unique table reference. You can override this behavior by using the from(), fromGeneration(), and fromExtern() member functions
Assuming that the name and city columns mentioned above are strings, we would read the results of our query like this:
RWDBReader rdr = select.reader(); RWCString name; RWCString city; while(rdr()) { rdr >> name >> city; // process the name and city }
To introduce multiple instances of a table into an encapsulated SELECT statement, declare additional RWDBTable instances. The fragment:
SELECT a.name, b.type from myTable a, myTable b
can be captured as in the following example:
RWDBTable aTable = myDbase.table("myTable"); RWDBTable bTable = myDbase.table("myTable"); RWDBSelector select = myDbase.selector(); select << aTable["name"] << bTable["type"];
Note that the instantiations of aTable and bTable do not require database access, so this technique does not incur excessive overhead.
This example introduces the binding of application variables within a WHERE clause of a SELECT statement. This allows an application to repeatedly execute the RWDBSelector without clearing and constructing the WHERE clause each time. The following example uses an AutoParts table in the database, with text column name and integer column id:
RWDBTable partsTable = myDbase.table("AllParts"); RWDBConnection connection = myDbase.connection(); RWDBSelector select = myDbase.selector(); int id = 1001; select << partsTable["name"]; select.where( partsTable["id"] == RWDBBoundExpr(&id) ); RWDBReader reader = select.reader(connection); // process reader... id = 2001; reader = select.reader(connection); // process reader...
RWDBSelector();
The default constructor creates an RWDBSelector whose status is RWDBStatus::notInitialized. This constructor is provided as a convenience, for example, for declaring an array of RWDBSelectors. Usable RWDBSelectors are obtained from RWDBDatabase.
RWDBSelector(const RWDBSelector& select);
Copy constructor. The created object shares an implementation with select.
RWDBSelector& operator=(const RWDBSelector& select);
Assignment operator. Self shares an implementation with select. Returns a reference to self.
RWDBSelector& operator<<(RWDBValueManip& manip);
The insertion operator adds manip to self's select list. Returns a reference to self.
RWDBSelector& operator<<(const RWDBExpr& expr);
The insertion operator adds an item to self's select list. The supplied expr may be made up of constants, column references, predefined functions, or RWDBSelectors, combined with arithmetic or functional operators. See RWDBExpr. Returns a reference to self.
RWDBSelector& operator<<(const RWDBTable& table);
Use this method to specify SELECT * FROM table. Returns a reference to self.
RWDBColumn operator[](const RWCString& name) const;
Inherited from RWDBSelectorBase. Returns a deep copy of the first RWDBColumn in self's schema whose name matches the given name. The RWDBColumn returned is associated with self, that is, the table() method of the returned RWDBColumn returns this selector. If no matching column is found, returns an RWDBColumn whose status is RWDBStatus::ColumnNotFound. A deep copy is made so that applications can modify the returned RWDBColumn without modifying self's schema.
RWDBColumn operator[](size_t position) const;
Returns a deep copy of the RWDBColumn in self's schema whose position matches the given position. The RWDBColumn returned is associated with self. If no matching column is found, returns an RWDBColumn whose status is RWDBStatus::ColumnNotFound. A deep copy is made so that the application can modify the returned RWDBColumn without modifying self's schema.
enum FromGeneration { ExplicitOrImplicit, ExplicitAndImplicit };
A class-scoped enum presents different behaviors that can be used to compose the FROM clause. It is used in the fromGeneration() methods. Please refer to Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide for detailed information.
RWCString asString() const;
Inherited from RWDBSelectorBase. Returns the SQL equivalent of:
SELECT <column-list> FROM <from-list>
WHERE <where-clause> GROUP BY <groupby-list>
HAVING <having-clause> ORDER BY <orderby-list>
This method returns an SQL statement that would be produced by executing self with an implicit connection. This method however does not produce an implicit connection. It uses the time zone setting of the producer RWDBDatabase instance.
The behavior of this asString() method depends upon the RWDBDatabase::verboseAsString() setting in the producer RWDBDatabase instance.
If verboseAsString() is false, the SQL returned is the same as that passed to the database for execution. This is the default.
If verboseAsString() is true, any placeholders in the returned SQL are replaced with their bound values.
NOTE -- When the RWDBDatabase::verboseAsString() option is set to true, the SQL returned by this method may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling asString() with RWDBDatabase::verboseAsString() set to true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
RWCString asString(bool verbose) const;
Inherited from RWDBSelectorBase. Returns the SQL equivalent of:
SELECT <column-list> FROM <from-list>
WHERE <where-clause> GROUP BY <groupby-list>
HAVING <having-clause> ORDER BY <orderby-list>
This method returns an SQL statement that would be produced by executing self with an implicit connection. This method however does not produce an implicit connection. It uses the time zone setting of the producer RWDBDatabase instance.
The behavior of this method depends on the value of verbose, and is independent of the RWDBDatabase::verboseAsString() setting.
If verbose is false, the SQL returned is the same as that passed to the database for execution.
If verbose is true, any placeholders in the returned SQL are replaced with their bound values although the SQL passed to the database for execution will not be affected.
NOTE -- The SQL returned by this method when verbose is true may not be a valid SQL statement. However, this is not necessarily the same SQL sent to the database for execution. For example, if an RWDBBlob object is bound, calling asString(true) will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
RWCString asString(const RWDBConnection& conn) const;
Inherited from RWDBSelectorBase. Returns the SQL equivalent of:
SELECT <column-list> FROM <from-list>
WHERE <where-clause> GROUP BY <groupby-list>
HAVING <having-clause> ORDER BY <orderby-list>
This method returns an SQL statement that would be produced by executing self with conn. It uses the time zone setting of the RWDBConnection instance conn, which can be set programmatically with RWDBConnection::timeZone().
The behavior of this asString() method depends upon the RWDBDatabase::verboseAsString() setting in the producer RWDBDatabase instance.
If verboseAsString() is false, the SQL returned is the same as that passed to the database for execution. This is the default.
If verboseAsString() is true, any placeholders in the returned SQL are replaced with their bound values.
NOTE -- When the RWDBDatabase::verboseAsString() option is set to true, the SQL returned by this method may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling asString() with RWDBDatabase::verboseAsString() set to true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
RWCString asString(const RWDBConnection& conn, bool verbose) const;
Inherited from RWDBSelectorBase. Returns the SQL equivalent of:
SELECT <column-list> FROM <from-list>
WHERE <where-clause> GROUP BY <groupby-list>
HAVING <having-clause> ORDER BY <orderby-list>
This method returns an SQL statement that would be produced by executing self with conn. It uses the time zone setting of the RWDBConnection instance conn, which can be set programmatically with RWDBConnection::timeZone().
The behavior of this method depends on the value of verbose, and is independent of the RWDBDatabase::verboseAsString() setting.
If verbose is false, the SQL returned is the same as that passed to the database for execution.
If verbose is true, any placeholders in the returned SQL are replaced with their bound values although the SQL passed to the database for execution will not be affected.
NOTE -- The SQL returned by this method when verbose is true may not be a valid SQL statement. However, this is not necessarily the same SQL sent to the database for execution. For example, if an RWDBBlob object is bound, calling asString(true) will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
RWDBBulkReader bulkReader(const RWDBConnection& conn);
Returns an RWDBBulkReader able to read the result set associated with the rows of self. If self is a derived table, the RWDBBulkReader produced reads rows of the result set from execution of the SQL self represents. The RWDBBulkReader executes using the supplied connection.
RWDBStatus clear();
Clears self's clauses, selection lists, and internal controls.
RWDBColumn column(const RWCString& name) const;
Inherited from RWDBSelectorBase. Returns a deep copy of the first RWDBColumn in self's schema whose name matches the given name. The RWDBColumn returned is associated with self, that is, the table() method of the returned RWDBColumn returns this selector. If no matching column is found, returns an RWDBColumn whose status is RWDBStatus::columnNotFound. A deep copy is made so that applications can modify the returned RWDBColumn without modifying self's schema.
RWDBColumn column(const RWCString& name, RWCString::caseCompare casecompare);
Inherited from RWDBSelectorBase. Returns a deep copy of the first RWDBColumn in self's schema whose name matches the given name. The RWDBColumn returned is associated with self, that is, the table() method of the returned RWDBColumn returns this selector. If no matching column is found, returns an RWDBColumn whose status is RWDBStatus::columnNotFound. A deep copy is made so that applications can modify the returned RWDBColumn without modifying self's schema. The casecompare argument toggles case sensitivity when comparing column names. Valid arguments are RWCString::exact and RWCString::ignoreCase.
RWDBColumn column(size_t index) const;
Inherited from RWDBSelectorBase. Returns a deep copy of the RWDBColumn in self's schema at the given index. The RWDBColumn returned is associated with self, that is, the table() method of the returned RWDBColumn returns this selector. If index is out of range, returns an RWDBColumn with status RWDBStatus::invalidPosition. A deep copy is made so that applications can modify the returned RWDBColumn without modifying self's schema.
RWDBCursor cursor(RWDBCursor::CursorType type = RWDBCursor::Sequential, RWDBCursor::CursorAccess access = RWDBCursor::Read) const;
Inherited from RWDBSelectorBase. Produces an RWDBCursor for execution of the SQL select statement encapsulated by self. The cursor is created on a default database connection, using the type and access specifications provided. The connection is held by the RWDBCursor until the RWDBCursor is destroyed.
RWDBCursor cursor(const RWDBConnection& connection, RWDBCursor::CursorType type = RWDBCursor::Sequential, RWDBCursor::CursorAccess access = RWDBCursor::Read) const;
Inherited from RWDBSelectorBase. Produces an RWDBCursor for execution of the SQL statement encapsulated by self. The cursor is created on the supplied database connection, using the type and access specifications provided. The connection is held by the RWDBCursor until the RWDBCursor is destroyed. This function can behave asynchronously if executed using an asynchronous connection.
RWDBCursor cursor(const RWDBSchema& updateCols, RWDBCursor::CursorType type = RWDBCursor::Sequential, RWDBCursor::CursorAccess access = RWDBCursor::Read) const;
Inherited from RWDBSelectorBase. Produces an RWDBCursor for execution of the SQL select statement encapsulated by self. The argument updateCols is used in building a clause:
FOR UPDATE OF column-name, column-name,...
Some SQL dialects require this form. The cursor is created on a default database connection, using the type and access specifications provided. The connection is held by the RWDBCursor until the RWDBCursor is destroyed.
RWDBCursor cursor(const RWDBSchema& updateCols, const RWDBConnection& connection, RWDBCursor::CursorType type = RWDBCursor::Sequential, RWDBCursor::CursorAccess access = RWDBCursor::Read) const;
Inherited from RWDBSelectorBase. Produces an RWDBCursor for execution of the SQL statement encapsulated by self. The cursor is created on the supplied database connection, using the type and access specifications provided. The connection is held by the RWDBCursor until the RWDBCursor is destroyed. The argument updateCols is used in building a clause:
FOR UPDATE OF column-name, column-name,...
Some SQL dialects require this form. This function can behave asynchronously if executed using an asynchronous connection.
RWDBDatabase database();
Inherited from RWDBSelectorBase. Returns the RWDBDatabase that produced this selector. If there is no such object, for example, if this selector was created using the default constructor, returns an RWDBDatabase with a status of RWDBStatus::notInitialized.
RWDBCompoundSelector& difference(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector that represents the SQL selector:
select-stmt DIFFERENCE selector
where select-stmt is the SELECT statement represented by self.
RWDBSelector& distinct(bool Distinct = true);
By default, adds the DISTINCT SQL keyword to the select statement encapsulated by self. If Distinct is specified as false, removes the DISTINCT keyword if it is present. Returns a reference to self.
RWDBResult execute();
Inherited from RWDBSelectorBase. Uses a default database connection to submit the SQL SELECT statement encapsulated by self for execution. There will always be one or more RWDBTables in the returned RWDBResult.
RWDBResult execute(const RWDBConnection& connection);
Inherited from RWDBSelectorBase. Uses the supplied connection to submit the SQL SELECT statement encapsulated by self for execution. There will always be one or more RWDBTables in the returned RWDBResult. This function can behave asynchronously if executed using an asynchronous connection.
virtual bool fetchSchema();
Executes the SQL statement associated with self, then populates self's internal schema with the result set, that is, the columns in the table that resulted from the execution of the SQL statement. The function fetchSchema() returns true if successful.
To obtain schema information, the DB Interface Module uses a default database connection to query the database. If no schema can be obtained, fetchSchema() returns false.
virtual bool fetchSchema(const RWDBConnection& connection);
Executes the SQL statement associated with self, then populates self's internal schema with the result set, that is, the columns in the table that resulted from the execution of the SQL statement. The function fetchSchema() returns true if successful.
To obtain schema information, the DB Interface Module uses the supplied connection to query the database. If no schema can be obtained, fetchSchema() returns false.
RWDBSelector& from(const RWDBJoinExpr& jexpr);
Adds jexpr to self's explicit FROM list. This method is used for adding outer join constructs to the FROM clause. Each call to from() adds an entry to the explicit FROM list. See Section 5.3.3, "Outer Joins," in the DB Interface Module User's Guide and the RWDBJoinExpr entry in this Reference Guide for information on generating appropriate outer join constructs. The FROM clause generation is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide Returns a reference to self.
RWDBSelector& from(const RWCString& tableName);
Adds tableName to self's explicit FROM list. Normally, RWDBSelector has no explicit FROM clause. It can deduce which tables to query from the column references in its select list. By using the from() method, you can manipulate default FROM clause generation and cause an explicit FROM list to be maintained. Each call to from() adds an entry to the explicit FROM list. The explicit FROM list can be used by itself or combined with the default implicit list, depending on the fromGeneration() setting. This is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide. Returns a reference to self.
RWDBSelector& from(const RWDBTable& table);
Adds table's name to self's explicit FROM list. Normally, RWDBSelector has no explicit FROM clause. It can deduce which tables to query from the column references in its select list. By using the from() method, you can manipulate default FROM clause generation and cause an explicit FROM list to be maintained. Each call to from() adds an entry to the explicit FROM list. The explicit FROM list can be used by itself or combined with the default implicit list, depending on the fromGeneration() setting. This is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide. Returns a reference to self.
RWDBSelector& fromClear();
Clears self's explicit FROM list. See from() for an explanation of implicit and explicit FROM clauses. This is also explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide. Returns a reference to self.
RWDBSelector& fromExtern(const RWDBTable& table);
Declares table as an externally defined table and hence to not be included in the self's FROM clause. Each call to fromExtern() adds an entry to self's extern table list. This method is especially useful in forming correlated SQLs in which the correlated subquery references a table defined in the outer SQL. The FROM clause generation and correlated subqueries are explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide, and Section 5.3.8, "Subqueries," in the DB Interface Module User's Guide. Returns a reference to self.
RWDBSelector& fromExternClear();
Clears self's extern table list. See fromExtern() for an explanation of the extern table list. The FROM clause generation is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide. Returns a reference to self.
RWDBSelector& fromGeneration(FromGeneration flag);
Sets self's FROM clause generation behavior. Class-scoped enum FromGeneration defines the behavior in generating self's FROM clause from the implicit and explicit FROM entries. The default behavior is ExplicitOrImplicit. The FROM clause generation is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide. Returns a reference to self.
FromGeneration fromGeneration() const;
Returns self's FROM clause generation behavior. Class-scoped enum FromGeneration defines the behaviors in which to generate self's FROM clause from the implicit and explicit FROM entries. The default behavior is ExplicitOrImplicit. The FROM clause generation is explained in detail in Section 5.3.4, "Composing FROM clause," in the DB Interface Module User's Guide.
RWDBSelector& groupBy(const RWDBColumn& column);
Specifies column as a GROUP BY column for self. A select statement may have multiple GROUP BY columns; successive calls to groupBy() add GROUP BY columns to self. The order of groupBy() calls is retained. Returns a reference to self.
RWDBSelector& groupBy(const RWDBExpr& expr);
Specifies expr as a GROUP BY <expression> for self. A select statement may have multiple GROUP BY expressions; successive calls to groupBy() add GROUP BY expressions to self. The order of groupBy() calls is retained. Returns a reference to self.
RWDBSelector& groupBy(int columnNumber);
Specifies columnNumber as a GROUP BY column for self. A select statement may have multiple GROUP BY columns; successive calls to groupBy() add GROUP BY columns to self. The order of groupBy() calls is retained. Returns a reference to self.
RWDBSelector& groupByClear();
Clears self's GROUP BY clause. Returns a reference to self.
RWDBSelector& having(const RWDBCriterion& criterion);
Specifies criterion as self's HAVING clause. If self already has a HAVING clause, this method replaces it. This method is most often used in conjunction with groupBy(). Returns a reference to self.
RWDBCompoundSelector& intersection(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector that represents the SQL selector:
select-stmt INTERSECTION selector
where select-stmt is the SELECT statement represented by self.
RWDBSelector& into(const RWCString& tableName);
Specifies the INTO clause of a select statement. If self already has an INTO clause, this method replaces it. A blank tableName removes the clause from self. If self's database does not support SELECT INTO, the DB Interface Module does not attempt to emulate this functionality. In such cases this method sets self's status to RWDBStatus::notSupported. Returns a reference to self.
bool isValid();
Inherited from RWDBSelectorBase. Returns true if self's status is RWDBStatus::ok, otherwise returns false. Does not return false if the previous executed statement failed. You must check the status of the RWDBResult returned from execute() instead of the status of the RWDBSelector object.
RWDBSelector& on(const RWDBColumn& column);
Adds the column to the SQL USING clause of the first RWDBJoinExpr attached to self using the from() method. Returns a reference to self.
NOTE -- This method is deprecated and will be eliminated in a later release. Instead, use the similar on()method in RWDBJoinExpr to attach a join condition to a specific join.
RWDBSelector& on(const RWDBCriterion& criterion);
Attaches the criterion as an SQL ON clause to the first RWDBJoinExpr attached to self using the from() method. If the first RWDBJoinExpr already has an ON clause, this method replaces it. Returns a reference to self.
NOTE -- This method is deprecated and will be eliminated in a later release. Instead, use the similar on()method in RWDBJoinExpr to attach a join condition to a specific join.
RWDBSelector& orderBy(const RWDBColumn& column);
Specifies column as an ORDER BY column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() add ORDER BY columns to self. The order of orderBy() calls is retained. Returns a reference to self.
RWDBSelector& orderBy(const RWDBExpr& expr);
Specifies expr as an ORDER BY <expression> for self. A select statement may have multiple ORDER BY expressions; successive calls to orderBy() add ORDER BY expressions to self. The order of orderBy() calls is retained. Returns a reference to self.
RWDBSelector& orderBy(int columnNumber);
Specifies columnNumber as an ORDER BY column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() add ORDER BY columns to self. The order of orderBy() calls is retained. Returns a reference to self.
RWDBSelector& orderByClear();
Clears self's ORDER BY clause. Returns a reference to self.
RWDBSelector& orderByDescending(const RWDBColumn& column);
Specifies column as an ORDER BY DESCENDING column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() add ORDER BY columns to self. The order of orderBy() calls is retained. Returns a reference to self.
RWDBSelector& orderByDescending(int columnNumber);
Specifies columnNumber as an ORDER BY DESCENDING column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() add ORDER BY columns to self. The order of orderBy() calls is retained. Returns a reference to self.
RWDBReader reader(size_t cache=0) const;
Inherited from RWDBSelectorBase. Produces an RWDBReader that can be used to read data from self one row at a time. Uses a default database connection which is held by the RWDBReader until the RWDBReader is destroyed.
NOTE -- When cache is 0, an acceptable default is selected by your Access Module. Please check your Access Module documentation for limitations on the cache size.
RWDBReader reader(const RWDBConnection& connection, size_t cache=0) const;
Inherited from RWDBSelectorBase. Produces an RWDBReader that can be used to read data from self one row at a time. Uses the supplied connection, which is held by the RWDBReader until the RWDBReader is destroyed. This function can behave asynchronously if executed using an asynchronous connection.
NOTE -- When cache is 0, an acceptable default is selected by your Access Module. Please check your Access Module documentation for limitations on the cache size.
RWDBSchema schema() const;
Inherited from RWDBSelectorBase. Returns a deep copy of self's RWDBSchema. The copy is made so that an application can modify the returned RWDBSchema without modifying self's schema. The schema is empty until self's fetchSchema() method is called.
RWDBSelector& select(const RWDBExpr& expr);
This is a synonym for *this << expr. Returns a reference to self.
RWDBSelector& select(const RWDBTable& table);
This is a synonym for *this << table. Returns a reference to self.
RWDBSelector& selectClear();
Clears self's select list. Returns a reference to self.
void setErrorHandler(RWDBStatus::ErrorHandler handler);
Installs handler as self's error handler. The supplied handler is inherited by all objects produced by self. By default, an RWDBSelector error handler is inherited from the object that produced it; this method overrides the default. ErrorHandler is declared as a typedef within the scope of RWDBStatus:
typedef void (*ErrorHandler)(const RWDBStatus&);
RWDBStatus status();
Returns the status of self.
RWDBCompoundSelector& union_ (const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector that represents the SQL selector:
select-stmt UNION selector
where select-stmt is the SELECT statement represented by self. The trailing underscore is to avoid conflict with the C++ union keyword.
RWDBCompoundSelector& unionAll(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector which represents the SQL selector:
SELECT select-stmt UNION ALL
where select-stmt is the SELECT statement represented by self.
RWDBCriterion where() const;
Returns a copy of self's RWDBCriterion, an encapsulated SQL WHERE clause. Returns an empty RWDBCriterion if self has no WHERE clause.
RWDBSelector& where(const RWDBCriterion& criterion);
Specifies criterion as self's SQL WHERE clause. If self already has a WHERE clause, this method replaces it. Returns a reference to self.
RWDBCompoundSelector operator+(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Union. Equivalent to left.union_(right). Inherited from RWDBSelectorBase.
RWDBCompoundSelector operator-(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Difference. Equivalent to left.difference(right). Inherited from RWDBSelectorBase.
RWDBCompoundSelector operator*(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Intersection. Equivalent to left.intersection(right). Inherited from RWDBSelectorBase.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.