KDbOrderByColumnList

Search for usage in LXR

KDbOrderByColumnList Class Reference

#include <KDbOrderByColumn.h>

Public Member Functions

 KDbOrderByColumnList ()
 
 KDbOrderByColumnList (const KDbOrderByColumnList &other, KDbConnection *conn, KDbQuerySchema *fromQuery, KDbQuerySchema *toQuery)
 
bool appendColumn (KDbConnection *conn, KDbQuerySchema *querySchema, KDbOrderByColumn::SortOrder order=KDbOrderByColumn::SortOrder::Ascending, int pos=-1)
 
void appendColumn (KDbQueryColumnInfo *columnInfo, KDbOrderByColumn::SortOrder order=KDbOrderByColumn::SortOrder::Ascending)
 
bool appendField (KDbConnection *conn, KDbQuerySchema *querySchema, const QString &fieldName, KDbOrderByColumn::SortOrder order=KDbOrderByColumn::SortOrder::Ascending)
 
void appendField (KDbField *field, KDbOrderByColumn::SortOrder order=KDbOrderByColumn::SortOrder::Ascending)
 
bool appendFields (KDbConnection *conn, KDbQuerySchema *querySchema, const QString &field1, KDbOrderByColumn::SortOrder order1=KDbOrderByColumn::SortOrder::Ascending, const QString &field2=QString(), KDbOrderByColumn::SortOrder order2=KDbOrderByColumn::SortOrder::Ascending, const QString &field3=QString(), KDbOrderByColumn::SortOrder order3=KDbOrderByColumn::SortOrder::Ascending, const QString &field4=QString(), KDbOrderByColumn::SortOrder order4=KDbOrderByColumn::SortOrder::Ascending, const QString &field5=QString(), KDbOrderByColumn::SortOrder order5=KDbOrderByColumn::SortOrder::Ascending)
 
QList< KDbOrderByColumn * >::Iterator begin ()
 
void clear ()
 
QList< KDbOrderByColumn * >::ConstIterator constBegin () const
 
QList< KDbOrderByColumn * >::ConstIterator constEnd () const
 
int count () const
 
QList< KDbOrderByColumn * >::Iterator end ()
 
bool isEmpty () const
 
bool operator!= (const KDbOrderByColumnList &other) const
 
bool operator== (const KDbOrderByColumnList &other) const
 
KDbEscapedString toSqlString (bool includeTableNames, KDbConnection *conn, KDbQuerySchema *query, KDb::IdentifierEscapingType escapingType=KDb::DriverEscaping) const
 
KDB_DEPRECATED KDbEscapedString toSqlString (bool includeTableNames=true, KDbConnection *conn=nullptr, KDb::IdentifierEscapingType escapingType=KDb::DriverEscaping) const
 
KDbOrderByColumnvalue (int index)
 
const KDbOrderByColumnvalue (int index) const
 

Detailed Description

KDbOrderByColumnList provides list of sorted columns for a query schema.

Definition at line 127 of file KDbOrderByColumn.h.

Constructor & Destructor Documentation

◆ KDbOrderByColumnList() [1/2]

KDbOrderByColumnList::KDbOrderByColumnList ( )

Constructs empty list of ordered columns.

Definition at line 279 of file KDbOrderByColumn.cpp.

◆ KDbOrderByColumnList() [2/2]

KDbOrderByColumnList::KDbOrderByColumnList ( const KDbOrderByColumnList other,
KDbConnection conn,
KDbQuerySchema fromQuery,
KDbQuerySchema toQuery 
)

A copy constructor.

Definition at line 284 of file KDbOrderByColumn.cpp.

Member Function Documentation

◆ appendColumn() [1/2]

bool KDbOrderByColumnList::appendColumn ( KDbConnection conn,
KDbQuerySchema querySchema,
KDbOrderByColumn::SortOrder  order = KDbOrderByColumn::SortOrder::Ascending,
int  pos = -1 
)

Appends a column that is at position pos (counted from 0).

Returns
true on successful adding and false if there is no such position pos. Returns false if querySchema is nullptr.

Definition at line 360 of file KDbOrderByColumn.cpp.

◆ appendColumn() [2/2]

void KDbOrderByColumnList::appendColumn ( KDbQueryColumnInfo columnInfo,
KDbOrderByColumn::SortOrder  order = KDbOrderByColumn::SortOrder::Ascending 
)

Appends column columnInfo. Does nothing if columnInfo is nullptr.

Definition at line 352 of file KDbOrderByColumn.cpp.

◆ appendField() [1/2]

bool KDbOrderByColumnList::appendField ( KDbConnection conn,
KDbQuerySchema querySchema,
const QString fieldName,
KDbOrderByColumn::SortOrder  order = KDbOrderByColumn::SortOrder::Ascending 
)

Appends field with a name field.

Returns
true on successful appending, and false if there is no such field or alias name in the querySchema. Returns false if querySchema is nullptr.

Definition at line 382 of file KDbOrderByColumn.cpp.

◆ appendField() [2/2]

