rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDBCompoundSelector Class Reference
[Data Manipulation]

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

List of all members.

Public Member Functions

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

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

virtual RWDBCompoundSelector RWDBCompoundSelector::difference ( const RWDBSelectorBase selector  )  const [inline, virtual]

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

virtual RWDBCompoundSelector RWDBCompoundSelector::intersection ( const RWDBSelectorBase selector  )  const [inline, virtual]

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.

Reimplemented from RWDBSelectorBase.

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

Assignment operator. Self shares an implementation with csel. 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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

RWDBSelectorBase& RWDBCompoundSelector::orderByClear (  )  [inline]

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

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

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.

Reimplemented from RWDBSelectorBase.

RWDBStatus RWDBCompoundSelector::status (  )  const [inline]

Returns the status of self.

Reimplemented from RWDBSelectorBase.

virtual RWDBCompoundSelector RWDBCompoundSelector::union_ ( const RWDBSelectorBase selector  )  const [inline, virtual]

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 [inline, virtual]

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.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.