Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QSqlResultPrivate Class Reference

Public Types

typedef QHash< QString, int > IndexMap
 
typedef QVector< QHolderQHolderVector
 

Public Functions

void clear ()
 
void clearIndex ()
 
void clearValues ()
 
QString holderAt (int index) const
 
QString namedToPositionalBinding ()
 
QString positionalToNamedBinding ()
 
 QSqlResultPrivate (QSqlResult *d)
 
void resetBindCount ()
 

Public Variables

bool active
 
int bindCount
 
QSqlResult::BindingSyntax binds
 
QSqlError error
 
QString executedQuery
 
bool forwardOnly
 
QHolderVector holders
 
int idx
 
IndexMap indexes
 
bool isSel
 
QSql::NumericalPrecisionPolicy precisionPolicy
 
QSqlResultq
 
QString sql
 
QPointer< QSqlDriversqldriver
 
QHash< int, QSql::ParamType > types
 
QVector< QVariantvalues
 

Detailed Description

Definition at line 64 of file qsqlresult.cpp.

Typedefs

◆ IndexMap

Definition at line 117 of file qsqlresult.cpp.

◆ QHolderVector

Definition at line 120 of file qsqlresult.cpp.

Constructors and Destructors

◆ QSqlResultPrivate()

QSqlResultPrivate::QSqlResultPrivate ( QSqlResult d)
inline

Functions

◆ clear()

void QSqlResultPrivate::clear ( void  )
inline

Definition at line 90 of file qsqlresult.cpp.

91  {
92  clearValues();
93  clearIndex();;
94  }

◆ clearIndex()

void QSqlResultPrivate::clearIndex ( )
inline

Definition at line 83 of file qsqlresult.cpp.

84  {
85  indexes.clear();
86  holders.clear();
87  types.clear();
88  }
void clear()
Removes all items from the hash.
Definition: qhash.h:574
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347
QHash< int, QSql::ParamType > types
Definition: qsqlresult.cpp:115
QHolderVector holders
Definition: qsqlresult.cpp:121

◆ clearValues()

void QSqlResultPrivate::clearValues ( )
inline

Definition at line 72 of file qsqlresult.cpp.

73  {
74  values.clear();
75  bindCount = 0;
76  }
QVector< QVariant > values
Definition: qsqlresult.cpp:116
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347

◆ holderAt()

QString QSqlResultPrivate::holderAt ( int  index) const

Definition at line 124 of file qsqlresult.cpp.

125 {
126  return indexes.key(index);
127 }
const Key key(const T &value) const
Returns the first key mapped to value.
Definition: qhash.h:674
quint16 index

◆ namedToPositionalBinding()

QString QSqlResultPrivate::namedToPositionalBinding ( )

Definition at line 173 of file qsqlresult.cpp.

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 }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static bool qIsAlnum(QChar ch)
Definition: qsqlresult.cpp:143
void squeeze()
Releases any memory not required to store the character data.
Definition: qstring.h:114
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
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ positionalToNamedBinding()

QString QSqlResultPrivate::positionalToNamedBinding ( )

Definition at line 150 of file qsqlresult.cpp.

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 }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
static QString qFieldSerial(int i)
Definition: qsqlresult.cpp:130
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
void squeeze()
Releases any memory not required to store the character data.
Definition: qstring.h:114
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ resetBindCount()

void QSqlResultPrivate::resetBindCount ( )
inline

Definition at line 78 of file qsqlresult.cpp.

79  {
80  bindCount = 0;
81  }

Properties

◆ active

bool QSqlResultPrivate::active

Definition at line 105 of file qsqlresult.cpp.

◆ bindCount

int QSqlResultPrivate::bindCount

Definition at line 111 of file qsqlresult.cpp.

◆ binds

QSqlResult::BindingSyntax QSqlResultPrivate::binds

Definition at line 112 of file qsqlresult.cpp.

◆ error

QSqlError QSqlResultPrivate::error

Definition at line 107 of file qsqlresult.cpp.

◆ executedQuery

QString QSqlResultPrivate::executedQuery

Definition at line 114 of file qsqlresult.cpp.

◆ forwardOnly

bool QSqlResultPrivate::forwardOnly

Definition at line 108 of file qsqlresult.cpp.

◆ holders

QHolderVector QSqlResultPrivate::holders

Definition at line 121 of file qsqlresult.cpp.

◆ idx

int QSqlResultPrivate::idx

Definition at line 103 of file qsqlresult.cpp.

◆ indexes

IndexMap QSqlResultPrivate::indexes

Definition at line 118 of file qsqlresult.cpp.

◆ isSel

bool QSqlResultPrivate::isSel

Definition at line 106 of file qsqlresult.cpp.

◆ precisionPolicy

QSql::NumericalPrecisionPolicy QSqlResultPrivate::precisionPolicy

Definition at line 109 of file qsqlresult.cpp.

◆ q

QSqlResult* QSqlResultPrivate::q

Definition at line 101 of file qsqlresult.cpp.

Referenced by QSqlQueryModelPrivate::prefetch().

◆ sql

QString QSqlResultPrivate::sql

Definition at line 104 of file qsqlresult.cpp.

◆ sqldriver

QPointer<QSqlDriver> QSqlResultPrivate::sqldriver

Definition at line 102 of file qsqlresult.cpp.

◆ types

QHash<int, QSql::ParamType> QSqlResultPrivate::types

Definition at line 115 of file qsqlresult.cpp.

◆ values

QVector<QVariant> QSqlResultPrivate::values

Definition at line 116 of file qsqlresult.cpp.


The documentation for this class was generated from the following file: