SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWDBCompoundSelector Class Reference

Represents the result of the set operators Union, Intersection, or Difference applied to RWDBSelector. More...

#include <rw/db/comsel.h>

Inheritance diagram for RWDBCompoundSelector:
RWDBSelectorBase

Public Member Functions

 RWDBCompoundSelector (const RWDBCompoundSelector &csel)
 
RWCString asString () const
 
RWCString asString (const RWDBConnection &conn) const
 
RWCString asString (bool verbose) const
 
RWCString asString (const RWDBConnection &conn, bool verbose) const
 
RWDBDatabase database () const
 
virtual RWDBCompoundSelector difference (const RWDBSelectorBase &selector) const
 
RWDBStatus::ErrorHandler errorHandler () const
 
RWDBResult execute ()
 
RWDBResult execute (const RWDBConnection &connection)
 
virtual RWDBCompoundSelector intersection (const RWDBSelectorBase &selector) const
 
bool isValid () const
 
RWDBCompoundSelectoroperator= (const RWDBCompoundSelector &csel)
 
RWDBSelectorBaseorderBy (const RWDBColumn &column)
 
RWDBSelectorBaseorderBy (int columnNumber)
 
RWDBSelectorBaseorderByClear ()
 
RWDBSelectorBaseorderByDescending (const RWDBColumn &column)
 
RWDBSelectorBaseorderByDescending (int columnNumber)
 
RWDBReader reader (size_t cacheSize=0) const
 
RWDBReader reader (const RWDBConnection &connection, size_t cacheSize=0) const
 
void setErrorHandler (RWDBStatus::ErrorHandler handler)
 
RWDBStatus status () const
 
virtual RWDBCompoundSelector union_ (const RWDBSelectorBase &selector) const
 
virtual RWDBCompoundSelector unionAll (const RWDBSelectorBase &selector) const
 

Detailed Description

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.

Synopsis
#include <rw/db/comsel.h>
RWDBSelector s1, s2;
RWDBCompoundSelector cs = s1 + s2;
RWDBCompoundSelector cs = s1 - s2;

Constructor & Destructor Documentation

RWDBCompoundSelector::RWDBCompoundSelector ( const RWDBCompoundSelector csel)

Copy constructor. The created RWDBCompoundSelector shares an implementation with csel.

Member Function Documentation

RWCString RWDBCompoundSelector::asString ( ) const
inline

Returns the SQL equivalent of:

(SELECT ...) <operator> (SELECT ...)
ORDER BY <orderby-list>

This method returns an SQL statement that would be produced by executing self with an implicit RWDBConnection object. An implicit RWDBConnection object inherits the time zone setting from the producer RWDBDatabase instance. Hence, the time zone setting of the producer RWDBDatabase object will be used for creating the string representations of any RWDateTime instances in self.

The behavior of this 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 this method with RWDBDatabase::verboseAsString() set to true results in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBDatabase::timeZone(const RWZone*) for time zone setting on RWDBDatabase.
RWCString RWDBCompoundSelector::asString ( const RWDBConnection conn) const
inline

Returns the SQL equivalent of:

(SELECT ...) <operator> (SELECT ...)
ORDER BY <orderby-list>

This method returns an SQL statement that would be produced by executing self with conn. The time zone setting of conn will be used for creating string representations of any RWDateTime instances in self.

The behavior of this 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 this method with RWDBDatabase::verboseAsString() set to true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBConnection::timeZone(const RWZone*) for time zone setting on RWDBConnection.
RWCString RWDBCompoundSelector::asString ( bool  verbose) const
inline

Returns the SQL equivalent of:

(SELECT ...) <operator> (SELECT ...)
ORDER BY <orderby-list>

This method returns an SQL statement that would be produced by executing self with an implicit RWDBConnection object. An implicit RWDBConnection object inherits the time zone setting from the producer RWDBDatabase instance. Hence, the time zone setting of the producer RWDBDatabase object will be used for creating the string representations of any RWDateTime instances in self.

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 this method with verbose as true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBDatabase::timeZone(const RWZone*) for time zone setting on RWDBDatabase.
RWCString RWDBCompoundSelector::asString ( const RWDBConnection conn,
bool  verbose 
) const
inline

Returns the SQL equivalent of:

(SELECT ...) <operator> (SELECT ...)
ORDER BY <orderby-list>

This method returns an SQL statement that would be produced by executing self with conn. The time zone setting of conn will be used for creating string representations of any RWDateTime instances in self.

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 this method with verbose as true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBConnection::timeZone(const RWZone*) for time zone setting on RWDBConnection.
RWDBDatabase RWDBCompoundSelector::database ( ) const
inline

Returns the RWDBDatabase that produced this selector. If there is no such object, for example, if this RWDBCompoundSelector was produced using invalid RWDBSelector objects, returns an RWDBDatabase with a status of RWDBStatus::notInitialized.

virtual RWDBCompoundSelector RWDBCompoundSelector::difference ( const RWDBSelectorBase selector) const
inlinevirtual

Returns an RWDBCompoundSelector that represents the SQL selector:

select-stmt DIFFERENCE selector

where select-stmt is the SELECT statement represented by self.

Reimplemented from RWDBSelectorBase.

RWDBStatus::ErrorHandler RWDBCompoundSelector::errorHandler ( ) const
inline

Returns the error handler attached to self.

RWDBResult RWDBCompoundSelector::execute ( )
inline

Uses a default database connection to submit the SQL SELECT statement encapsulated by self for execution. There will always be one or more RWDBTable instances in the returned RWDBResult.

RWDBResult RWDBCompoundSelector::execute ( const RWDBConnection connection)
inline

Uses the supplied connection to submit the SQL SELECT statement encapsulated by self for execution. There will always be one or more RWDBTable instances in the returned RWDBResult. This function can behave asynchronously if executed using an asynchronous connection.

virtual RWDBCompoundSelector RWDBCompoundSelector::intersection ( const RWDBSelectorBase selector) const
inlinevirtual

Returns an RWDBCompoundSelector that represents the SQL selector:

select-stmt INTERSECTION selector

where select-stmt is the SELECT statement represented by self.

Reimplemented from RWDBSelectorBase.

bool RWDBCompoundSelector::isValid ( ) const
inline

Returns true if self's status is RWDBStatus::ok, otherwise false. Does not return false if the previously executed statement failed. You must check the status of the RWDBResult returned from execute() instead of the status of the RWDBCompoundSelector object.

RWDBCompoundSelector& RWDBCompoundSelector::operator= ( const RWDBCompoundSelector csel)

Assignment operator. Self shares an implementation with csel. Returns a reference to self.

RWDBSelectorBase& RWDBCompoundSelector::orderBy ( const RWDBColumn column)
inline

Specifies column as an ORDER BY column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() and orderByDescending() add ORDER BY columns to self. The order of orderBy() and orderByDescending() calls is retained. Returns a reference to self.

RWDBSelectorBase& RWDBCompoundSelector::orderBy ( int  columnNumber)
inline

Specifies columnNumber as an ORDER BY column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() and orderByDescending() add ORDER BY columns to self. The order of orderBy() and orderByDescending() calls is retained. Returns a reference to self.

RWDBSelectorBase& RWDBCompoundSelector::orderByClear ( )
inline

Clears self's ORDER BY clause. Returns a reference to self.

RWDBSelectorBase& RWDBCompoundSelector::orderByDescending ( const RWDBColumn column)
inline

Specifies column as an ORDER BY DESCENDING column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() and orderByDescending() add ORDER BY columns to self. The order of orderBy() and orderByDescending() calls is retained. Returns a reference to self.

RWDBSelectorBase& RWDBCompoundSelector::orderByDescending ( int  columnNumber)
inline

Specifies columnNumber as an ORDER BY DESCENDING column for self. A select statement may have multiple ORDER BY columns; successive calls to orderBy() and orderByDescending() add ORDER BY columns to self. The order of orderBy() and orderByDescending() calls is retained. Returns a reference to self.

RWDBReader RWDBCompoundSelector::reader ( size_t  cacheSize = 0) const
inline

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 cacheSize is 0, an acceptable default is selected by your Access Module. Please check your Access Module documentation for limitations on the cache size.
RWDBReader RWDBCompoundSelector::reader ( const RWDBConnection connection,
size_t  cacheSize = 0 
) const
inline

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 cacheSize is 0, an acceptable default is selected by your Access Module. Please check your Access Module documentation for limitations on the cache size.
void RWDBCompoundSelector::setErrorHandler ( RWDBStatus::ErrorHandler  handler)
inline

Installs handler as self's error handler. The supplied handler is inherited by all objects produced by self. By default, an RWDBStatus::ErrorHandler is inherited from the object that produced self; this method overrides the default.

RWDBStatus RWDBCompoundSelector::status ( ) const
inline

Returns the status of self.

virtual RWDBCompoundSelector RWDBCompoundSelector::union_ ( const RWDBSelectorBase selector) const
inlinevirtual

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 avoids a conflict with the C++ union keyword.

Reimplemented from RWDBSelectorBase.

virtual RWDBCompoundSelector RWDBCompoundSelector::unionAll ( const RWDBSelectorBase selector) const
inlinevirtual

Returns an RWDBCompoundSelector that represents the SQL selector:

select-stmt UNION ALL selector

where select-stmt is the SELECT statement represented by self.

Reimplemented from RWDBSelectorBase.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.