SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBExpr Class Reference

A C++ representation of expressions used in constructing SQL statements. More...

#include <rw/db/expr.h>

Inheritance diagram for RWDBExpr:
RWDBAssignment RWDBBoundExpr RWDBCollectableExpr RWDBCriterion RWDBJoinExpr RWDBSearchedCaseExpr RWDBSimpleCaseExpr

Public Types

enum  AsStringControlFlag { normal , suppressTagsOnColumns , noPlaceHolder , placeHolderNotRecommended }
 

Public Member Functions

 RWDBExpr ()
 
 RWDBExpr (char value)
 
 RWDBExpr (const char *value)
 
 RWDBExpr (const RWBasicUString &value)
 
 RWDBExpr (const RWCollection &collection)
 
 RWDBExpr (const RWCString &value)
 
 RWDBExpr (const RWDate &value)
 
 RWDBExpr (const RWDateTime &value)
 
 RWDBExpr (const RWDBBlob &value)
 
 RWDBExpr (const RWDBColumn &column)
 
 RWDBExpr (const RWDBColumn &left, const RWDBExpr &right)
 
 RWDBExpr (const RWDBColumn &left, const RWDBValue &right)
 
 RWDBExpr (const RWDBDateTime &value)
 
 RWDBExpr (const RWDBDuration &value)
 
 RWDBExpr (const RWDBExpr &expr)
 
 RWDBExpr (const RWDBMBString &value)
 
 RWDBExpr (const RWDBSelectorBase &subSelect)
 
 RWDBExpr (const RWDBTable &)
 
 RWDBExpr (const RWDBValue &value, bool usePhraseBook=true)
 
 RWDBExpr (const RWDecimalPortable &value)
 
 RWDBExpr (const RWTime &value)
 
 RWDBExpr (const RWWString &value)
 
 RWDBExpr (const wchar_t *value)
 
 RWDBExpr (double value)
 
 RWDBExpr (float value)
 
 RWDBExpr (int value)
 
 RWDBExpr (long double value)
 
 RWDBExpr (long int value)
 
 RWDBExpr (long long value)
 
 RWDBExpr (RWDBValueManip manip)
 
 RWDBExpr (short value)
 
 RWDBExpr (unsigned char value)
 
 RWDBExpr (unsigned int value)
 
 RWDBExpr (unsigned long int value)
 
 RWDBExpr (unsigned long long value)
 
 RWDBExpr (unsigned short value)
 
RWCString asString (const RWDBPhraseBook &phraseBook, AsStringControlFlag control=normal) const
 
RWDBCriterion between (const RWDBExpr &expression1, const RWDBExpr &expression2) const
 
RWDBCriterion in (const RWDBExpr &expression1) const
 
RWDBCriterion isNull (void) const
 
bool isValid (void) const
 
RWDBCriterion leftOuterJoin (const RWDBExpr &expression) const
 
RWDBCriterion like (const RWDBExpr &expression1) const
 
RWDBCriterion matchUnique (const RWDBExpr &expression1) const
 
RWDBExproperator= (const RWDBExpr &expr)
 
RWDBCriterion rightOuterJoin (const RWDBExpr &expression) const
 

Related Symbols

(Note that these are not member symbols.)

RWDBCriterion operator! (const RWDBCriterion &)
 
RWDBCriterion operator!= (const RWDBExpr &, const RWDBExpr &)
 
