Changeset View
Changeset View
Standalone View
Standalone View
src/KDbOrderByColumn.h
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
---|---|---|---|---|---|
56 | explicit KDbOrderByColumn(KDbField* field, SortOrder order = SortOrder::Ascending); | 56 | explicit KDbOrderByColumn(KDbField* field, SortOrder order = SortOrder::Ascending); | ||
57 | 57 | | |||
58 | ~KDbOrderByColumn(); | 58 | ~KDbOrderByColumn(); | ||
59 | 59 | | |||
60 | /*! @return copy of this KDbOrderByColumn object. | 60 | /*! @return copy of this KDbOrderByColumn object. | ||
61 | In @a fromQuery and @a toQuery is needed if column() is assigned to this info. | 61 | In @a fromQuery and @a toQuery is needed if column() is assigned to this info. | ||
62 | Then, column info within @a toQuery will be assigned to the new KDbOrderByColumn object, | 62 | Then, column info within @a toQuery will be assigned to the new KDbOrderByColumn object, | ||
63 | corresponding to column() from "this" KDbOrderByColumn object. */ | 63 | corresponding to column() from "this" KDbOrderByColumn object. */ | ||
64 | KDbOrderByColumn* copy(KDbQuerySchema* fromQuery, KDbQuerySchema* toQuery) const; | 64 | KDbOrderByColumn *copy(KDbConnection *conn, KDbQuerySchema *fromQuery, | ||
65 | KDbQuerySchema *toQuery) const; | ||||
65 | 66 | | |||
66 | //! A column to sort. | 67 | //! A column to sort. | ||
67 | KDbQueryColumnInfo* column() const; | 68 | KDbQueryColumnInfo* column() const; | ||
68 | 69 | | |||
69 | /*! A helper for column() that allows you to know that sorting column | 70 | /*! A helper for column() that allows you to know that sorting column | ||
70 | was defined by providing its position. -1 by default. | 71 | was defined by providing its position. -1 by default. | ||
71 | Example query: SELECT a, b FROM T ORDER BY 2 */ | 72 | Example query: SELECT a, b FROM T ORDER BY 2 */ | ||
72 | int position() const; | 73 | int position() const; | ||
Show All 39 Lines | |||||
112 | //! @short KDbOrderByColumnList provides list of sorted columns for a query schema | 113 | //! @short KDbOrderByColumnList provides list of sorted columns for a query schema | ||
113 | class KDB_EXPORT KDbOrderByColumnList | 114 | class KDB_EXPORT KDbOrderByColumnList | ||
114 | { | 115 | { | ||
115 | public: | 116 | public: | ||
116 | /*! Constructs empty list of ordered columns. */ | 117 | /*! Constructs empty list of ordered columns. */ | ||
117 | KDbOrderByColumnList(); | 118 | KDbOrderByColumnList(); | ||
118 | 119 | | |||
119 | /*! A copy constructor. */ | 120 | /*! A copy constructor. */ | ||
120 | KDbOrderByColumnList(const KDbOrderByColumnList& other, | 121 | KDbOrderByColumnList(const KDbOrderByColumnList& other, KDbConnection *conn, | ||
121 | KDbQuerySchema* fromQuery, KDbQuerySchema* toQuery); | 122 | KDbQuerySchema* fromQuery, KDbQuerySchema* toQuery); | ||
122 | 123 | | |||
123 | ~KDbOrderByColumnList(); | 124 | ~KDbOrderByColumnList(); | ||
124 | 125 | | |||
125 | //! @return @c true if this object is equal to @a other; otherwise returns @c false. | 126 | //! @return @c true if this object is equal to @a other; otherwise returns @c false. | ||
126 | //! @since 3.1 | 127 | //! @since 3.1 | ||
127 | bool operator==(const KDbOrderByColumnList &other) const; | 128 | bool operator==(const KDbOrderByColumnList &other) const; | ||
128 | 129 | | |||
129 | //! @return @c true if this object is not equal to @a other; otherwise returns @c false. | 130 | //! @return @c true if this object is not equal to @a other; otherwise returns @c false. | ||
130 | //! @since 3.1 | 131 | //! @since 3.1 | ||
131 | inline bool operator!=(const KDbOrderByColumnList &other) const { return !operator==(other); } | 132 | inline bool operator!=(const KDbOrderByColumnList &other) const { return !operator==(other); } | ||
132 | 133 | | |||
133 | //! Returns column with given index. | 134 | //! Returns column with given index. | ||
134 | //! @since 3.1 | 135 | //! @since 3.1 | ||
135 | const KDbOrderByColumn* value(int index) const; | 136 | const KDbOrderByColumn* value(int index) const; | ||
136 | 137 | | |||
137 | //! @overload | 138 | //! @overload | ||
138 | KDbOrderByColumn* value(int index); | 139 | KDbOrderByColumn* value(int index); | ||
139 | 140 | | |||
140 | /*! Appends multiple fields for sorting. @a querySchema | 141 | /*! Appends multiple fields for sorting. @a querySchema | ||
141 | is used to find appropriate field or alias name. | 142 | is used to find appropriate field or alias name. | ||
142 | @return false if there is at least one name for which a field or alias name does not exist | 143 | @return false if there is at least one name for which a field or alias name does not exist | ||
143 | (all the newly appended fields are removed in this case) | 144 | (all the newly appended fields are removed in this case) | ||
144 | Returns @c false if @a querySchema is @c nullptr. */ | 145 | Returns @c false if @a querySchema is @c nullptr. */ | ||
145 | bool appendFields(KDbQuerySchema* querySchema, | 146 | bool appendFields(KDbConnection *conn, KDbQuerySchema* querySchema, | ||
146 | const QString& field1, KDbOrderByColumn::SortOrder order1 = KDbOrderByColumn::SortOrder::Ascending, | 147 | const QString& field1, KDbOrderByColumn::SortOrder order1 = KDbOrderByColumn::SortOrder::Ascending, | ||
147 | const QString& field2 = QString(), KDbOrderByColumn::SortOrder order2 = KDbOrderByColumn::SortOrder::Ascending, | 148 | const QString& field2 = QString(), KDbOrderByColumn::SortOrder order2 = KDbOrderByColumn::SortOrder::Ascending, | ||
148 | const QString& field3 = QString(), KDbOrderByColumn::SortOrder order3 = KDbOrderByColumn::SortOrder::Ascending, | 149 | const QString& field3 = QString(), KDbOrderByColumn::SortOrder order3 = KDbOrderByColumn::SortOrder::Ascending, | ||
149 | const QString& field4 = QString(), KDbOrderByColumn::SortOrder order4 = KDbOrderByColumn::SortOrder::Ascending, | 150 | const QString& field4 = QString(), KDbOrderByColumn::SortOrder order4 = KDbOrderByColumn::SortOrder::Ascending, | ||
150 | const QString& field5 = QString(), KDbOrderByColumn::SortOrder order5 = KDbOrderByColumn::SortOrder::Ascending); | 151 | const QString& field5 = QString(), KDbOrderByColumn::SortOrder order5 = KDbOrderByColumn::SortOrder::Ascending); | ||
151 | 152 | | |||
152 | /*! Appends column @a columnInfo. | 153 | /*! Appends column @a columnInfo. | ||
153 | Does nothing if @a columnInfo is @c nullptr. */ | 154 | Does nothing if @a columnInfo is @c nullptr. */ | ||
154 | void appendColumn(KDbQueryColumnInfo* columnInfo, | 155 | void appendColumn(KDbQueryColumnInfo* columnInfo, | ||
155 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | 156 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | ||
156 | 157 | | |||
157 | /*! Appends a field @a field. | 158 | /*! Appends a field @a field. | ||
158 | Read documentation of @ref KDbOrderByColumn(KDbField* field, SortOrder order) | 159 | Read documentation of @ref KDbOrderByColumn(KDbField* field, SortOrder order) | ||
159 | for more info. | 160 | for more info. | ||
160 | Does nothing if @a field is @c nullptr. */ | 161 | Does nothing if @a field is @c nullptr. */ | ||
161 | void appendField(KDbField* field, | 162 | void appendField(KDbField* field, | ||
162 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | 163 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | ||
163 | 164 | | |||
164 | /*! Appends field with a name @a field. | 165 | /*! Appends field with a name @a field. | ||
165 | @return @c true on successful appending, and @c false if there is no such field or alias | 166 | @return @c true on successful appending, and @c false if there is no such field or alias | ||
166 | name in the @a querySchema. | 167 | name in the @a querySchema. | ||
167 | Returns @c false if @a querySchema is @c nullptr. */ | 168 | Returns @c false if @a querySchema is @c nullptr. */ | ||
168 | bool appendField(KDbQuerySchema* querySchema, const QString& fieldName, | 169 | bool appendField(KDbConnection *conn, KDbQuerySchema* querySchema, const QString& fieldName, | ||
169 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | 170 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending); | ||
170 | 171 | | |||
171 | /*! Appends a column that is at position @a pos (counted from 0). | 172 | /*! Appends a column that is at position @a pos (counted from 0). | ||
172 | @return true on successful adding and false if there is no such position @a pos. | 173 | @return true on successful adding and false if there is no such position @a pos. | ||
173 | Returns @c false if @a querySchema is @c nullptr. */ | 174 | Returns @c false if @a querySchema is @c nullptr. */ | ||
174 | bool appendColumn(KDbQuerySchema* querySchema, | 175 | bool appendColumn(KDbConnection *conn, KDbQuerySchema* querySchema, | ||
175 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending, | 176 | KDbOrderByColumn::SortOrder order = KDbOrderByColumn::SortOrder::Ascending, | ||
176 | int pos = -1); | 177 | int pos = -1); | ||
177 | 178 | | |||
178 | /*! @return true if the list is empty. */ | 179 | /*! @return true if the list is empty. */ | ||
179 | bool isEmpty() const; | 180 | bool isEmpty() const; | ||
180 | 181 | | |||
181 | /*! @return number of elements of the list. */ | 182 | /*! @return number of elements of the list. */ | ||
182 | int count() const; | 183 | int count() const; | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |