KDbFunctionExpression

Search for usage in LXR

#include <KDbExpression.h>

Inheritance diagram for KDbFunctionExpression:

Public Member Functions

 KDbFunctionExpression ()
 
 KDbFunctionExpression (const KDbFunctionExpression &expr)
 
 KDbFunctionExpression (const QString &name)
 
 KDbFunctionExpression (const QString &name, const KDbNArgExpression &arguments)
 
KDbNArgExpression arguments ()
 
QString name () const
 
void setArguments (const KDbNArgExpression &arguments)
 
void setName (const QString &name)
 
KDbEscapedString toString (const KDbDriver *driver, KDbQuerySchemaParameterValueListIterator *params=nullptr, KDb::ExpressionCallStack *callStack=nullptr) const
 
- Public Member Functions inherited from KDbExpression
 KDbExpression ()
 
KDbExpression clone () const
 
QDebug debug (QDebug dbg, KDb::ExpressionCallStack *callStack) const
 
KDb::ExpressionClass expressionClass () const
 
void getQueryParameters (QList< KDbQuerySchemaParameter > *params)
 
bool isBinary () const
 
bool isConst () const
 
bool isDateTimeType () const
 
bool isFPNumericType () const
 
bool isFunction () const
 
bool isIntegerType () const
 
bool isNArg () const
 
bool isNull () const
 
bool isNumericType () const
 
bool isQueryParameter () const
 
bool isTextType () const
 
bool isUnary () const
 
bool isValid () const
 
bool isVariable () const
 
bool operator!= (const KDbExpression &e) const
 
bool operator== (const KDbExpression &e) const
 
KDbExpression parent () const
 
void setExpressionClass (KDb::ExpressionClass aClass)
 
void setToken (KDbToken token)
 
KDbBinaryExpression toBinary () const
 
KDbConstExpression toConst () const
 
KDbFunctionExpression toFunction () const
 
KDbToken token () const
 
KDbNArgExpression toNArg () const
 
KDbQueryParameterExpression toQueryParameter () const
 
KDbEscapedString toString (const KDbDriver *driver, KDbQuerySchemaParameterValueListIterator *params=nullptr, KDb::ExpressionCallStack *callStack=nullptr) const
 
KDbUnaryExpression toUnary () const
 
KDbVariableExpression toVariable () const
 
KDbField::Type type () const
 
bool validate (KDbParseInfo *parseInfo)
 

Static Public Member Functions

static QStringList builtInAggregates ()
 
static KDbEscapedString greatestOrLeastFunctionUsingCaseToString (const QString &name, const KDbDriver *driver, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack)
 
static bool isBuiltInAggregate (const QString &function)
 
static KDbEscapedString toString (const QString &name, const KDbDriver *driver, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack)
 
- Static Public Member Functions inherited from KDbExpression
static KDb::ExpressionClass classForToken (KDbToken token)
 

Protected Member Functions

 KDbFunctionExpression (const ExplicitlySharedExpressionDataPointer &ptr)
 
 KDbFunctionExpression (KDbExpressionData *data)
 
- Protected Member Functions inherited from KDbExpression
 KDbExpression (const ExplicitlySharedExpressionDataPointer &ptr)
 
 KDbExpression (KDbExpressionData *data)
 
 KDbExpression (KDbExpressionData *data, KDb::ExpressionClass aClass, KDbToken token)
 
void appendChild (const ExplicitlySharedExpressionDataPointer &child)
 
void appendChild (const KDbExpression &child)
 
bool checkBeforeInsert (const ExplicitlySharedExpressionDataPointer &child)
 
QList< ExplicitlySharedExpressionDataPointerchildren () const
 
int indexOfChild (const KDbExpression &child, int from=0) const
 
void insertChild (int i, const KDbExpression &child)
 
void insertEmptyChild (int i)
 
int lastIndexOfChild (const KDbExpression &child, int from=-1) const
 
void prependChild (const KDbExpression &child)
 
bool removeChild (const KDbExpression &child)
 
void removeChild (int i)
 
void setLeftOrRight (const KDbExpression &right, int index)
 
