KDb
KDbFunctionExpression.cpp
95 virtual KDbField::Type returnType(const KDbFunctionExpressionData* f, KDbParseInfo* parseInfo) const {
97 const KDbNArgExpressionData *argsData = f->args.constData()->convertConst<KDbNArgExpressionData>();
135 KDbField::Type returnType(const KDbFunctionExpressionData* f, KDbParseInfo* parseInfo) const override {
140 const KDbNArgExpressionData *argsData = f->args.constData()->convertConst<KDbNArgExpressionData>();
142 KDbQueryParameterExpressionData *queryParameterExpressionData = expr->convert<KDbQueryParameterExpressionData>();
150 KDbQueryParameterExpressionData *queryParameterExpressionData = expr->convert<KDbQueryParameterExpressionData>();
172 KDbField::Type returnType(const KDbFunctionExpressionData* f, KDbParseInfo* parseInfo) const override {
173 const KDbNArgExpressionData *argsData = f->args.constData()->convertConst<KDbNArgExpressionData>();
177 const KDbField::Type type0 = argsData->children.at(0)->type(); // cache: evaluating type of expressions can be expensive
231 KDbQueryParameterExpressionData *queryParameterExpressionData = expr->convert<KDbQueryParameterExpressionData>();
281 KDbField::Type returnType(const KDbFunctionExpressionData* f, KDbParseInfo* parseInfo) const override {
282 const KDbNArgExpressionData *argsData = f->args.constData()->convertConst<KDbNArgExpressionData>();
287 const KDbConstExpressionData *const0 = argsData->children.at(0)->convertConst<KDbConstExpressionData>();
288 const KDbConstExpressionData *const1 = argsData->children.at(1)->convertConst<KDbConstExpressionData>();
347 KDbField::Type returnType(const KDbFunctionExpressionData* f, KDbParseInfo* parseInfo) const override {
349 const KDbNArgExpressionData *argsData = f->args.constData()->convertConst<KDbNArgExpressionData>();
359 const KDbField::Type type = argsData->children.at(0)->type(); // cache: evaluating type of expressions can be expensive
446 // See also https://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_ceiling
447 // See also https://www.postgresql.org/docs/9.5/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE
449 // (CASE WHEN X = CAST(X AS INT) THEN CAST(X AS INT) WHEN X >= 0 THEN CAST(X AS INT) + 1 ELSE CAST(X AS INT) END)
477 // See also https://www.postgresql.org/docs/9.5/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE
503 // See also https://www.postgresql.org/docs/9.5/static/functions-conditional.html#FUNCTIONS-GREATEST-LEAST
573 // See also https://www.postgresql.org/docs/9.5/static/functions-conditional.html#FUNCTIONS-GREATEST-LEAST
613 // See also https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-SQL
627 // See also https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-SQL
644 // See also https://www.postgresql.org/docs/9.5/static/functions-conditional.html#FUNCTIONS-NULLIF
663 // See also https://www.postgresql.org/docs/9.5/static/functions-math.html#FUNCTIONS-MATH-RANDOM-TABLE
679 // See also https://www.postgresql.org/docs/9.5/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE
681 // example: SELECT ROUND(-1.13), ROUND(-5.51), ROUND(5.51), ROUND(1.298, 1), ROUND(1.298, 0), ROUND(7)
695 // See also https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-SQL
740 // See also https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-SQL
768 // See also https://www.postgresql.org/docs/9.5/static/functions-string.html#FUNCTIONS-STRING-SQL
776 //! @todo GLOB(X,Y) is SQLite-specific and is not present in MySQL so we don't expose it; use GLOB operator instead.
849 void KDbFunctionExpressionData::debugInternal(QDebug dbg, KDb::ExpressionCallStack* callStack) const
896 QString::fromLatin1(greatestOrLeastName(name.toLatin1())), KDbNArgExpression(args), params, callStack);
907 return driver->ceilingOrFloorFunctionToString(name, KDbNArgExpression(args), params, callStack);
924 KDbField::Type KDbFunctionExpressionData::typeInternal(KDb::ExpressionCallStack* callStack) const
945 firstSentence = KDbFunctionExpressionData::tr("Too many arguments.%1", "don't use space before %1")
949 firstSentence = KDbFunctionExpressionData::tr("Too few arguments.%1", "don't use space before %1")
993 KDbFunctionExpressionData::tr("%1%2() function requires %3 or %4 or %5 argument(s).", "", argCounts[2])
1239 const KDbField::Type exprType = expr->type(); // cache: evaluating type of expressions can be expensive
1255 const KDbField::Type exprType = expr->type(); // cache: evaluating type of expressions can be expensive
1269 // Check type just now. If we checked earlier, possible error message would be less informative.
1368 const KDbNArgExpressionData *argsData = args.d.constData()->convertConst<KDbNArgExpressionData>();
KDbField::Type typeInternal(KDb::ExpressionCallStack *callStack) const override
Definition: KDbFunctionExpression.cpp:924
Internal data class used to implement implicitly shared class KDbExpression.
Definition: KDbExpressionData.h:67
QString number(int n, int base)
An iterator for a list of values of query schema parameters Allows to iterate over parameters and ret...
Definition: KDbQuerySchemaParameter.shared.h:49
Type type(const QSqlDatabase &db)
void ref()
QDebug & nospace()
Internal data class used to implement implicitly shared class KDbQueryParameterExpression.
Definition: KDbExpressionData.h:242
qlonglong toLongLong(bool *ok) const const
void setName(const QString &name)
Sets name of the function to name.
Definition: KDbFunctionExpression.cpp:1377
bool validateInternal(KDbParseInfo *parseInfo, KDb::ExpressionCallStack *callStack) override
Definition: KDbFunctionExpression.cpp:1133
virtual KDbEscapedString ifnullFunctionToString(const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) IFNULL() function call.
Definition: KDbDriver.cpp:327
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
static QString defaultSqlTypeName(KDbField::Type type)
Definition: KDbDriver.cpp:166
virtual KDbEscapedString randomFunctionToString(const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) RANDOM() and RANDOM(X,Y) function calls.
Definition: KDbDriver.cpp:352
Internal data class used to implement implicitly shared class KDbConstExpression.
Definition: KDbExpressionData.h:217
bool isEmpty() const const
KDB_EXPORT KDbField::Type maximumForIntegerFieldTypes(KDbField::Type t1, KDbField::Type t2)
Definition: KDb.cpp:1936
static KDbEscapedString greatestOrLeastFunctionUsingCaseToString(const QString &name, const KDbDriver *driver, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack)
Definition: KDbFunctionExpression.cpp:1393
virtual KDbEscapedString greatestOrLeastFunctionToString(const QString &name, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) GREATEST() and LEAST() function calls.
Definition: KDbDriver.cpp:343
void setArguments(const KDbNArgExpression &arguments)
Sets the list of arguments to arguments.
Definition: KDbFunctionExpression.cpp:1387
Internal data class used to implement implicitly shared class KDbNArgExpression.
Definition: KDbExpressionData.h:134
The KDbNArgExpression class represents a base class N-argument expression.
Definition: KDbExpression.h:212
void debugInternal(QDebug dbg, KDb::ExpressionCallStack *callStack) const override
Sends information about this expression to debug output dbg (internal).
Definition: KDbFunctionExpression.cpp:849
virtual KDbEscapedString unicodeFunctionToString(const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) UNICODE() function call.
Definition: KDbDriver.cpp:382
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromLatin1(const char *str, int size)
static KDbEscapedString toString(const QString &name, const KDbDriver *driver, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack)
Definition: KDbFunctionExpression.cpp:1361
const char * name(StandardAction id)
virtual KDbEscapedString lengthFunctionToString(const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) LENGTH() function call.
Definition: KDbDriver.cpp:335
KDbNArgExpression arguments()
Definition: KDbFunctionExpression.cpp:1382
KDbFunctionExpression()
Definition: KDbFunctionExpression.cpp:1309
Internal data class used to implement implicitly shared class KDbFunctionExpression.
Definition: KDbExpressionData.h:319
The KDbExpression class represents a base class for all expressions.
Definition: KDbExpression.h:51
The KDbFunctionExpression class represents expression that use functional notation F(x,...
Definition: KDbExpression.h:502
virtual KDbEscapedString hexFunctionToString(const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) HEX() function call.
Definition: KDbDriver.cpp:319
virtual KDbEscapedString ceilingOrFloorFunctionToString(const QString &name, const KDbNArgExpression &args, KDbQuerySchemaParameterValueListIterator *params, KDb::ExpressionCallStack *callStack) const
Generates native (driver-specific) CEILING() and FLOOR() function calls.
Definition: KDbDriver.cpp:373
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 9 2023 04:10:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 9 2023 04:10:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.