void KDbOrderByColumnList::appendField ( KDbField field,
KDbOrderByColumn::SortOrder  order = KDbOrderByColumn::SortOrder::Ascending 
)

Appends a field field. Read documentation of KDbOrderByColumn(KDbField* field, SortOrder order) for more info. Does nothing if field is nullptr.

Definition at line 375 of file KDbOrderByColumn.cpp.

◆ appendFields()

bool KDbOrderByColumnList::appendFields ( KDbConnection conn,
KDbQuerySchema querySchema,
const QString field1,
KDbOrderByColumn::SortOrder  order1 = KDbOrderByColumn::SortOrder::Ascending,
const QString field2 = QString(),
KDbOrderByColumn::SortOrder  order2 = KDbOrderByColumn::SortOrder::Ascending,
const QString field3 = QString(),
KDbOrderByColumn::SortOrder  order3 = KDbOrderByColumn::SortOrder::Ascending,
const QString field4 = QString(),
KDbOrderByColumn::SortOrder  order4 = KDbOrderByColumn::SortOrder::Ascending,
const QString field5 = QString(),
KDbOrderByColumn::SortOrder  order5 = KDbOrderByColumn::SortOrder::Ascending 
)

Appends multiple fields for sorting. querySchema is used to find appropriate field or alias name.

Returns
false if there is at least one name for which a field or alias name does not exist (all the newly appended fields are removed in this case) Returns false if querySchema is nullptr.

Definition at line 318 of file KDbOrderByColumn.cpp.

◆ begin()

QList< KDbOrderByColumn * >::Iterator KDbOrderByColumnList::begin ( )

Returns an STL-style iterator pointing to the first column in the list.

Definition at line 412 of file KDbOrderByColumn.cpp.

◆ clear()

void KDbOrderByColumnList::clear ( )

Removes all elements from the list (deletes them).

Definition at line 468 of file KDbOrderByColumn.cpp.

◆ constBegin()

QList< KDbOrderByColumn * >::ConstIterator KDbOrderByColumnList::constBegin ( ) const

Returns an const STL-style iterator pointing to the first column in the list.

Definition at line 422 of file KDbOrderByColumn.cpp.

◆ constEnd()

QList< KDbOrderByColumn * >::ConstIterator KDbOrderByColumnList::constEnd ( ) const

Returns a const STL-style iterator pointing to the imaginary item after the last column in the list.

Definition at line 427 of file KDbOrderByColumn.cpp.

◆ count()

int KDbOrderByColumnList::count ( ) const
Returns
number of elements of the list.

Definition at line 407 of file KDbOrderByColumn.cpp.

◆ end()

QList< KDbOrderByColumn * >::Iterator KDbOrderByColumnList::end ( )

Returns an STL-style iterator pointing to the imaginary item after the last column in the list.

Definition at line 417 of file KDbOrderByColumn.cpp.

◆ isEmpty()

bool KDbOrderByColumnList::isEmpty ( ) const
Returns
true if the list is empty.

Definition at line 402 of file KDbOrderByColumn.cpp.

◆ operator!=()

bool KDbOrderByColumnList::operator!= ( const KDbOrderByColumnList other) const
inline
Returns
true if this object is not equal to other; otherwise returns false.
Since
3.1

Definition at line 145 of file KDbOrderByColumn.h.

◆ operator==()

bool KDbOrderByColumnList::operator== ( const KDbOrderByColumnList other) const
Returns
true if this object is equal to other; otherwise returns false.
Since
3.1

Definition at line 303 of file KDbOrderByColumn.cpp.

◆ toSqlString() [1/2]

KDbEscapedString KDbOrderByColumnList::toSqlString ( bool  includeTableNames,
KDbConnection conn,
KDbQuerySchema query,
KDb::IdentifierEscapingType  escapingType = KDb::DriverEscaping 
) const

Return an SQL string like "name ASC, 2 DESC" usable for building an SQL statement.

If includeTableNames is true (the default) fields that are related to a table are printed as "tablename.fieldname".

escapingType can be used to alter default escaping type. If conn is not provided for DriverEscaping, no escaping is performed. If query is provided, it can be used to obtain alias information.

Since
3.2

Definition at line 449 of file KDbOrderByColumn.cpp.

◆ toSqlString() [2/2]

KDbEscapedString KDbOrderByColumnList::toSqlString ( bool  includeTableNames = true,
KDbConnection conn = nullptr,
KDb::IdentifierEscapingType  escapingType = KDb::DriverEscaping 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Deprecated:
since 3.2, use overload that also takes query schema

Definition at line 462 of file KDbOrderByColumn.cpp.

◆ value() [1/2]

KDbOrderByColumn * KDbOrderByColumnList::value ( int  index)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 313 of file KDbOrderByColumn.cpp.

◆ value() [2/2]

const KDbOrderByColumn * KDbOrderByColumnList::value ( int  index) const

Returns column with given index.

Since
3.1

Definition at line 308 of file KDbOrderByColumn.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 Fri Aug 12 2022 04:06:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.