Module: DB Interface Module Group: Data Manipulation Classes
RWDBCompoundSelector RWDBSelectorBase
#include <rw/db/comsel.h> RWDBSelector s1, s2; RWDBCompoundSelector cs = s1 + s2; RWDBCompoundSelector cs = s1 * s2 RWDBCompoundSelector cs = s1 - s2;
Instances of this class are created as the result of the set operators Union, Intersection, or Difference applied to RWDBSelector.
RWDBSelector and RWDBCompoundSelector share the common base class RWDBSelectorBase.
RWDBCompoundSelector(const RWDBCompoundSelector& csel);
Copy constructor. The created RWDBCompoundSelector shares an implementation with csel.
RWDBCompoundSelector& operator=(const RWDBCompoundSelector& csel);
Assignment operator. Self shares an implementation with csel. Returns a reference to self.
RWCString asString() const;
Inherited from RWDBSelectorBase. Returns the SQL equivalent of:
SELECT ... FROM ... WHERE (SELECT ...)
<operator> (SELECT ...)
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 ... FROM ... WHERE (SELECT ...)
<operator> (SELECT ...)
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 ... FROM ... WHERE (SELECT ...)
<operator> (SELECT ...)
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 ... FROM ... WHERE (SELECT ...)
<operator> (SELECT ...)
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.
RWDBDatabase database() const;
Inherited from RWDBSelectorBase. Returns the database which produced self.
RWDBCompoundSelector& difference(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector which represents the SQL selector:
select-stmt DIFFERENCE selector
where select-stmt is the SELECT statement represented by self.
RWDBStatus::ErrorHandler errorHandler() const;
Returns the error handler attached 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.
RWDBCompoundSelector& intersection(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector, which represents the SQL selector:
select-stmt INTERSECTION selector
where select-stmt is the SELECT statement represented by self.
bool isValid()const;
Inherited from RWDBSelectorBase. Returns true if self's status is RWDBStatus::ok, otherwise returns false.
RWDBSelectorBase& orderBy(const RWDBColumn& column);
Inherited from RWDBSelectorBase. Adds an ORDER BY column clause to the select statement represented by self. If self already has an ORDER BY clause, column is appended to the existing ORDER BY clause. Returns a reference to self.
RWDBSelectorBase& orderBy(int columnNumber);
Inherited from RWDBSelectorBase. Adds an ORDER BY columnNumber clause to the select statement represented by self. If self already has an ORDER BY clause, columnNumber is appended to the existing ORDER BY clause. Returns a reference to self.
RWDBSelectorBase& orderByClear();
Inherited from RWDBSelectorBase. Removes all ORDER BY clauses, if any, from self. Returns a reference to self.
RWDBSelectorBase& orderByDescending(const RWDBColumn& column);
Inherited from RWDBSelectorBase. Adds the clause ORDER BY column DESCENDING to the select statement represented by self. If self already has an ORDER BY clause, column is appended to the existing ORDER BY clause. Returns a reference to self.
RWDBSelectorBase& orderByDescending(int columnNumber);
Inherited from RWDBSelectorBase. Adds the clause ORDER BY columnNumber DESCENDING to the select statement represented by self. If self already has an ORDER BY clause, columnNumber is appended to the existing ORDER BY clause. Returns a reference to self.
RWDBReader reader() const;
Inherited from RWDBSelectorBase. An RWDBReader is produced, using a default connection to self's database(). This causes the SELECT statement represented by self to be executed in the database, with the resulting RWDBReader providing row-by-row access to the selected data. Equivalent to execute().table().reader(). This function can behave asynchronously if executed using an asynchronous connection.
RWDBReader reader(const RWDBConnection& connection) const;
Inherited from RWDBSelectorBase. An RWDBReader is produced, using the supplied connection to self's database(). This causes the SELECT statement represented by self to be executed in the database, with the resulting RWDBReader providing row-by-row access to the selected data. The function is equivalent to execute(connection).table().reader(). This function can behave asynchronously if executed using an asynchronous connection.
void setErrorHandler(RWDBStatus::ErrorHandler handler);
Inherited from RWDBSelectorBase. Installs handler as the error handler for self. The supplied handler is inherited by all objects produced by self. By default, an error handler is inherited from the object which produced the object; this method overrides the default. ErrorHandler is declared as a typedef within the scope of RWDBStatus:
typedef void (*ErrorHandler)(const RWDBStatus& status);
RWDBStatus status() const;
Inherited from RWDBSelectorBase. Returns the status of self.
virtual RWDBCompoundSelector& union_(const RWDBSelectorBase& selector) const;
Inherited from RWDBSelectorBase. Returns an RWDBCompoundSelector, which 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.
virtual 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.
RWDBCompoundSelector operator+(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Union. Inherited from RWDBSelectorBase. Equivalent to left.union_(right).
RWDBCompoundSelector operator-(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Difference. Inherited from RWDBSelectorBase. Equivalent to left.difference(right).
RWDBCompoundSelector operator*(const RWDBSelectorBase& left, const RWDBSelectorBase& right);
Intersection. Inherited from RWDBSelectorBase. Equivalent to left.intersection(right).
© 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.