Changeset View
Changeset View
Standalone View
Standalone View
src/KDbOrderByColumn.h
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org> | 2 | Copyright (C) 2003-2018 Jarosław Staniek <staniek@kde.org> | ||
3 | 3 | | |||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. | ||
8 | 8 | | |||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
84 | 84 | | |||
85 | //! @return true if this column is the same as @a col | 85 | //! @return true if this column is the same as @a col | ||
86 | bool operator==(const KDbOrderByColumn& col) const; | 86 | bool operator==(const KDbOrderByColumn& col) const; | ||
87 | 87 | | |||
88 | //! @return @c true if this object is not equal to @a other; otherwise returns @c false. | 88 | //! @return @c true if this object is not equal to @a other; otherwise returns @c false. | ||
89 | //! @since 3.1 | 89 | //! @since 3.1 | ||
90 | inline bool operator!=(const KDbOrderByColumn &other) const { return !operator==(other); } | 90 | inline bool operator!=(const KDbOrderByColumn &other) const { return !operator==(other); } | ||
91 | 91 | | |||
92 | /*! @return a string like "name ASC" usable for building an SQL statement. | 92 | /** Return an SQL string like "name ASC" or "2 DESC" usable for building an SQL statement | ||
93 | If @a includeTableNames is true (the default) field is output in a form | 93 | * | ||
94 | of "tablename.fieldname" (but only if fieldname is not a name of alias). | 94 | * If @a includeTableNames is @c true fields that are related to a table are | ||
95 | 95 | * printed as "tablename.fieldname". | |||
96 | @a escapingType can be used to alter default escaping type. | 96 | * | ||
97 | If @a conn is not provided for DriverEscaping, no escaping is performed. */ | 97 | * @a escapingType can be used to alter default escaping type. | ||
98 | KDbEscapedString toSqlString(bool includeTableName = true, | 98 | * If @a conn is not provided for DriverEscaping, no escaping is performed. | ||
99 | * If @a query is provided, it can be used to obtain alias information. | ||||
100 | * | ||||
101 | * @since 3.2 | ||||
102 | */ | ||||
103 | KDbEscapedString toSqlString(bool includeTableName, | ||||
104 | KDbConnection *conn, KDbQuerySchema *query, | ||||
105 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | ||||
106 | | ||||
107 | /*! @overload | ||||
108 | | ||||
109 | @deprecated since 3.2, use overload that also takes query schema | ||||
110 | */ | ||||
111 | KDB_DEPRECATED KDbEscapedString toSqlString(bool includeTableName = true, | ||||
99 | KDbConnection *conn = nullptr, | 112 | KDbConnection *conn = nullptr, | ||
100 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | 113 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | ||
101 | 114 | | |||
102 | //! Converts @a order to Qt::SortOrder type | 115 | //! Converts @a order to Qt::SortOrder type | ||
103 | inline static Qt::SortOrder toQt(SortOrder order) { return static_cast<Qt::SortOrder>(order); } | 116 | inline static Qt::SortOrder toQt(SortOrder order) { return static_cast<Qt::SortOrder>(order); } | ||
104 | 117 | | |||
105 | //! Converts @a order to SortOrder type | 118 | //! Converts @a order to SortOrder type | ||
106 | inline static SortOrder fromQt(Qt::SortOrder order) { return static_cast<SortOrder>(order); } | 119 | inline static SortOrder fromQt(Qt::SortOrder order) { return static_cast<SortOrder>(order); } | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 129 | public: | |||
196 | /*! Returns an const STL-style iterator pointing to the first column in the list. */ | 209 | /*! Returns an const STL-style iterator pointing to the first column in the list. */ | ||
197 | QList<KDbOrderByColumn*>::ConstIterator constBegin() const; | 210 | QList<KDbOrderByColumn*>::ConstIterator constBegin() const; | ||
198 | 211 | | |||
199 | /*! Returns a const STL-style iterator pointing to the imaginary item after the last column | 212 | /*! Returns a const STL-style iterator pointing to the imaginary item after the last column | ||
200 | * in the list. | 213 | * in the list. | ||
201 | */ | 214 | */ | ||
202 | QList<KDbOrderByColumn*>::ConstIterator constEnd() const; | 215 | QList<KDbOrderByColumn*>::ConstIterator constEnd() const; | ||
203 | 216 | | |||
204 | /*! @return an SQL string like "name ASC, 2 DESC" usable for building an SQL statement. | 217 | /** Return an SQL string like "name ASC, 2 DESC" usable for building an SQL statement | ||
205 | If @a includeTableNames is true (the default) fields are output in a form | 218 | * | ||
206 | of "tablename.fieldname". | 219 | * If @a includeTableNames is @c true (the default) fields that are related to a table are | ||
207 | 220 | * printed as "tablename.fieldname". | |||
208 | @a escapingType can be used to alter default escaping type. | 221 | * | ||
209 | If @a conn is not provided for DriverEscaping, no escaping is performed. */ | 222 | * @a escapingType can be used to alter default escaping type. | ||
210 | KDbEscapedString toSqlString(bool includeTableNames = true, | 223 | * If @a conn is not provided for DriverEscaping, no escaping is performed. | ||
224 | * If @a query is provided, it can be used to obtain alias information. | ||||
225 | * | ||||
226 | * @since 3.2 | ||||
227 | */ | ||||
228 | KDbEscapedString toSqlString(bool includeTableNames, | ||||
229 | KDbConnection *conn, KDbQuerySchema *query, | ||||
230 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | ||||
231 | | ||||
232 | /*! @overload | ||||
233 | | ||||
234 | @deprecated since 3.2, use overload that also takes query schema | ||||
235 | */ | ||||
236 | KDB_DEPRECATED KDbEscapedString toSqlString(bool includeTableNames = true, | ||||
211 | KDbConnection *conn = nullptr, | 237 | KDbConnection *conn = nullptr, | ||
212 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | 238 | KDb::IdentifierEscapingType escapingType = KDb::DriverEscaping) const; | ||
239 | | ||||
213 | private: | 240 | private: | ||
214 | class Private; | 241 | class Private; | ||
215 | Private * const d; | 242 | Private * const d; | ||
216 | Q_DISABLE_COPY(KDbOrderByColumnList) | 243 | Q_DISABLE_COPY(KDbOrderByColumnList) | ||
217 | }; | 244 | }; | ||
218 | 245 | | |||
219 | //! Sends order-by-column information @a order to debug output @a dbg. | 246 | //! Sends order-by-column information @a order to debug output @a dbg. | ||
220 | KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbOrderByColumn& order); | 247 | KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbOrderByColumn& order); | ||
221 | 248 | | |||
222 | //! Sends order-by-column-list information @a list to debug output @a dbg. | 249 | //! Sends order-by-column-list information @a list to debug output @a dbg. | ||
223 | KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbOrderByColumnList& list); | 250 | KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbOrderByColumnList& list); | ||
224 | 251 | | |||
225 | #endif | 252 | #endif |