equal
deleted
inserted
replaced
93 |
93 |
94 static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type, |
94 static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type, |
95 int errorCode = -1) |
95 int errorCode = -1) |
96 { |
96 { |
97 return QSqlError(descr, |
97 return QSqlError(descr, |
98 QString::fromUtf16(static_cast<const ushort *>(sqlite3_errmsg16(access))), |
98 QString(reinterpret_cast<const QChar *>(sqlite3_errmsg16(access))), |
99 type, errorCode); |
99 type, errorCode); |
100 } |
100 } |
101 |
101 |
102 class QSQLiteDriverPrivate |
102 class QSQLiteDriverPrivate |
103 { |
103 { |
160 return; |
160 return; |
161 |
161 |
162 q->init(nCols); |
162 q->init(nCols); |
163 |
163 |
164 for (int i = 0; i < nCols; ++i) { |
164 for (int i = 0; i < nCols; ++i) { |
165 QString colName = QString::fromUtf16( |
165 QString colName = QString(reinterpret_cast<const QChar *>( |
166 static_cast<const ushort *>(sqlite3_column_name16(stmt, i)) |
166 sqlite3_column_name16(stmt, i)) |
167 ).remove(QLatin1Char('"')); |
167 ).remove(QLatin1Char('"')); |
168 |
168 |
169 // must use typeName for resolving the type to match QSqliteDriver::record |
169 // must use typeName for resolving the type to match QSqliteDriver::record |
170 QString typeName = QString::fromUtf16( |
170 QString typeName = QString(reinterpret_cast<const QChar *>( |
171 static_cast<const ushort *>(sqlite3_column_decltype16(stmt, i))); |
171 sqlite3_column_decltype16(stmt, i))); |
172 |
172 |
173 int dotIdx = colName.lastIndexOf(QLatin1Char('.')); |
173 int dotIdx = colName.lastIndexOf(QLatin1Char('.')); |
174 QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName)); |
174 QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName)); |
175 |
175 |
176 // sqlite3_column_type is documented to have undefined behavior if the result set is empty |
176 // sqlite3_column_type is documented to have undefined behavior if the result set is empty |