KDbExpression takeChild (int i)
 

Additional Inherited Members

- Protected Attributes inherited from KDbExpression
ExplicitlySharedExpressionDataPointer d
 

Detailed Description

The KDbFunctionExpression class represents expression that use functional notation F(x, ...)

The functions list include:

  • aggregation functions like SUM, COUNT, MAX, ...
  • builtin functions like CURRENT_TIME()
  • user defined functions

Definition at line 502 of file KDbExpression.h.

Constructor & Destructor Documentation

◆ KDbFunctionExpression() [1/4]

KDbFunctionExpression::KDbFunctionExpression ( )

Constructs a null function expression.

See also
KDbExpression::isNull()

Definition at line 1307 of file KDbFunctionExpression.cpp.

◆ KDbFunctionExpression() [2/4]

KDbFunctionExpression::KDbFunctionExpression ( const QString name)
explicit

Constructs function expression with name name, without arguments.

Definition at line 1313 of file KDbFunctionExpression.cpp.

◆ KDbFunctionExpression() [3/4]

KDbFunctionExpression::KDbFunctionExpression ( const QString name,
const KDbNArgExpression arguments 
)

Constructs function expression with name name and arguments arguments.

Definition at line 1319 of file KDbFunctionExpression.cpp.

◆ KDbFunctionExpression() [4/4]

KDbFunctionExpression::KDbFunctionExpression ( const KDbFunctionExpression expr)

Constructs a copy of other function expression expr. Resulting object is not a deep copy but rather a reference to the object expr.

Definition at line 1326 of file KDbFunctionExpression.cpp.

Member Function Documentation

◆ arguments()

KDbNArgExpression KDbFunctionExpression::arguments ( )
Returns
list of arguments of the function.

Definition at line 1380 of file KDbFunctionExpression.cpp.

◆ greatestOrLeastFunctionUsingCaseToString()

KDbEscapedString KDbFunctionExpression::greatestOrLeastFunctionUsingCaseToString ( const QString name,
const KDbDriver driver,
const KDbNArgExpression args,
KDbQuerySchemaParameterValueListIterator params,
KDb::ExpressionCallStack callStack 
)
static
Returns
a native (driver-specific) GREATEST() and LEAST() function calls generated to string using CASE WHEN... keywords. This is a workaround for cases when LEAST()/GREATEST() function ignores NULL values and only returns NULL if all the expressions evaluate to NULL. Instead of using F(v0,..,vN), this is used: (CASE WHEN (v0) IS NULL OR .. OR (vN) IS NULL THEN NULL ELSE F(v0,..,vN) END) where F == GREATEST or LEAST. Actually it is needed by MySQL < 5.0.13 and PostgreSQL.

Definition at line 1391 of file KDbFunctionExpression.cpp.

◆ name()

QString KDbFunctionExpression::name ( ) const
Returns
name of the function.

Definition at line 1370 of file KDbFunctionExpression.cpp.

◆ setArguments()

void KDbFunctionExpression::setArguments ( const KDbNArgExpression arguments)

Sets the list of arguments to arguments.

Definition at line 1385 of file KDbFunctionExpression.cpp.

◆ setName()

void KDbFunctionExpression::setName ( const QString name)

Sets name of the function to name.

Definition at line 1375 of file KDbFunctionExpression.cpp.

◆ toString() [1/2]

KDbEscapedString KDbExpression::toString
Returns
string as a representation of this expression element by running recursive calls. param, if not 0, points to a list item containing value of a query parameter (used in QueryParameterExpr). The result may depend on the optional driver parameter. If driver is 0, representation for portable KDbSQL dialect is returned.

Definition at line 469 of file KDbExpression.cpp.

◆ toString() [2/2]

KDbEscapedString KDbFunctionExpression::toString ( const QString name,
const KDbDriver driver,
const KDbNArgExpression args,
KDbQuerySchemaParameterValueListIterator params,
KDb::ExpressionCallStack callStack 
)
static

Constructs function expression with name name and args args.

Definition at line 1359 of file KDbFunctionExpression.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 04:12:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.