KDbOrderByColumn

Search for usage in LXR

#include <KDbOrderByColumn.h>

Public Types

enum class  SortOrder { Ascending = Qt::AscendingOrder , Descending = Qt::DescendingOrder }
 

Public Member Functions

 KDbOrderByColumn ()
 
 KDbOrderByColumn (const KDbOrderByColumn &other)
 
 KDbOrderByColumn (KDbField *field, SortOrder order=SortOrder::Ascending)
 
 KDbOrderByColumn (KDbQueryColumnInfo *column, SortOrder order=SortOrder::Ascending, int pos=-1)
 
KDbQueryColumnInfocolumn () const
 
KDbOrderByColumncopy (KDbConnection *conn, KDbQuerySchema *fromQuery, KDbQuerySchema *toQuery) const
 
KDbFieldfield () const
 
bool operator!= (const KDbOrderByColumn &other) const
 
KDbOrderByColumnoperator= (const KDbOrderByColumn &other)
 
bool operator== (const KDbOrderByColumn &col) const
 
int position () const
 
KDbOrderByColumn::SortOrder sortOrder () const
 
KDbEscapedString toSqlString (bool includeTableName, KDbConnection *conn, KDbQuerySchema *query, KDb::IdentifierEscapingType escapingType=KDb::DriverEscaping) const
 
KDB_DEPRECATED KDbEscapedString toSqlString (bool includeTableName=true, KDbConnection *conn=nullptr, KDb::IdentifierEscapingType escapingType=KDb::DriverEscaping) const
 

Static Public Member Functions

static SortOrder fromQt (Qt::SortOrder order)
 
static Qt::SortOrder toQt (SortOrder order)
 

Detailed Description

KDbOrderByColumn provides information about a single query column used for sorting.

The column can be expression or table field.

Definition at line 33 of file KDbOrderByColumn.h.

Member Enumeration Documentation

◆ SortOrder

enum class KDbOrderByColumn::SortOrder
strong

Column sort order.

Since
3.1

Definition at line 38 of file KDbOrderByColumn.h.

Constructor & Destructor Documentation

◆ KDbOrderByColumn() [1/4]

KDbOrderByColumn::KDbOrderByColumn ( )

Creates an empty information about a single query column.

Definition at line 93 of file KDbOrderByColumn.cpp.

◆ KDbOrderByColumn() [2/4]

KDbOrderByColumn::KDbOrderByColumn ( const KDbOrderByColumn & other)

Creates a copy of the other.

Since
3.1

Definition at line 108 of file KDbOrderByColumn.cpp.

◆ KDbOrderByColumn() [3/4]

KDbOrderByColumn::KDbOrderByColumn ( KDbQueryColumnInfo * column,
SortOrder order = SortOrder::Ascending,
int pos = -1 )
explicit

Creates information about a single query column column used for sorting.

Definition at line 98 of file KDbOrderByColumn.cpp.

◆ KDbOrderByColumn() [4/4]

KDbOrderByColumn::KDbOrderByColumn ( KDbField * field,
SortOrder order = SortOrder::Ascending )
explicit

Like above but used when the field field is not present on the list of columns.

(e.g. SELECT a FROM t ORDER BY b; where T is a table with fields (a,b)).

Definition at line 103 of file KDbOrderByColumn.cpp.

◆ ~KDbOrderByColumn()

KDbOrderByColumn::~KDbOrderByColumn ( )

Definition at line 113 of file KDbOrderByColumn.cpp.

Member Function Documentation

◆ column()

KDbQueryColumnInfo * KDbOrderByColumn::column ( ) const

A column to sort.

Definition at line 141 of file KDbOrderByColumn.cpp.

◆ copy()

KDbOrderByColumn * KDbOrderByColumn::copy ( KDbConnection * conn,
KDbQuerySchema * fromQuery,
KDbQuerySchema * toQuery ) const
Returns
copy of this KDbOrderByColumn object. fromQuery and toQuery is needed if column() is assigned to this info. Then, column info within toQuery will be assigned to the new KDbOrderByColumn object, corresponding to column() from "this" KDbOrderByColumn object.

Definition at line 118 of file KDbOrderByColumn.cpp.

◆ field()

KDbField * KDbOrderByColumn::field ( ) const

A field to sort, used only in case when the second constructor was used.

Definition at line 154 of file KDbOrderByColumn.cpp.

◆ fromQt()

static SortOrder KDbOrderByColumn::fromQt ( Qt::SortOrder order)
inlinestatic

Converts order to SortOrder type.

Definition at line 119 of file KDbOrderByColumn.h.

◆ operator!=()

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

Definition at line 90 of file KDbOrderByColumn.h.

◆ operator=()

KDbOrderByColumn & KDbOrderByColumn::operator= ( const KDbOrderByColumn & other)

Assigns other to this object returns a reference to this object.

Since
3.1

Definition at line 164 of file KDbOrderByColumn.cpp.

◆ operator==()

bool KDbOrderByColumn::operator== ( const KDbOrderByColumn & col) const
Returns
true if this column is the same as col

Definition at line 172 of file KDbOrderByColumn.cpp.

◆ position()

int KDbOrderByColumn::position ( ) const

A helper for column() that allows you to know that sorting column was defined by providing its position. -1 by default. Example query: SELECT a, b FROM T ORDER BY 2

Definition at line 149 of file KDbOrderByColumn.cpp.

◆ sortOrder()

KDbOrderByColumn::SortOrder KDbOrderByColumn::sortOrder ( ) const
Returns
sort order for the column

Definition at line 159 of file KDbOrderByColumn.cpp.

◆ toQt()

static Qt::SortOrder KDbOrderByColumn::toQt ( SortOrder order)
inlinestatic

Converts order to Qt::SortOrder type.

Definition at line 116 of file KDbOrderByColumn.h.

◆ toSqlString() [1/2]

KDbEscapedString KDbOrderByColumn::toSqlString ( bool includeTableName,
KDbConnection * conn,
KDbQuerySchema * query,
KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping ) const

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

If includeTableNames is true 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 203 of file KDbOrderByColumn.cpp.

◆ toSqlString() [2/2]

KDbEscapedString KDbOrderByColumn::toSqlString ( bool includeTableName = 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 259 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-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.