KDbOrderByColumn
#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) | |
KDbQueryColumnInfo * | column () const |
KDbOrderByColumn * | copy (KDbConnection *conn, KDbQuerySchema *fromQuery, KDbQuerySchema *toQuery) const |
KDbField * | field () const |
bool | operator!= (const KDbOrderByColumn &other) const |
KDbOrderByColumn & | operator= (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
|
strong |
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 | ) |
◆ KDbOrderByColumn() [3/4]
|
explicit |
Creates information about a single query column column used for sorting.
Definition at line 98 of file KDbOrderByColumn.cpp.
◆ KDbOrderByColumn() [4/4]
|
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()
|
inlinestatic |
Converts order to SortOrder type.
Definition at line 119 of file KDbOrderByColumn.h.
◆ operator!=()
|
inline |
- Returns
true
if this object is not equal to other; otherwise returnsfalse
.
- 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()
|
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:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.