RWDBExpr operator% (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator&& (const RWDBCriterion &, const RWDBCriterion &)
 
RWDBExpr operator* (const RWDBExpr &, const RWDBExpr &)
 
RWDBExpr operator+ (const RWDBExpr &)
 
RWDBExpr operator+ (const RWDBExpr &, const RWDBExpr &)
 
RWDBExpr operator- (const RWDBExpr &)
 
RWDBExpr operator- (const RWDBExpr &, const RWDBExpr &)
 
RWDBExpr operator/ (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator< (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator<= (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator== (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator> (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator>= (const RWDBExpr &, const RWDBExpr &)
 
RWDBCriterion operator|| (const RWDBCriterion &, const RWDBCriterion &)
 
RWDBExpr rwdbAvg (const RWDBExpr &expr)
 
RWDBExpr rwdbCast (const RWDBExpr &expr, const RWDBValue &type)
 
RWDBExpr rwdbCast (const RWDBExpr &expr, const RWDBValue &typeName, const RWDBExpr &formatString)
 
RWDBExpr rwdbCast (const RWDBExpr &expr, const RWDBValue &typeName, const RWDBExpr &formatString, const RWDBExpr &secondaryFormat)
 
RWDBExpr rwdbCharLength (const RWDBExpr &expr)
 
RWDBExpr rwdbCount ()
 
RWDBExpr rwdbCount (const RWDBExpr &expr)
 
RWDBExpr rwdbCountDistinct (const RWDBExpr &expr)
 
RWDBExpr rwdbCurrentUser ()
 
RWDBCriterion rwdbExists (const RWDBSelectorBase &select)
 
RWDBExpr rwdbLower (const RWDBExpr &expr)
 
RWDBExpr rwdbMax (const RWDBExpr &expr)
 
RWDBExpr rwdbMin (const RWDBExpr &expr)
 
RWDBExpr rwdbName (const RWCString &name, const RWDBExpr &expr)
 
RWDBExpr rwdbPosition (const RWDBExpr &expr1, const RWDBExpr &expr2)
 
RWDBExpr rwdbSessionUser ()
 
RWDBExpr rwdbSubString (const RWDBExpr &expr1, const RWDBExpr &expr2)
 
RWDBExpr rwdbSubString (const RWDBExpr &expr1, const RWDBExpr &expr2, const RWDBExpr &expr3)
 
RWDBExpr rwdbSum (const RWDBExpr &expr)
 
RWDBExpr rwdbSystemDateTime ()
 
RWDBExpr rwdbSystemUser ()
 
RWDBExpr rwdbTrimBoth (const RWDBExpr &expr1, const RWDBExpr &expr2)
 
RWDBExpr rwdbTrimLeading (const RWDBExpr &expr1, const RWDBExpr &expr2)
 
RWDBExpr rwdbTrimTrailing (const RWDBExpr &expr1, const RWDBExpr &expr2)
 
RWDBExpr rwdbUpper (const RWDBExpr &expr)
 

Detailed Description

RWDBExpr represents expressions used in constructing SQL statements, allowing the SQL to be constructed using C++ syntax. Because there are several types of expressions, this class is simply an interface to a family of implementations that can represent numeric and string constants, columns from tables, or other expressions. By its nature, an RWDBExpr can actually represent a complete complex expression in the form of a parse tree.

Because instances of this class are typically created anonymously, it has constructors taking the various operands used in expressions. These include the C++ primitive types, as well as the structured types used by the DB Interface Module, such as RWCString and RWDBColumn.

RWDBExpr is designed around the Interface/Implementation paradigm. An RWDBExpr instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation.

This class has a number of related global functions that may be applied to RWDBExpr instances to build RWDBExpr objects representing SQL functions. The SQL syntax for these functions typically varies among the various vendors' implementations. The DB Interface Module hides the variations by providing the database-specific syntax at runtime.

The DB Interface Module also provides an extensible mechanism for applications to define their own functional notation. See RWDBExprFormDefinition.

Synopsis
#include <rw/db/expr.h>
See also

RWDBAssignment is a special kind of expression used to encapsulate the SQL phrase:

SET column = expression.

RWDBAssignment instances are produced by the method RWDBColumn::assign().

RWDBBoundExpr is used to bind application variables to an SQL statement.

RWDBCollectableExpr derives from RWDBExpr and RWCollectable.

RWDBPhraseBook stores database-specific SQL syntax.

RWDBCriterion is a special kind of expression used to encapsulate an SQL WHERE clause. It is formed from RWDBExpr instances connected with logical operators.

RWDBExprFormDefinition provides an extensible mechanism that allows application programmers to define their own functional SQL notation.

RWDBJoinExpr constructs ANSI SQL join syntax.

RWDBSimpleCaseExpr constructs simple CASE expressions.

RWDBSearchedCaseExpr constructs searched CASE expressions.

Example

In this example, an RWDBExpr is created anonymously to be used as part of an SQL SELECT statement. The intent is to create a selector that adds the value of the program variable x to each value selected.

int x = somevalue;
RWDBTable myTable = myDbase.table("myTable");
RWDBSelector select = myDbase.selector();
select << myTable["integerColumn"] + x;
Encapsulates the SQL SELECT statement.
Definition select.h:369
Base class for a family of classes that represent the abstract notion of a database table in a number...
Definition table.h:89

Member Enumeration Documentation

◆ AsStringControlFlag

This enum holds values to format asString() output.

Enumerator
normal 

Normal formatting

suppressTagsOnColumns 

Suppress usage of table tags to qualify table columns

noPlaceHolder 

Prevent usage of placeholders

placeHolderNotRecommended 

Placeholder usage is not recommended

Constructor & Destructor Documentation

◆ RWDBExpr() [1/36]

RWDBExpr::RWDBExpr ( )

The default constructor builds an empty RWDBExpr, that is, one whose asString() method returns an SQL NULL keyword, as specified in its parameter phraseBook. Since an empty expression cannot hold a value, RWDBExpr() cannot be used as NULL value.

◆ RWDBExpr() [2/36]

RWDBExpr::RWDBExpr ( const RWDBExpr & expr)

Copy constructor. Self shares an implementation with expr.

◆ RWDBExpr() [3/36]

RWDBExpr::RWDBExpr ( char value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [4/36]

RWDBExpr::RWDBExpr ( unsigned char value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [5/36]

RWDBExpr::RWDBExpr ( short value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [6/36]

RWDBExpr::RWDBExpr ( unsigned short value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [7/36]

RWDBExpr::RWDBExpr ( int value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [8/36]

RWDBExpr::RWDBExpr ( unsigned int value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [9/36]

RWDBExpr::RWDBExpr ( long int value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [10/36]

RWDBExpr::RWDBExpr ( unsigned long int value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [11/36]

RWDBExpr::RWDBExpr ( long long value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [12/36]

RWDBExpr::RWDBExpr ( unsigned long long value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [13/36]

RWDBExpr::RWDBExpr ( float value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [14/36]

RWDBExpr::RWDBExpr ( double value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [15/36]

RWDBExpr::RWDBExpr ( long double value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [16/36]

RWDBExpr::RWDBExpr ( const char * value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [17/36]

RWDBExpr::RWDBExpr ( const wchar_t * value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [18/36]

RWDBExpr::RWDBExpr ( const RWCString & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [19/36]

RWDBExpr::RWDBExpr ( const RWDecimalPortable & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [20/36]

RWDBExpr::RWDBExpr ( const RWDateTime & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [21/36]

RWDBExpr::RWDBExpr ( const RWDBDateTime & value)
Deprecated
As of SourcePro 12.5, use RWDBExpr(const RWDateTime&) instead.

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [22/36]

RWDBExpr::RWDBExpr ( const RWDBDuration & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [23/36]

RWDBExpr::RWDBExpr ( const RWDate & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [24/36]

RWDBExpr::RWDBExpr ( const RWTime & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [25/36]

RWDBExpr::RWDBExpr ( const RWDBBlob & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [26/36]

RWDBExpr::RWDBExpr ( const RWBasicUString & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [27/36]

RWDBExpr::RWDBExpr ( const RWDBMBString & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [28/36]

RWDBExpr::RWDBExpr ( const RWWString & value)

Creates an RWDBExpr from the given value.

◆ RWDBExpr() [29/36]

RWDBExpr::RWDBExpr ( const RWDBValue & value,
bool usePhraseBook = true )

Creates an RWDBExpr from an RWDBValue. When the asString() function is applied to this RWDBExpr, it passes its phraseBook parameter on to the RWDBValue for interpretation. Passing false for the usePhraseBook parameter suppresses this behavior. The effect of suppressing the use of the phraseBook is to prevent strings from being quoted and RWDateTime instances from using the database's designated format.

◆ RWDBExpr() [30/36]

RWDBExpr::RWDBExpr ( const RWDBColumn & column)

Creates an RWDBExpr from the column reference.

◆ RWDBExpr() [31/36]

RWDBExpr::RWDBExpr ( const RWDBSelectorBase & subSelect)

Creates an RWDBExpr from an RWDBSelector or RWDBCompoundSelector. This constructor supports the SQL subquery construct.

◆ RWDBExpr() [32/36]

RWDBExpr::RWDBExpr ( RWDBValueManip manip)

Creates an RWDBExpr according to the semantics of manip. In particular, an expression representing a literal NULL may be constructed from rwdbNull.

◆ RWDBExpr() [33/36]

RWDBExpr::RWDBExpr ( const RWCollection & collection)

Creates an RWDBExpr that represents a delimited list of the items in collection. The parameter collection must be a collection of RWDBCollectableExpr instances. collection must remain in scope for the entire period that the RWDBExpr can be referenced, since the expression is not expanded into a string until the asString() method is called, which can happen long after you assign the collectable to the expression.

◆ RWDBExpr() [34/36]

RWDBExpr::RWDBExpr ( const RWDBTable & )

Creates an RWDBExpr that represents a table.

◆ RWDBExpr() [35/36]

RWDBExpr::RWDBExpr ( const RWDBColumn & left,
const RWDBExpr & right )

Creates an RWDBExpr that represents an encapsulation of the SQL expression:

left = right

where left is the name of the column and right is the expression against which to compare.

◆ RWDBExpr() [36/36]

RWDBExpr::RWDBExpr ( const RWDBColumn & left,
const RWDBValue & right )

Creates an RWDBExpr that represents an encapsulation of the SQL expression:

left = right

where left is the name of the column and right is the value against which to compare.

Member Function Documentation

◆ asString()

RWCString RWDBExpr::asString ( const RWDBPhraseBook & phraseBook,
AsStringControlFlag control = normal ) const

Returns an RWCString representing self as a string based on the format found in phraseBook. Normally, references to columns in self are represented in the string with table tags attached. Setting the value of control with RWDBExpr::suppressTagsOnColumns prevents the tags from being included in the string.

◆ between()

RWDBCriterion RWDBExpr::between ( const RWDBExpr & expression1,
const RWDBExpr & expression2 ) const

Returns an RWDBCriterion that represents an encapsulation of the SQL clause:

expression BETWEEN expression1 AND expression2

where expression refers to self. RWDBCriterion encapsulates SQL WHERE clauses.

◆ in()

RWDBCriterion RWDBExpr::in ( const RWDBExpr & expression1) const

Returns an RWDBCriterion that represents an encapsulation of the SQL phrase:

expression IN expression1

where expression refers to self. An RWDBCriterion is an encapsulation of an SQL WHERE clause. For example, to produce the SQL clause (shown using Oracle placeholder syntax):

(col1 + 'bye') in (:ph0, :ph1)

we could write:

RWDBExpr anExpression(col1 + "bye");
RWOrdered aCollection;
RWCString hello("hello");
RWCString goodbye("goodbye");
RWDBBoundExpr expr1(&hello);
RWDBBoundExpr expr2(&goodbye);
RWDBCollectableExpr colExpr1(expr1);
RWDBCollectableExpr colExpr2(expr2);
aCollection.insert(&colExpr1);
aCollection.insert(&colExpr2);
anExpression.in(aCollection);
Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826
Acts as a placeholder in a dynamic SQL statement, providing a type-safe interface for binding a local...
Definition expr.h:935
Adds RWCollectable semantics to RWDBExpr.
Definition expr.h:576
A C++ representation of expressions used in constructing SQL statements.
Definition expr.h:101
Represents a group of ordered items, accessible by an index number, but not accessible by an external...
Definition ordcltn.h:57
virtual RWCollectable * insert(RWCollectable *c)

To produce the SQL clause:

(col1 + 'bye') in ('hello','goodbye')

we could write:

RWDBExpr anExpression(col1 + "bye");
RWOrdered aCollection;
RWDBExpr expr1("hello");
RWDBExpr expr2("goodbye");
aCollection.insert(&expr1);
aCollection.insert(&expr2);
anExpression.in(aCollection);

Alternatively, we could write:

RWDBExpr anExpression(col1 + "bye");
anExpression.in(RWDBExpr("('hello', 'good-bye')", false));
Note
The parameter false in the constructor for the RWDBExpr above is required in order to suppress quotation marks in the resultant SQL string.

◆ isNull()

RWDBCriterion RWDBExpr::isNull ( void ) const

Returns an RWDBCriterion that represents an encapsulation of the SQL clause:

expression IS NULL

where expression refers to self. An RWDBCriterion is an encapsulation of an SQL WHERE clause.

◆ isValid()

bool RWDBExpr::isValid ( void ) const

Returns true if self is not an empty (null) expression.

◆ leftOuterJoin()

RWDBCriterion RWDBExpr::leftOuterJoin ( const RWDBExpr & expression) const

Returns an RWDBCriterion that represents an encapsulation of the LEFT OUTER JOIN SQL phrase. An RWDBCriterion is an encapsulation of an SQL WHERE clause.

◆ like()

RWDBCriterion RWDBExpr::like ( const RWDBExpr & expression1) const

Returns an RWDBCriterion that represents an encapsulation of the SQL clause:

expression LIKE expression1

where expression refers to self. For example, to produce the SQL clause:

col1 LIKE `%object%'

we would write:

table["col1"].like("%object%");

◆ matchUnique()

RWDBCriterion RWDBExpr::matchUnique ( const RWDBExpr & expression1) const

Returns an RWDBCriterion that represents an encapsulation of the SQL clause:

expression MATCH UNIQUE expression1

where expression refers to self.

◆ operator=()

RWDBExpr & RWDBExpr::operator= ( const RWDBExpr & expr)

Assignment operator. Self shares an implementation with expr.

◆ rightOuterJoin()

RWDBCriterion RWDBExpr::rightOuterJoin ( const RWDBExpr & expression) const

Returns an RWDBCriterion that represents an encapsulation of the RIGHT OUTER JOIN SQL phrase. An RWDBCriterion is an encapsulation of an SQL WHERE clause.

Friends And Related Symbol Documentation

◆ operator!()

RWDBCriterion operator! ( const RWDBCriterion & )
related

Returns an RWDBCriterion representing a monadic expression with the operator ! (not).

◆ operator!=()

RWDBCriterion operator!= ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the != (inequality) operator.

◆ operator%()

RWDBExpr operator% ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBExpr representing a dyadic expression between two subexpressions with the % (modulo) operator.

◆ operator&&()

RWDBCriterion operator&& ( const RWDBCriterion & ,
const RWDBCriterion &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with && (and) as the operator, if both operands are initialized. If only one operand is initialized, returns an RWDBCriterion representing a monadic expression.

◆ operator*()

RWDBExpr operator* ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBExpr representing a dyadic expression between two subexpressions with * (multiply) as the operator.

◆ operator+() [1/2]

RWDBExpr operator+ ( const RWDBExpr & )
related

Returns an RWDBExpr representing a monadic expression with + (plus) as the operator.

◆ operator+() [2/2]

RWDBExpr operator+ ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBExpr representing a dyadic expression between two subexpressions with + (plus) as the operator.

◆ operator-() [1/2]

RWDBExpr operator- ( const RWDBExpr & )
related

Returns an RWDBExpr representing a monadic expression with - (minus) as the operator.

◆ operator-() [2/2]

RWDBExpr operator- ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBExpr representing a dyadic expression between two subexpressions with - (minus) as the operator.

◆ operator/()

RWDBExpr operator/ ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBExpr representing a dyadic expression between two sub-expressions with / (divide) as the operator.

◆ operator<()

RWDBCriterion operator< ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the < (less than) operator.

◆ operator<=()

RWDBCriterion operator<= ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the <= (less than or equal to) operator.

◆ operator==()

RWDBCriterion operator== ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the == (equality) operator.

◆ operator>()

RWDBCriterion operator> ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the > (greater than) operator.

◆ operator>=()

RWDBCriterion operator>= ( const RWDBExpr & ,
const RWDBExpr &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with the >= (greater than or equal to) operator.

◆ operator||()

RWDBCriterion operator|| ( const RWDBCriterion & ,
const RWDBCriterion &  )
related

Returns an RWDBCriterion representing a dyadic expression between two subexpressions with || (or) as the operator, if both operands are initialized. If only one operand is initialized, returns an RWDBCriterion representing a monadic expression.

◆ rwdbAvg()

RWDBExpr rwdbAvg ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

AVERAGE(expr)

◆ rwdbCast() [1/3]

RWDBExpr rwdbCast ( const RWDBExpr & expr,
const RWDBValue & type )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

CAST(expr, type)

For example, to produce the SQL phrase:

CAST(Col1 + 7, STRING)

we would write:

RWDBExpr anExpression = rwdbCast(col1 + 7, "STRING");
RWDBExpr rwdbCast(const RWDBExpr &expr, const RWDBValue &type)

◆ rwdbCast() [2/3]

RWDBExpr rwdbCast ( const RWDBExpr & expr,
const RWDBValue & typeName,
const RWDBExpr & formatString )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

CAST(expr, typeName, formatString)

For example, to produce the SQL phrase:

CAST(dateCol, STRING, `MM-DD-YY')

we would write:

RWDBExpr anExpression = rwdbCast(dateCol, "STRING", "'MM-DD-YY'");

◆ rwdbCast() [3/3]

RWDBExpr rwdbCast ( const RWDBExpr & expr,
const RWDBValue & typeName,
const RWDBExpr & formatString,
const RWDBExpr & secondaryFormat )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

CAST(expr, typeName, formatString, secondaryFormat)

For example, to produce the SQL phrase:

CAST(dateCol, STRING, `MM-DD-YY', French_France.WE8ISO88591')

where the last parameter is a database-specific directive to use French style formatting, write:

RWDBExpr anExpression = rwdbCast(dateCol, "STRING", "'MM-DD-YY'",
"'French_France.WE8ISO88591'");

◆ rwdbCharLength()

RWDBExpr rwdbCharLength ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

CHARACTER_LENGTH(expr)

◆ rwdbCount() [1/2]

RWDBExpr rwdbCount ( )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

COUNT(*)

◆ rwdbCount() [2/2]

RWDBExpr rwdbCount ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

COUNT(expr)

◆ rwdbCountDistinct()

RWDBExpr rwdbCountDistinct ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

COUNT DISTINCT (expr)

◆ rwdbCurrentUser()

RWDBExpr rwdbCurrentUser ( )
related

Returns an RWDBExpr representing the database-specific function that returns the name of the current user.

◆ rwdbExists()

RWDBCriterion rwdbExists ( const RWDBSelectorBase & select)
related

Returns an RWDBCriterion representing the database-specific equivalent of the SQL expression

EXISTS(<select-statement>).

In this expression, <select-statement> is the SQL select statement encapsulated by select.

◆ rwdbLower()

RWDBExpr rwdbLower ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

TOLOWER(expr)

◆ rwdbMax()

RWDBExpr rwdbMax ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

MAX(expr)

◆ rwdbMin()

RWDBExpr rwdbMin ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

MIN(expr)

◆ rwdbName()

RWDBExpr rwdbName ( const RWCString & name,
const RWDBExpr & expr )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL phrase:

expr AS name.

For example, to encapsulate the SQL statement:

SELECT name AS employeeName from employees

write:

mySelector << rwdbName("employeeName", employees["name"]);
RWDBExpr rwdbName(const RWCString &name, const RWDBExpr &expr)

◆ rwdbPosition()

RWDBExpr rwdbPosition ( const RWDBExpr & expr1,
const RWDBExpr & expr2 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

POSITION(expr1, expr2)

The goal is to produce an SQL statement that gives the index of the string expr1 in expr2.

◆ rwdbSessionUser()

RWDBExpr rwdbSessionUser ( )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SESSION_USER()

The details of the SESSION_USER() function are vendor-specific.

◆ rwdbSubString() [1/2]

RWDBExpr rwdbSubString ( const RWDBExpr & expr1,
const RWDBExpr & expr2 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SUBSTRING(expr1, expr2)

The goal is to produce an SQL statement that gives the substring of expr1 starting at the index given by expr2.

◆ rwdbSubString() [2/2]

RWDBExpr rwdbSubString ( const RWDBExpr & expr1,
const RWDBExpr & expr2,
const RWDBExpr & expr3 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SUBSTRING(expr1, expr2, expr3)

The goal is to produce an SQL statement that gives the substring of expr1 starting at the index given by expr2, with length given by expr3.

◆ rwdbSum()

RWDBExpr rwdbSum ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SUM(expr)

◆ rwdbSystemDateTime()

RWDBExpr rwdbSystemDateTime ( )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SYSTEM_DATETIME()

◆ rwdbSystemUser()

RWDBExpr rwdbSystemUser ( )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

SYSTEM_USER()

◆ rwdbTrimBoth()

RWDBExpr rwdbTrimBoth ( const RWDBExpr & expr1,
const RWDBExpr & expr2 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

TRIM_BOTH(expr1, expr2)

where expr1 represents the character to trim and expr2 represents the string expression to be trimmed.

◆ rwdbTrimLeading()

RWDBExpr rwdbTrimLeading ( const RWDBExpr & expr1,
const RWDBExpr & expr2 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

TRIM_LEADING(expr1, expr2)

where expr1 represents the character to trim and expr2 represents the string expression to be trimmed.

◆ rwdbTrimTrailing()

RWDBExpr rwdbTrimTrailing ( const RWDBExpr & expr1,
const RWDBExpr & expr2 )
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

TRIM_TRAILING(exp1, expr2)

where expr1 represents the character to trim and expr2 represents the string expression to be trimmed.

◆ rwdbUpper()

RWDBExpr rwdbUpper ( const RWDBExpr & expr)
related

Returns an RWDBExpr representing the database-specific equivalent of the SQL function:

UPPER(expr)

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