Qt 4.8
qsqlresult.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSql module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qvariant.h"
43 #include "qhash.h"
44 #include "qregexp.h"
45 #include "qsqlerror.h"
46 #include "qsqlfield.h"
47 #include "qsqlrecord.h"
48 #include "qsqlresult.h"
49 #include "qvector.h"
50 #include "qsqldriver.h"
51 #include "qpointer.h"
52 #include <QDebug>
53 
55 
56 struct QHolder {
57  QHolder(const QString& hldr = QString(), int index = -1): holderName(hldr), holderPos(index) {}
58  bool operator==(const QHolder& h) const { return h.holderPos == holderPos && h.holderName == holderName; }
59  bool operator!=(const QHolder& h) const { return h.holderPos != holderPos || h.holderName != holderName; }
61  int holderPos;
62 };
63 
65 {
66 public:
68  : q(d), idx(QSql::BeforeFirstRow), active(false),
69  isSel(false), forwardOnly(false), precisionPolicy(QSql::LowPrecisionDouble), bindCount(0), binds(QSqlResult::PositionalBinding)
70  {}
71 
72  void clearValues()
73  {
74  values.clear();
75  bindCount = 0;
76  }
77 
79  {
80  bindCount = 0;
81  }
82 
83  void clearIndex()
84  {
85  indexes.clear();
86  holders.clear();
87  types.clear();
88  }
89 
90  void clear()
91  {
92  clearValues();
93  clearIndex();;
94  }
95 
96  QString positionalToNamedBinding();
97  QString namedToPositionalBinding();
98  QString holderAt(int index) const;
99 
100 public:
103  int idx;
105  bool active;
106  bool isSel;
110 
113 
118  IndexMap indexes;
119 
121  QHolderVector holders;
122 };
123 
125 {
126  return indexes.key(index);
127 }
128 
129 // return a unique id for bound names
130 static QString qFieldSerial(int i)
131 {
132  ushort arr[] = { ':', 'f', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
133  ushort *ptr = &arr[1];
134 
135  while (i > 0) {
136  *(++ptr) = 'a' + i % 16;
137  i >>= 4;
138  }
139 
140  return QString(reinterpret_cast<const QChar *>(arr), int(ptr - arr) + 1);
141 }
142 
143 static bool qIsAlnum(QChar ch)
144 {
145  uint u = uint(ch.unicode());
146  // matches [a-zA-Z0-9_]
147  return u - 'a' < 26 || u - 'A' < 26 || u - '0' < 10 || u == '_';
148 }
149 
151 {
152  int n = sql.size();
153 
154  QString result;
155  result.reserve(n * 5 / 4);
156  bool inQuote = false;
157  int count = 0;
158 
159  for (int i = 0; i < n; ++i) {
160  QChar ch = sql.at(i);
161  if (ch == QLatin1Char('?') && !inQuote) {
162  result += qFieldSerial(count++);
163  } else {
164  if (ch == QLatin1Char('\''))
165  inQuote = !inQuote;
166  result += ch;
167  }
168  }
169  result.squeeze();
170  return result;
171 }
172 
174 {
175  int n = sql.size();
176 
177  QString result;
178  result.reserve(n);
179  bool inQuote = false;
180  int count = 0;
181  int i = 0;
182 
183  while (i < n) {
184  QChar ch = sql.at(i);
185  if (ch == QLatin1Char(':') && !inQuote
186  && (i == 0 || sql.at(i - 1) != QLatin1Char(':'))
187  && (i + 1 < n && qIsAlnum(sql.at(i + 1)))) {
188  int pos = i + 2;
189  while (pos < n && qIsAlnum(sql.at(pos)))
190  ++pos;
191  indexes[sql.mid(i, pos - i)] = count++;
192  result += QLatin1Char('?');
193  i = pos;
194  } else {
195  if (ch == QLatin1Char('\''))
196  inQuote = !inQuote;
197  result += ch;
198  ++i;
199  }
200  }
201  result.squeeze();
202  return result;
203 }
204 
258 {
259  d = new QSqlResultPrivate(this);
260  d->sqldriver = const_cast<QSqlDriver *>(db);
261  if(db) {
262  setNumericalPrecisionPolicy(db->numericalPrecisionPolicy());
263  }
264 }
265 
271 {
272  delete d;
273 }
274 
282 void QSqlResult::setQuery(const QString& query)
283 {
284  d->sql = query;
285 }
286 
295 {
296  return d->sql;
297 }
298 
306 int QSqlResult::at() const
307 {
308  return d->idx;
309 }
310 
311 
321 {
322  return d->idx != QSql::BeforeFirstRow && d->idx != QSql::AfterLastRow;
323 }
324 
341 {
342  return d->active;
343 }
344 
353 {
354  d->idx = index;
355 }
356 
357 
368 {
369  d->isSel = select;
370 }
371 
380 {
381  return d->isSel;
382 }
383 
390 {
391  return d->sqldriver;
392 }
393 
394 
402 void QSqlResult::setActive(bool active)
403 {
404  if (active && d->executedQuery.isEmpty())
405  d->executedQuery = d->sql;
406 
407  d->active = active;
408 }
409 
418 {
419  d->error = error;
420 }
421 
422 
428 {
429  return d->error;
430 }
431 
556 {
557  return fetch(at() + 1);
558 }
559 
572 {
573  return fetch(at() - 1);
574 }
575 
583 {
584  return d->forwardOnly;
585 }
586 
603 void QSqlResult::setForwardOnly(bool forward)
604 {
605  d->forwardOnly = forward;
606 }
607 
616 {
617  if (!driver())
618  return false;
619  d->clear();
620  d->sql = query;
621  if (!driver()->hasFeature(QSqlDriver::PreparedQueries))
622  return prepare(query);
623 
624  if (driver()->hasFeature(QSqlDriver::NamedPlaceholders)) {
625  // parse the query to memorize parameter location
626  d->namedToPositionalBinding();
627  d->executedQuery = d->positionalToNamedBinding();
628  } else {
629  d->executedQuery = d->namedToPositionalBinding();
630  }
631  return prepare(d->executedQuery);
632 }
633 
641 bool QSqlResult::prepare(const QString& query)
642 {
643  int n = query.size();
644 
645  bool inQuote = false;
646  int i = 0;
647 
648  while (i < n) {
649  QChar ch = query.at(i);
650  if (ch == QLatin1Char(':') && !inQuote
651  && (i == 0 || query.at(i - 1) != QLatin1Char(':'))
652  && (i + 1 < n && qIsAlnum(query.at(i + 1)))) {
653  int pos = i + 2;
654  while (pos < n && qIsAlnum(query.at(pos)))
655  ++pos;
656 
657  d->holders.append(QHolder(query.mid(i, pos - i), i));
658  i = pos;
659  } else {
660  if (ch == QLatin1Char('\''))
661  inQuote = !inQuote;
662  ++i;
663  }
664  }
665  d->sql = query;
666  return true; // fake prepares should always succeed
667 }
668 
676 {
677  bool ret;
678  // fake preparation - just replace the placeholders..
679  QString query = lastQuery();
680  if (d->binds == NamedBinding) {
681  int i;
682  QVariant val;
683  QString holder;
684  for (i = d->holders.count() - 1; i >= 0; --i) {
685  holder = d->holders.at(i).holderName;
686  val = d->values.value(d->indexes.value(holder));
687  QSqlField f(QLatin1String(""), val.type());
688  f.setValue(val);
689  query = query.replace(d->holders.at(i).holderPos,
690  holder.length(), driver()->formatValue(f));
691  }
692  } else {
693  QString val;
694  int i = 0;
695  int idx = 0;
696  for (idx = 0; idx < d->values.count(); ++idx) {
697  i = query.indexOf(QLatin1Char('?'), i);
698  if (i == -1)
699  continue;
700  QVariant var = d->values.value(idx);
701  QSqlField f(QLatin1String(""), var.type());
702  if (var.isNull())
703  f.clear();
704  else
705  f.setValue(var);
706  val = driver()->formatValue(f);
707  query = query.replace(i, 1, driver()->formatValue(f));
708  i += val.length();
709  }
710  }
711 
712  // have to retain the original query with placeholders
713  QString orig = lastQuery();
714  ret = reset(query);
715  d->executedQuery = query;
716  setQuery(orig);
717  d->resetBindCount();
718  return ret;
719 }
720 
727 void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType paramType)
728 {
729  d->binds = PositionalBinding;
730  d->indexes[qFieldSerial(index)] = index;
731  if (d->values.count() <= index)
732  d->values.resize(index + 1);
733  d->values[index] = val;
734  if (paramType != QSql::In || !d->types.isEmpty())
735  d->types[index] = paramType;
736 }
737 
757 void QSqlResult::bindValue(const QString& placeholder, const QVariant& val,
758  QSql::ParamType paramType)
759 {
760  d->binds = NamedBinding;
761  // if the index has already been set when doing emulated named
762  // bindings - don't reset it
763  int idx = d->indexes.value(placeholder, -1);
764  if (idx >= 0) {
765  if (d->values.count() <= idx)
766  d->values.resize(idx + 1);
767  d->values[idx] = val;
768  } else {
769  d->values.append(val);
770  idx = d->values.count() - 1;
771  d->indexes[placeholder] = idx;
772  }
773 
774  if (paramType != QSql::In || !d->types.isEmpty())
775  d->types[idx] = paramType;
776 }
777 
784 void QSqlResult::addBindValue(const QVariant& val, QSql::ParamType paramType)
785 {
786  d->binds = PositionalBinding;
787  bindValue(d->bindCount, val, paramType);
788  ++d->bindCount;
789 }
790 
798 {
799  return d->values.value(index);
800 }
801 
813 QVariant QSqlResult::boundValue(const QString& placeholder) const
814 {
815  int idx = d->indexes.value(placeholder, -1);
816  return d->values.value(idx);
817 }
818 
824 QSql::ParamType QSqlResult::bindValueType(int index) const
825 {
826  return d->types.value(index, QSql::In);
827 }
828 
838 QSql::ParamType QSqlResult::bindValueType(const QString& placeholder) const
839 {
840  return d->types.value(d->indexes.value(placeholder, -1), QSql::In);
841 }
842 
849 {
850  return d->values.count();
851 }
852 
860 {
861  return d->values;
862 }
863 
868 {
869  return d->binds;
870 }
871 
877 {
878  d->clear();
879 }
880 
890 {
891  return d->executedQuery;
892 }
893 
895 {
896  d->resetBindCount();
897 }
898 
906 {
907  return d->holderAt(index);
908 }
909 
917 {
918  if (d->types.isEmpty())
919  return false;
921  for (it = d->types.constBegin(); it != d->types.constEnd(); ++it) {
922  if (it.value() != QSql::In)
923  return true;
924  }
925  return false;
926 }
927 
937 {
938  return QSqlRecord();
939 }
940 
956 {
957  return QVariant();
958 }
959 
962 void QSqlResult::virtual_hook(int, void *)
963 {
964 }
965 
997 bool QSqlResult::execBatch(bool arrayBind)
998 {
999  if (driver()->hasFeature(QSqlDriver::BatchOperations)) {
1000  virtual_hook(BatchOperation, &arrayBind);
1001  d->resetBindCount();
1002  return d->error.type() == QSqlError::NoError;
1003  } else {
1004  QVector<QVariant> values = d->values;
1005  if (values.count() == 0)
1006  return false;
1007  for (int i = 0; i < values.at(0).toList().count(); ++i) {
1008  for (int j = 0; j < values.count(); ++j)
1009  bindValue(j, values.at(j).toList().at(i), QSql::In);
1010  if (!exec())
1011  return false;
1012  }
1013  return true;
1014  }
1015  return false;
1016 }
1017 
1021 {
1022  if (driver()->hasFeature(QSqlDriver::FinishQuery)
1023  || driver()->hasFeature(QSqlDriver::SimpleLocking))
1024  virtual_hook(DetachFromResultSet, 0);
1025 }
1026 
1030 {
1031  d->precisionPolicy = policy;
1032  virtual_hook(SetNumericalPrecision, &policy);
1033 }
1034 
1038 {
1039  return d->precisionPolicy;
1040 }
1041 
1045 {
1046  if (driver()->hasFeature(QSqlDriver::MultipleResultSets)) {
1047  bool result = false;
1048  virtual_hook(NextResult, &result);
1049  return result;
1050  }
1051  return false;
1052 }
1053 
1079 {
1080  return QVariant();
1081 }
1082 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QSqlError class provides SQL database error information.
Definition: qsqlerror.h:53
QSqlResult::BindingSyntax binds
Definition: qsqlresult.cpp:112
QHolder(const QString &hldr=QString(), int index=-1)
Definition: qsqlresult.cpp:57
double d
Definition: qnumeric_p.h:62
const QSqlDriver * driver() const
Returns the driver associated with the result.
Definition: qsqlresult.cpp:389
QSqlResult * q
Definition: qsqlresult.cpp:101
NumericalPrecisionPolicy
Definition: qsql.h:82
bool isActive() const
Returns true if the result has records to be retrieved; otherwise returns false.
Definition: qsqlresult.cpp:340
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool isForwardOnly() const
Returns true if you can only scroll forward through the result set; otherwise returns false...
Definition: qsqlresult.cpp:582
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
Definition: qvariant.cpp:3102
#define it(className, varName)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
#define error(msg)
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
#define at(className, varName)
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QVector< QHolder > QHolderVector
Definition: qsqlresult.cpp:120
bool operator==(const QHolder &h) const
Definition: qsqlresult.cpp:58
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
static QString qFieldSerial(int i)
Definition: qsqlresult.cpp:130
bool execBatch(bool arrayBind=false)
Executes a prepared query in batch mode if the driver supports it, otherwise emulates a batch executi...
Definition: qsqlresult.cpp:997
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has type() List or StringList ; otherwise return...
Definition: qvariant.cpp:2751
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
quint16 u
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QSqlRecord class encapsulates a database record.
Definition: qsqlrecord.h:58
virtual void bindValue(int pos, const QVariant &val, QSql::ParamType type)
Binds the value val of parameter type paramType to position index in the current record (row)...
Definition: qsqlresult.cpp:727
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const
virtual QSqlRecord record() const
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
Definition: qsqlresult.cpp:936
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
Definition: qsqldriver.h:68
The QString class provides a Unicode character string.
Definition: qstring.h:83
int at() const
Returns the current (zero-based) row position of the result.
Definition: qsqlresult.cpp:306
QVector< QVariant > values
Definition: qsqlresult.cpp:116
QString lastQuery() const
Returns the current SQL query text, or an empty string if there isn&#39;t one.
Definition: qsqlresult.cpp:294
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QSqlResult(const QSqlDriver *db)
Creates a QSqlResult using database driver db.
Definition: qsqlresult.cpp:257
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
virtual QVariant lastInsertId() const
Returns the object ID of the most recent inserted row if the database supports it.
Definition: qsqlresult.cpp:955
virtual void setAt(int at)
This function is provided for derived classes to set the internal (zero-based) row position to index...
Definition: qsqlresult.cpp:352
virtual void setLastError(const QSqlError &e)
This function is provided for derived classes to set the last error to error.
Definition: qsqlresult.cpp:417
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy)
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
QString boundValueName(int pos) const
Returns the name of the bound value at position index in the current record (row).
Definition: qsqlresult.cpp:905
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QVariant boundValue(const QString &placeholder) const
Returns the value bound by the given placeholder name in the current record (row).
Definition: qsqlresult.cpp:813
virtual void setSelect(bool s)
This function is provided for derived classes to indicate whether or not the current statement is a S...
Definition: qsqlresult.cpp:367
virtual bool savePrepare(const QString &sqlquery)
Prepares the given query, using the underlying database functionality where possible.
Definition: qsqlresult.cpp:615
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
virtual QVariant handle() const
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVarian...
virtual bool fetchNext()
Positions the result to the next available record (row) in the result.
Definition: qsqlresult.cpp:555
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void clear()
Clears the value of the field and sets it to NULL.
Definition: qsqlfield.cpp:334
bool hasOutValues() const
Returns true if at least one of the query&#39;s bound values is a QSql::Out or a QSql::InOut; otherwise r...
Definition: qsqlresult.cpp:916
QSql::ParamType bindValueType(const QString &placeholder) const
Returns the parameter type for the value bound with the given placeholder name.
Definition: qsqlresult.cpp:838
bool operator!=(const QHolder &h) const
Definition: qsqlresult.cpp:59
Definition: qsql.h:67
unsigned int uint
Definition: qglobal.h:996
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QString holderAt(int index) const
Definition: qsqlresult.cpp:124
int boundValueCount() const
Returns the number of bound values in the result.
Definition: qsqlresult.cpp:848
QHash< QString, int > IndexMap
Definition: qsqlresult.cpp:117
const T * ptr(const T &t)
static bool qIsAlnum(QChar ch)
Definition: qsqlresult.cpp:143
quint16 values[128]
virtual bool exec()
Executes the query, returning true if successful; otherwise returns false.
Definition: qsqlresult.cpp:675
virtual bool prepare(const QString &query)
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
Definition: qsqlresult.cpp:641
virtual void setForwardOnly(bool forward)
Sets forward only mode to forward.
Definition: qsqlresult.cpp:603
QString executedQuery() const
Returns the query that was actually executed.
Definition: qsqlresult.cpp:889
QString holderName
Definition: qsqlresult.cpp:60
void squeeze()
Releases any memory not required to store the character data.
Definition: qstring.h:114
virtual void virtual_hook(int id, void *data)
Definition: qsqlresult.cpp:962
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
bool nextResult()
BindingSyntax bindingSyntax() const
Returns the binding syntax used by prepared queries.
Definition: qsqlresult.cpp:867
void detachFromResultSet()
virtual ~QSqlResult()
Destroys the object and frees any allocated resources.
Definition: qsqlresult.cpp:270
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
static bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
Definition: qdockwidget.cpp:74
QSql::NumericalPrecisionPolicy precisionPolicy
Definition: qsqlresult.cpp:109
QHash< int, QSql::ParamType > types
Definition: qsqlresult.cpp:115
void addBindValue(const QVariant &val, QSql::ParamType type)
Binds the value val of parameter type paramType to the next available position in the current record ...
Definition: qsqlresult.cpp:784
static const struct @32 types[]
int holderPos
Definition: qsqlresult.cpp:61
unsigned short ushort
Definition: qglobal.h:995
static QByteArray paramType(const QByteArray &ptype, bool *out)
Type type() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1901
BindingSyntax
This enum type specifies the different syntaxes for specifying placeholders in prepared queries...
Definition: qsqlresult.h:74
QString positionalToNamedBinding()
Definition: qsqlresult.cpp:150
QSqlResultPrivate(QSqlResult *d)
Definition: qsqlresult.cpp:67
void clear()
Clears the entire result set and releases any associated resources.
Definition: qsqlresult.cpp:876
QSqlError lastError() const
Returns the last error associated with the result.
Definition: qsqlresult.cpp:427
bool isSelect() const
Returns true if the current result is from a SELECT statement; otherwise returns false.
Definition: qsqlresult.cpp:379
virtual void setActive(bool a)
This function is provided for derived classes to set the internal active state to active...
Definition: qsqlresult.cpp:402
virtual bool fetchPrevious()
Positions the result to the previous record (row) in the result.
Definition: qsqlresult.cpp:571
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const
Returns the current default precision policy for the database connection.
Definition: qsqldriver.cpp:987
quint16 index
bool isValid() const
Returns true if the result is positioned on a valid record (that is, the result is not positioned bef...
Definition: qsqlresult.cpp:320
The QSqlField class manipulates the fields in SQL database tables and views.
Definition: qsqlfield.h:56
void resetBindCount()
Definition: qsqlresult.cpp:894
Definition: qsql.h:53
QHolderVector holders
Definition: qsqlresult.cpp:121
QVector< QVariant > & boundValues() const
Returns a vector of the result&#39;s bound values for the current record (row).
Definition: qsqlresult.cpp:859
QString namedToPositionalBinding()
Definition: qsqlresult.cpp:173
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases...
Definition: qsqlresult.h:63
QPointer< QSqlDriver > sqldriver
Definition: qsqlresult.cpp:102
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
virtual void setQuery(const QString &query)
Sets the current query for the result to query.
Definition: qsqlresult.cpp:282
void setValue(const QVariant &value)
Sets the value of the field to value.
Definition: qsqlfield.cpp:320