Changeset View
Changeset View
Standalone View
Standalone View
src/KDbDriver.h
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2003-2017 Jarosław Staniek <staniek@kde.org> | 2 | Copyright (C) 2003-2018 Jarosław Staniek <staniek@kde.org> | ||
3 | 3 | | |||
4 | This program is free software; you can redistribute it and/or | 4 | This program 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 program is distributed in the hope that it will be useful, | 9 | This program 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 147 Lines • ▼ Show 20 Line(s) | 157 | inline KDbEscapedString valueToSql(const QString& ftype, const QVariant& v) const { | |||
158 | return valueToSql(KDbField::typeForString(ftype), v); | 158 | return valueToSql(KDbField::typeForString(ftype), v); | ||
159 | } | 159 | } | ||
160 | 160 | | |||
161 | //! Like above method, for @a field. | 161 | //! Like above method, for @a field. | ||
162 | inline KDbEscapedString valueToSql(const KDbField *field, const QVariant& v) const { | 162 | inline KDbEscapedString valueToSql(const KDbField *field, const QVariant& v) const { | ||
163 | return valueToSql((field ? field->type() : KDbField::InvalidType), v); | 163 | return valueToSql((field ? field->type() : KDbField::InvalidType), v); | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | /*! @todo not compatible with all drivers - reimplement */ | 166 | /** | ||
167 | virtual KDbEscapedString dateTimeToSql(const QDateTime& v) const; | 167 | * Converts date value to string | ||
168 | * | ||||
169 | * Default implementation uses KDb::dateToSql(). | ||||
170 | * | ||||
171 | * Not compatible with all drivers - reimplement. | ||||
172 | * | ||||
173 | * @since 3.1.1 | ||||
174 | */ | ||||
175 | virtual KDbEscapedString dateToSql(const QVariant &v) const; | ||||
176 | | ||||
177 | /** | ||||
178 | * Converts time value to string | ||||
179 | * | ||||
180 | * Default implementation uses KDb::timeToIsoString(). | ||||
181 | * | ||||
182 | * Not compatible with all drivers - reimplement. | ||||
183 | * | ||||
184 | * @since 3.1.1 | ||||
185 | */ | ||||
186 | virtual KDbEscapedString timeToSql(const QVariant &v) const; | ||||
187 | | ||||
188 | /** | ||||
189 | * Converts date/time value to string | ||||
190 | * | ||||
191 | * Default implementation uses KDb::dateTimeToIsoString(). | ||||
192 | * | ||||
193 | * Not compatible with all drivers - reimplement. | ||||
194 | * | ||||
195 | * @since 3.1.1 | ||||
196 | */ | ||||
197 | virtual KDbEscapedString dateTimeToSql(const QVariant &v) const; | ||||
198 | | ||||
199 | /** | ||||
200 | * Converts date/time value to string | ||||
201 | * | ||||
202 | * Default implementation uses dateTimeToSql(QVariant). | ||||
203 | * Deprecated, use dateTimeToSql(QVariant). | ||||
204 | * | ||||
205 | * Not compatible with all drivers - reimplement. | ||||
206 | */ | ||||
207 | KDB_DEPRECATED virtual KDbEscapedString dateTimeToSql(const QDateTime& v) const; | ||||
168 | 208 | | |||
169 | /*! Driver-specific SQL string escaping. | 209 | /*! Driver-specific SQL string escaping. | ||
170 | Implement escaping for any character like " or ' as your | 210 | Implement escaping for any character like " or ' as your | ||
171 | database engine requires. Prepend and append quotation marks. | 211 | database engine requires. Prepend and append quotation marks. | ||
172 | */ | 212 | */ | ||
173 | virtual KDbEscapedString escapeString(const QString& str) const = 0; | 213 | virtual KDbEscapedString escapeString(const QString& str) const = 0; | ||
174 | 214 | | |||
175 | /*! This is overloaded version of escapeString( const QString& str ) | 215 | /*! This is overloaded version of escapeString( const QString& str ) | ||
▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines |