SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBCritFuncDef1 Class Reference

Specialization of the base class RWDBCritFormDefinition used for defining SQL functions taking 1 parameter. More...

#include <rw/db/func.h>

Inheritance diagram for RWDBCritFuncDef1:
RWDBCritFormDefinition

Public Member Functions

 RWDBCritFuncDef1 (const RWCString &functionName)
 
virtual RWDBCriterion operator() (const RWDBExpr &x1)
 

Private Member Functions

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

Detailed Description

RWDBCritFuncDef1 is a specialization of the base class RWDBCritFormDefinition. This class provides a simplified mechanism for defining SQL functions taking 1 parameter. 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>
RWDBCritFuncDef1 myFunc("myFunc");
Specialization of the base class RWDBCritFormDefinition used for defining SQL functions taking 1 para...
Definition func.h:906
See also

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

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

See RWDBCriterion for details on SQL WHERE clauses in the DB Interface Module.

Example

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

RWDBCritFuncDef1 validName("VALID_NAME");
RWDBTable potentialNames = myDbase.table("potentialNames");
RWDBColumn name = potentialNames["name"];
RWDBSelector usableNames = myDbase.selector();
usableNames << name;
usableNames.where(validName(name));
Represents a column within a table or schema, or a particular parameter of a stored procedure.
Definition column.h:147
Encapsulates the SQL SELECT statement.
Definition select.h:369
RWDBCriterion where() const
Base class for a family of classes that represent the abstract notion of a database table in a number...
Definition table.h:89

Notice that the number of actual parameters passed to validName is checked at compile time. Compare this with the example for RWDBCritFormDefinition.

Constructor & Destructor Documentation

◆ RWDBCritFuncDef1()

RWDBCritFuncDef1::RWDBCritFuncDef1 ( const RWCString & functionName)

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

Member Function Documentation

◆ operator()() [1/5]

virtual RWDBCriterion RWDBCritFuncDef1::operator() ( )
privatevirtual

Not applicable to this class. This class defines SQL functions taking one parameter.

Reimplemented from RWDBCritFormDefinition.

◆ operator()() [2/5]

virtual RWDBCriterion RWDBCritFuncDef1::operator() ( const RWDBExpr & ,
const RWDBExpr &  )
privatevirtual

Not applicable to this class. This class defines SQL functions taking one parameter.

Reimplemented from RWDBCritFormDefinition.

◆ operator()() [3/5]

virtual RWDBCriterion RWDBCritFuncDef1::operator() ( const RWDBExpr & ,
const RWDBExpr & ,
const RWDBExpr &  )
privatevirtual

Not applicable to this class. This class defines SQL functions taking one parameter.

Reimplemented from RWDBCritFormDefinition.

◆ operator()() [4/5]

virtual RWDBCriterion RWDBCritFuncDef1::operator() ( const RWDBExpr & ,
const RWDBExpr & ,
const RWDBExpr & ,
const RWDBExpr &  )
privatevirtual

Not applicable to this class. This class defines SQL functions taking one parameter.

Reimplemented from RWDBCritFormDefinition.

◆ operator()() [5/5]

virtual RWDBCriterion RWDBCritFuncDef1::operator() ( const RWDBExpr & x1)
virtual

Returns an RWDBCriterion in the form of a function with 1 parameter whose name is the name that was passed to self's constructor.

Reimplemented from RWDBCritFormDefinition.

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