KDb
KDbQuerySchema.cpp
427 dbg.nospace() << qPrintable(QString::fromLatin1(" - ORDER BY (%1):\n").arg(query.orderByColumnList()->count()));
732 : (onlyVisible ? cache->visibleFieldsExpandedWithInternalAndRecordId : cache->fieldsExpandedWithInternalAndRecordId);
790KDbQueryColumnInfo* KDbQuerySchema::expandedOrInternalField(KDbConnection *conn, int index) const
815 KDbQueryColumnInfo::List lookup_list; //temporary, for collecting additional fields related to lookup fields
816 QHash<KDbQueryColumnInfo*, bool> columnInfosOutsideAsterisks; //helper for filling d->columnInfosByName
818 int numberOfColumnsWithMultipleVisibleFields = 0; //used to find an unique name for anonymous field
856 KDbQueryColumnInfo *ci = new KDbQueryColumnInfo(f, columnAlias(fieldPosition), isColumnVisible(fieldPosition));
867 KDbLookupFieldSchema *lookupFieldSchema = f->table() ? f->table()->lookupFieldSchema(*f) : nullptr;
871 // Now we also need to fetch "visible" value from the lookup table, not only the value of binding.
872 // -> build LEFT OUTER JOIN clause for this purpose (LEFT, not INNER because the binding can be broken)
994 //remember field by name/alias/table.name if there's no such string yet in d->columnInfosByNameExpanded
1040 QHash<QString, int> lookup_dict; //used to fight duplicates and to update KDbQueryColumnInfo::indexForVisibleLookupValue()
1258 d->autoIncrementSqlFieldsList = KDbQuerySchema::sqlColumnsList(*autoIncrementFields(conn), conn);
1307 const KDbField::Type type = field->type(); // cache: evaluating type of expressions can be expensive
1321 KDbVariableExpression((field->table() ? (field->table()->name() + QLatin1Char('.')) : QString()) + field->name())
The KDbBinaryExpression class represents binary operation.
Definition KDbExpression.h:341
Provides database connection, allowing queries and data modification.
Definition KDbConnection.h:52
virtual QString escapeIdentifier(const QString &id) const
Identifier escaping function in the associated KDbDriver.
Definition KDbConnection.cpp:3044
KDbTableSchema * tableSchema(int tableId)
Definition KDbConnection.cpp:2919
KDbQuerySchema * querySchema(int queryId)
Definition KDbConnection.cpp:3021
The KDbConstExpression class represents const expression.
Definition KDbExpression.h:387
The KDbExpression class represents a base class for all expressions.
Definition KDbExpression.h:52
void getQueryParameters(QList< KDbQuerySchemaParameter > *params)
Definition KDbExpression.cpp:478
KDbExpression clone() const
Creates a deep (not shallow) copy of the KDbExpression.
Definition KDbExpression.cpp:300
Definition KDbFieldList.h:34
KDbField::List * autoIncrementFields() const
Definition KDbFieldList.cpp:396
KDbFieldList * subList(const QString &n1, const QString &n2=QString(), const QString &n3=QString(), const QString &n4=QString(), const QString &n5=QString(), const QString &n6=QString(), const QString &n7=QString(), const QString &n8=QString(), const QString &n9=QString(), const QString &n10=QString(), const QString &n11=QString(), const QString &n12=QString(), const QString &n13=QString(), const QString &n14=QString(), const QString &n15=QString(), const QString &n16=QString(), const QString &n17=QString(), const QString &n18=QString())
Definition KDbFieldList.cpp:251
virtual bool insertField(int index, KDbField *field)
Definition KDbFieldList.cpp:123
Provides information about database index that can be created for a database table.
Definition KDbIndexSchema.h:40
Record source information that can be specified for the lookup field schema.
Definition KDbLookupFieldSchema.h:50
QString typeName() const
Definition KDbLookupFieldSchema.cpp:155
Provides information about lookup field's setup.
Definition KDbLookupFieldSchema.h:124
QList< int > visibleColumns() const
Definition KDbLookupFieldSchema.cpp:685
KDbLookupFieldSchemaRecordSource recordSource() const
Definition KDbLookupFieldSchema.cpp:282
Definition KDbObject.shared.h:32
KDbOrderByColumnList provides list of sorted columns for a query schema.
Definition KDbOrderByColumn.h:128
KDbQueryAsterisk class encapsulates information about single asterisk in query definition.
Definition KDbQueryAsterisk.h:51
Helper class that assigns additional information for the column in a query.
Definition KDbQueryColumnInfo.h:41
KDbQueryColumnInfo * foreignColumn()
Definition KDbQueryColumnInfo.cpp:93
void setIndexForVisibleLookupValue(int index)
Definition KDbQueryColumnInfo.cpp:88
KDbQuerySchema provides information about database query.
Definition KDbQuerySchema.h:46
KDbQueryColumnInfo::Vector fieldsExpanded(KDbConnection *conn, FieldsExpandedMode mode=FieldsExpandedMode::Default) const
Definition KDbQuerySchema.h:501
@ UnexpandedList
A map for unexpanded list is created.
@ UnexpandedListWithoutAsterisks
A map for unexpanded list is created, with asterisks skipped.
bool insertField(int position, KDbField *field) override
Definition KDbQuerySchema.cpp:116
bool addAsteriskInternal(KDbQueryAsterisk *asterisk, bool visible)
Internal method used by add*Asterisk() methods.
Definition KDbQuerySchema.cpp:292
KDbRelationship * addRelationship(KDbField *field1, KDbField *field2)
Definition KDbQuerySchema.cpp:1198
KDbExpression whereExpression() const
Definition KDbQuerySchema.cpp:1354
QList< KDbQuerySchemaParameter > parameters(KDbConnection *conn) const
Definition KDbQuerySchema.cpp:1376
int pkeyFieldCount(KDbConnection *conn)
Definition KDbQuerySchema.cpp:1192
bool setTableAlias(int position, const QString &alias)
Definition KDbQuerySchema.cpp:647
void setStatement(const KDbEscapedString &sql)
Definition KDbQuerySchema.cpp:679
bool addExpression(const KDbExpression &expr)
Appends a column built on top of expr expression.
Definition KDbQuerySchema.cpp:271
int tablePositionForAlias(const QString &name) const
Definition KDbQuerySchema.cpp:597
int tableBoundToColumn(int columnPosition) const
Definition KDbQuerySchema.cpp:206
bool isColumnVisible(int position) const
Definition KDbQuerySchema.cpp:281
bool insertFieldInternal(int position, KDbField *field, int bindToTable, bool visible)
Internal method used by all insert*Field methods.
Definition KDbQuerySchema.cpp:136
KDbEscapedString autoIncrementSqlFieldsList(KDbConnection *conn) const
Definition KDbQuerySchema.cpp:1251
KDbOrderByColumnList * orderByColumnList()
Definition KDbQuerySchema.cpp:1366
FieldsExpandedMode
Mode for fieldsExpanded() and visibleFieldsExpanded()
Definition KDbQuerySchema.h:452
@ WithInternalFields
Like Default but internal fields (for lookup) are appended.
@ WithInternalFieldsAndRecordId
Like WithInternalFields but record ID (big int type) field is appended after internal fields.
void setMasterTable(KDbTableSchema *table)
Definition KDbQuerySchema.cpp:457
void setColumnVisible(int position, bool visible)
Sets visibility flag for column at position to visible.
Definition KDbQuerySchema.cpp:286
bool hasColumnAlias(int position) const
Definition KDbQuerySchema.cpp:549
QString tableAliasOrName(const QString &tableName) const
Definition KDbQuerySchema.cpp:588
KDbQueryColumnInfo * columnInfo(KDbConnection *conn, const QString &identifier, ExpandMode mode=ExpandMode::Expanded) const
Definition KDbQuerySchema.cpp:707
bool addToWhereExpression(KDbField *field, const QVariant &value, KDbToken relation='=', QString *errorMessage=nullptr, QString *errorDescription=nullptr)
Appends a part to WHERE expression.
Definition KDbQuerySchema.cpp:1299
int columnPositionForAlias(const QString &name) const
Definition KDbQuerySchema.cpp:637
QVector< int > pkeyFieldsOrder(KDbConnection *conn) const
Definition KDbQuerySchema.cpp:1158
KDbQueryColumnInfo::Vector fieldsExpandedInternal(KDbConnection *conn, FieldsExpandedMode mode, bool onlyVisible) const
Used by fieldsExpanded(KDbConnection*, FieldsExpandedMode) and visibleFieldsExpanded(KDbConnection*,...
Definition KDbQuerySchema.cpp:715
bool removeField(KDbField *field) override
Definition KDbQuerySchema.cpp:236
const KDbField * field(KDbConnection *conn, const QString &identifier, ExpandMode mode=ExpandMode::Expanded) const
Definition KDbQuerySchema.cpp:684
KDbQueryColumnInfo * expandedOrInternalField(KDbConnection *conn, int index) const
Definition KDbQuerySchema.cpp:790
bool setColumnAlias(int position, const QString &alias)
Definition KDbQuerySchema.cpp:554
bool validate(QString *errorMessage=nullptr, QString *errorDescription=nullptr)
Definition KDbQuerySchema.cpp:1393
QHash< KDbQueryColumnInfo *, int > columnsOrder(KDbConnection *conn, ColumnsOrderMode mode=ColumnsOrderMode::ExpandedList) const
Definition KDbQuerySchema.cpp:1146
@ Expanded
Expanded list of the query fields is computed so queries with asterisks are processed well.
bool hasTableAlias(int position) const
Definition KDbQuerySchema.cpp:627
QList< int > tablePositions(const QString &tableName) const
Definition KDbQuerySchema.cpp:614
KDbField * findTableField(const QString &fieldOrTableAndFieldName) const
Definition KDbQuerySchema.cpp:518
bool setWhereExpression(const KDbExpression &expr, QString *errorMessage=nullptr, QString *errorDescription=nullptr)
Sets a WHERE expression exp.
Definition KDbQuerySchema.cpp:1275
KDbTableSchema * table(const QString &tableName) const
Definition KDbQuerySchema.cpp:502
static KDbEscapedString sqlColumnsList(const KDbQueryColumnInfo::List &infolist, KDbConnection *conn=nullptr, KDb::IdentifierEscapingType escapingType=KDb::DriverEscaping)
Definition KDbQuerySchema.cpp:1234
int tablePosition(const QString &tableName) const
Definition KDbQuerySchema.cpp:602
KDbQueryColumnInfo::Vector internalFields(KDbConnection *conn) const
Definition KDbQuerySchema.cpp:784
bool addExpressionInternal(const KDbExpression &expr, bool visible)
Internal method used by all add*Expression methods.
Definition KDbQuerySchema.cpp:255
QList< KDbRelationship * > * relationships() const
Definition KDbQuerySchema.cpp:664
bool addAsterisk(KDbQueryAsterisk *asterisk)
Definition KDbQuerySchema.cpp:304
void addTable(KDbTableSchema *table, const QString &alias=QString())
Definition KDbQuerySchema.cpp:468
KDbQuerySchemaFieldsExpanded * computeFieldsExpanded(KDbConnection *conn) const
Definition KDbQuerySchema.cpp:804
bool insertInvisibleField(int position, KDbField *field)
Definition KDbQuerySchema.cpp:121
void setOrderByColumnList(const KDbOrderByColumnList &list)
Definition KDbQuerySchema.cpp:1359
Definition KDbTableSchema.h:38
KDbLookupFieldSchema * lookupFieldSchema(const KDbField &field)
Definition KDbTableSchema.cpp:388
The KDbVariableExpression class represents variables such as fieldname or tablename....
Definition KDbExpression.h:453
Q_SCRIPTABLE Q_NOREPLY void start()
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
KDB_EXPORT QString escapeIdentifier(const QString &string)
Definition KDb.cpp:1334
KDB_EXPORT bool splitToTableAndFieldParts(const QString &string, QString *tableName, QString *fieldName, SplitToTableAndFieldPartsOptions option=FailIfNoTableOrFieldName)
Definition KDb.cpp:603
QString name(StandardAction id)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
QDebug & nospace()
QDebug & space()
bool contains(const Key &key) const const
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
qsizetype count() const const
T & first()
bool isEmpty() const const
void resize(qsizetype size)
qsizetype size() const const
T value(qsizetype i) const const
bool hasNext() const const
T * take()
bool contains(const QSet< T > &other) const const
iterator insert(const T &value)
QString arg(Args &&... args) const const
void clear()
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
QString fromLatin1(QByteArrayView str)
bool isEmpty() const const
QString number(double n, char format, int precision)
QString & prepend(QChar ch)
QString toLower() const const
QString trimmed() const const
CaseInsensitive
bool isNull() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.