SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Private Member Functions
RWDBExprFuncDef3 Class Reference

Specialization of the base class RWDBExprFormDefinition used to define SQL functions that take 3 parameters. More...

#include <rw/db/func.h>

Inheritance diagram for RWDBExprFuncDef3:
RWDBExprFormDefinition

Public Member Functions

 RWDBExprFuncDef3 (const RWCString &functionName)
 
virtual RWDBExpr operator() (const RWDBExpr &x1, const RWDBExpr &x2, const RWDBExpr &x3)
 

Private Member Functions

virtual RWDBExpr operator() ()
 
virtual RWDBExpr operator() (const RWDBExpr &)
 
virtual RWDBExpr operator() (const RWDBExpr &, const RWDBExpr &)
 
virtual RWDBExpr operator() (const RWDBExpr &, const RWDBExpr &, const RWDBExpr &, const RWDBExpr &)
 
- Private Member Functions inherited from RWDBExprFormDefinition
 RWDBExprFormDefinition ()
 
 RWDBExprFormDefinition (const RWCString &formatString)
 

Detailed Description

RWDBExprFuncDef3 is a specialization of the base class RWDBExprFormDefinition. This class provides a simplified mechanism for defining SQL functions taking 3 parameters. Unlike the base class, this class does not require positional placeholders in its function definitions. Also, since the number of required parameters is fixed, compile-time checking can be done on the number of parameters actually passed.

Synopsis
#include <rw/db/func.h>
RWDBExprFuncDef3 myFunc("myFunc");
See also

RWDBCritFuncDef3 provides a parallel mechanism for defining an RWDBCriterion, rather than an RWDBExpr.

The RWDBExprFormDefinition base class may be used directly to gain additional flexibility.

See RWDBExpr for details on SQL expressions in the DB Interface Module, as well as for a complete listing of predefined SQL functions.

Example

Imagine that a database vendor's SQL variant provides the function DECRYPT(string, length, key). The DB Interface Module has no direct support for this function, yet we would like to use it without losing the benefits of its high-level constructs for data manipulation. To do so, we can use a function which we define ourselves:

RWDBExprFuncDef3 decrypt("DECRYPT");
RWCString key = getMyKey();
RWDBTable users = myDbase.table("users");
RWDBColumn passWord = users["passWord"];
RWDBSelector select = myDbase.selector();
select << decrypt(passWord, rwdbCharLength(passWord), key);

Notice that the number of actual parameters passed to decrypt is checked at compile time. Compare this with the RWDBExprFormDefinition example.

Constructor & Destructor Documentation

RWDBExprFuncDef3::RWDBExprFuncDef3 ( const RWCString functionName)

Creates an RWDBExprFuncDef3 for a functional expression that takes three parameters. After such an RWDBExprFuncDef3 is instantiated, functionName may be used as though it were a predefined function.

Member Function Documentation

virtual RWDBExpr RWDBExprFuncDef3::operator() ( const RWDBExpr x1,
const RWDBExpr x2,
const RWDBExpr x3 
)
virtual

Returns an RWDBExpr in the form of a function with three parameters whose name is the name which was passed to self's constructor.

Reimplemented from RWDBExprFormDefinition.

virtual RWDBExpr RWDBExprFuncDef3::operator() ( )
privatevirtual

Not applicable to this class. This class defines SQL functions taking three parameters.

Reimplemented from RWDBExprFormDefinition.

virtual RWDBExpr RWDBExprFuncDef3::operator() ( const RWDBExpr )
privatevirtual

Not applicable to this class. This class defines SQL functions taking three parameters.

Reimplemented from RWDBExprFormDefinition.

virtual RWDBExpr RWDBExprFuncDef3::operator() ( const RWDBExpr ,
const RWDBExpr  
)
privatevirtual

Not applicable to this class. This class defines SQL functions taking three parameters.

Reimplemented from RWDBExprFormDefinition.

virtual RWDBExpr RWDBExprFuncDef3::operator() ( const RWDBExpr ,
const RWDBExpr ,
const RWDBExpr ,
const RWDBExpr  
)
privatevirtual

Not applicable to this class. This class defines SQL functions taking three parameters.

Reimplemented from RWDBExprFormDefinition.

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