| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqldriver.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | static QString prepareIdentifier(const QString &identifier, | - | ||||||||||||
| 6 | QSqlDriver::IdentifierType type, const QSqlDriver *driver) | - | ||||||||||||
| 7 | { | - | ||||||||||||
| 8 | ((!(driver != __null)) ? qt_assert("driver != NULL",__FILE__,54) : qt_noop()); | - | ||||||||||||
| 9 | QString ret = identifier; | - | ||||||||||||
| 10 | if (!driver->isIdentifierEscaped(identifier, type) 
 | 10-1324 | ||||||||||||
| 11 | ret = driver->escapeIdentifier(identifier, type); | - | ||||||||||||
| 12 | } executed 1324 times by 4 tests:  end of blockExecuted by: 
 | 1324 | ||||||||||||
| 13 | return executed 1334 times by 4 tests: ret; return ret;Executed by: 
 executed 1334 times by 4 tests:  return ret;Executed by: 
 | 1334 | ||||||||||||
| 14 | } | - | ||||||||||||
| 15 | QSqlDriver::QSqlDriver(QObject *parent) | - | ||||||||||||
| 16 | : QObject(*new QSqlDriverPrivate, parent) | - | ||||||||||||
| 17 | { | - | ||||||||||||
| 18 | } executed 20 times by 10 tests:  end of blockExecuted by: 
 | 20 | ||||||||||||
| 19 | - | |||||||||||||
| 20 | - | |||||||||||||
| 21 | - | |||||||||||||
| 22 | QSqlDriver::QSqlDriver(QSqlDriverPrivate &dd, QObject *parent) | - | ||||||||||||
| 23 | : QObject(dd, parent) | - | ||||||||||||
| 24 | { | - | ||||||||||||
| 25 | } executed 32 times by 9 tests:  end of blockExecuted by: 
 | 32 | ||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | - | |||||||||||||
| 30 | - | |||||||||||||
| 31 | QSqlDriver::~QSqlDriver() | - | ||||||||||||
| 32 | { | - | ||||||||||||
| 33 | } | - | ||||||||||||
| 34 | bool QSqlDriver::isOpen() const | - | ||||||||||||
| 35 | { | - | ||||||||||||
| 36 | const QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 37 | return executed 8308 times by 12 tests: d->isOpen; return d->isOpen;Executed by: 
 executed 8308 times by 12 tests:  return d->isOpen;Executed by: 
 | 8308 | ||||||||||||
| 38 | } | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | - | |||||||||||||
| 42 | - | |||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | bool QSqlDriver::isOpenError() const | - | ||||||||||||
| 46 | { | - | ||||||||||||
| 47 | const QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 48 | return executed 5596 times by 9 tests: d->isOpenError; return d->isOpenError;Executed by: 
 executed 5596 times by 9 tests:  return d->isOpenError;Executed by: 
 | 5596 | ||||||||||||
| 49 | } | - | ||||||||||||
| 50 | void QSqlDriver::setOpen(bool open) | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 53 | d->isOpen = open; | - | ||||||||||||
| 54 | } executed 89 times by 10 tests:  end of blockExecuted by: 
 | 89 | ||||||||||||
| 55 | void QSqlDriver::setOpenError(bool error) | - | ||||||||||||
| 56 | { | - | ||||||||||||
| 57 | QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 58 | d->isOpenError = error; | - | ||||||||||||
| 59 | if (error 
 | 3-89 | ||||||||||||
| 60 | d->isOpen = false; executed 3 times by 1 test:  d->isOpen = false;Executed by: 
 | 3 | ||||||||||||
| 61 | } executed 92 times by 10 tests:  end of blockExecuted by: 
 | 92 | ||||||||||||
| 62 | bool QSqlDriver::beginTransaction() | - | ||||||||||||
| 63 | { | - | ||||||||||||
| 64 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 65 | } | - | ||||||||||||
| 66 | bool QSqlDriver::commitTransaction() | - | ||||||||||||
| 67 | { | - | ||||||||||||
| 68 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 69 | } | - | ||||||||||||
| 70 | bool QSqlDriver::rollbackTransaction() | - | ||||||||||||
| 71 | { | - | ||||||||||||
| 72 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 73 | } | - | ||||||||||||
| 74 | void QSqlDriver::setLastError(const QSqlError &error) | - | ||||||||||||
| 75 | { | - | ||||||||||||
| 76 | QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 77 | d->error = error; | - | ||||||||||||
| 78 | } executed 37 times by 9 tests:  end of blockExecuted by: 
 | 37 | ||||||||||||
| 79 | - | |||||||||||||
| 80 | - | |||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | - | |||||||||||||
| 85 | QSqlError QSqlDriver::lastError() const | - | ||||||||||||
| 86 | { | - | ||||||||||||
| 87 | const QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 88 | return executed 29 times by 6 tests: d->error; return d->error;Executed by: 
 executed 29 times by 6 tests:  return d->error;Executed by: 
 | 29 | ||||||||||||
| 89 | } | - | ||||||||||||
| 90 | QStringList QSqlDriver::tables(QSql::TableType) const | - | ||||||||||||
| 91 | { | - | ||||||||||||
| 92 | return executed 1 time by 1 test: QStringList(); return QStringList();Executed by: 
 executed 1 time by 1 test:  return QStringList();Executed by: 
 | 1 | ||||||||||||
| 93 | } | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | - | |||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | - | |||||||||||||
| 101 | QSqlIndex QSqlDriver::primaryIndex(const QString&) const | - | ||||||||||||
| 102 | { | - | ||||||||||||
| 103 | return never executed: QSqlIndex(); return QSqlIndex();never executed:  return QSqlIndex(); | 0 | ||||||||||||
| 104 | } | - | ||||||||||||
| 105 | QSqlRecord QSqlDriver::record(const QString & ) const | - | ||||||||||||
| 106 | { | - | ||||||||||||
| 107 | return never executed: QSqlRecord(); return QSqlRecord();never executed:  return QSqlRecord(); | 0 | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) const | - | ||||||||||||
| 110 | { | - | ||||||||||||
| 111 | return never executed: identifier; return identifier;never executed:  return identifier; | 0 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | (void)type;; | - | ||||||||||||
| 116 | return executed 2790 times by 8 tests: identifier.size() > 2 return identifier.size() > 2 && identifier.startsWith(QLatin1Char('"')) && identifier.endsWith(QLatin1Char('"'));Executed by: 
 executed 2790 times by 8 tests:  return identifier.size() > 2 && identifier.startsWith(QLatin1Char('"')) && identifier.endsWith(QLatin1Char('"'));Executed by: 
 | 2790 | ||||||||||||
| 117 | && identifier.startsWith(QLatin1Char('"')) executed 2790 times by 8 tests:  return identifier.size() > 2 && identifier.startsWith(QLatin1Char('"')) && identifier.endsWith(QLatin1Char('"'));Executed by: 
 | 2790 | ||||||||||||
| 118 | && identifier.endsWith(QLatin1Char('"')); executed 2790 times by 8 tests:  return identifier.size() > 2 && identifier.startsWith(QLatin1Char('"')) && identifier.endsWith(QLatin1Char('"'));Executed by: 
 | 2790 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType type) const | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | QString ret; | - | ||||||||||||
| 123 | if (isIdentifierEscaped(identifier, type) 
 | 0-99 | ||||||||||||
| 124 | ret = identifier.mid(1); | - | ||||||||||||
| 125 | ret.chop(1); | - | ||||||||||||
| 126 | } executed 99 times by 4 tests: else { end of blockExecuted by: 
 | 99 | ||||||||||||
| 127 | ret = identifier; | - | ||||||||||||
| 128 | } never executed:  end of block | 0 | ||||||||||||
| 129 | return executed 99 times by 4 tests: ret; return ret;Executed by: 
 executed 99 times by 4 tests:  return ret;Executed by: 
 | 99 | ||||||||||||
| 130 | } | - | ||||||||||||
| 131 | QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, | - | ||||||||||||
| 132 | const QSqlRecord &rec, bool preparedStatement) const | - | ||||||||||||
| 133 | { | - | ||||||||||||
| 134 | int i; | - | ||||||||||||
| 135 | QString s; | - | ||||||||||||
| 136 | s.reserve(128); | - | ||||||||||||
| 137 | switch (type) { | - | ||||||||||||
| 138 | case executed 293 times by 3 tests: SelectStatement: case SelectStatement:Executed by: 
 executed 293 times by 3 tests:  case SelectStatement:Executed by: 
 | 293 | ||||||||||||
| 139 | for (i = 0; i < rec.count() 
 | 293-721 | ||||||||||||
| 140 | if (rec.isGenerated(i) 
 | 0-721 | ||||||||||||
| 141 | s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); executed 721 times by 3 tests:  s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", "));Executed by: 
 | 721 | ||||||||||||
| 142 | } executed 721 times by 3 tests:  end of blockExecuted by: 
 | 721 | ||||||||||||
| 143 | if (s.isEmpty() 
 | 0-293 | ||||||||||||
| 144 | return never executed: s; return s;never executed:  return s; | 0 | ||||||||||||
| 145 | s.chop(2); | - | ||||||||||||
| 146 | s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(tableName); | - | ||||||||||||
| 147 | break; executed 293 times by 3 tests:  break;Executed by: 
 | 293 | ||||||||||||
| 148 | case executed 135 times by 3 tests: WhereStatement: case WhereStatement:Executed by: 
 executed 135 times by 3 tests:  case WhereStatement:Executed by: 
 | 135 | ||||||||||||
| 149 | { | - | ||||||||||||
| 150 | const QString tableNamePrefix = tableName.isEmpty() 
 | 0-135 | ||||||||||||
| 151 | ? QString() | - | ||||||||||||
| 152 | : prepareIdentifier(tableName, QSqlDriver::TableName, this) + QLatin1Char('.'); | - | ||||||||||||
| 153 | for (int i = 0; i < rec.count() 
 | 135-286 | ||||||||||||
| 154 | if (!rec.isGenerated(i) 
 | 0-286 | ||||||||||||
| 155 | continue; never executed:  continue; | 0 | ||||||||||||
| 156 | s.append(s.isEmpty() ? QLatin1String("WHERE ") : QLatin1String(" AND ")); | - | ||||||||||||
| 157 | s.append(tableNamePrefix); | - | ||||||||||||
| 158 | s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)); | - | ||||||||||||
| 159 | if (rec.isNull(i) 
 | 17-269 | ||||||||||||
| 160 | s.append(QLatin1String(" IS NULL")); executed 17 times by 2 tests:  s.append(QLatin1String(" IS NULL"));Executed by: 
 | 17 | ||||||||||||
| 161 | else if (preparedStatement 
 | 117-152 | ||||||||||||
| 162 | s.append(QLatin1String(" = ?")); executed 152 times by 3 tests:  s.append(QLatin1String(" = ?"));Executed by: 
 | 152 | ||||||||||||
| 163 | else | - | ||||||||||||
| 164 | s.append(QLatin1String(" = ")).append(formatValue(rec.field(i))); executed 117 times by 3 tests:  s.append(QLatin1String(" = ")).append(formatValue(rec.field(i)));Executed by: 
 | 117 | ||||||||||||
| 165 | } | - | ||||||||||||
| 166 | break; executed 135 times by 3 tests:  break;Executed by: 
 | 135 | ||||||||||||
| 167 | } | - | ||||||||||||
| 168 | case executed 49 times by 2 tests: UpdateStatement: case UpdateStatement:Executed by: 
 executed 49 times by 2 tests:  case UpdateStatement:Executed by: 
 | 49 | ||||||||||||
| 169 | s.append(QLatin1String("UPDATE ")).append(tableName).append( | - | ||||||||||||
| 170 | QLatin1String(" SET ")); | - | ||||||||||||
| 171 | for (i = 0; i < rec.count() 
 | 49-153 | ||||||||||||
| 172 | if (!rec.isGenerated(i) 
 | 64-89 | ||||||||||||
| 173 | continue; executed 89 times by 2 tests:  continue;Executed by: 
 | 89 | ||||||||||||
| 174 | s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1Char('=')); | - | ||||||||||||
| 175 | if (preparedStatement 
 | 0-64 | ||||||||||||
| 176 | s.append(QLatin1Char('?')); executed 64 times by 2 tests:  s.append(QLatin1Char('?'));Executed by: 
 | 64 | ||||||||||||
| 177 | else | - | ||||||||||||
| 178 | s.append(formatValue(rec.field(i))); never executed:  s.append(formatValue(rec.field(i))); | 0 | ||||||||||||
| 179 | s.append(QLatin1String(", ")); | - | ||||||||||||
| 180 | } executed 64 times by 2 tests:  end of blockExecuted by: 
 | 64 | ||||||||||||
| 181 | if (s.endsWith(QLatin1String(", ")) 
 | 0-49 | ||||||||||||
| 182 | s.chop(2); executed 49 times by 2 tests:  s.chop(2);Executed by: 
 | 49 | ||||||||||||
| 183 | else | - | ||||||||||||
| 184 | s.clear(); never executed:  s.clear(); | 0 | ||||||||||||
| 185 | break; executed 49 times by 2 tests:  break;Executed by: 
 | 49 | ||||||||||||
| 186 | case executed 22 times by 1 test: DeleteStatement: case DeleteStatement:Executed by: 
 executed 22 times by 1 test:  case DeleteStatement:Executed by: 
 | 22 | ||||||||||||
| 187 | s.append(QLatin1String("DELETE FROM ")).append(tableName); | - | ||||||||||||
| 188 | break; executed 22 times by 1 test:  break;Executed by: 
 | 22 | ||||||||||||
| 189 | case executed 53 times by 2 tests: InsertStatement: case InsertStatement:Executed by: 
 executed 53 times by 2 tests: { case InsertStatement:Executed by: 
 | 53 | ||||||||||||
| 190 | s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" (")); | - | ||||||||||||
| 191 | QString vals; | - | ||||||||||||
| 192 | for (i = 0; i < rec.count() 
 | 53-145 | ||||||||||||
| 193 | if (!rec.isGenerated(i) 
 | 17-128 | ||||||||||||
| 194 | continue; executed 17 times by 1 test:  continue;Executed by: 
 | 17 | ||||||||||||
| 195 | s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); | - | ||||||||||||
| 196 | if (preparedStatement 
 | 0-128 | ||||||||||||
| 197 | vals.append(QLatin1Char('?')); executed 128 times by 2 tests:  vals.append(QLatin1Char('?'));Executed by: 
 | 128 | ||||||||||||
| 198 | else | - | ||||||||||||
| 199 | vals.append(formatValue(rec.field(i))); never executed:  vals.append(formatValue(rec.field(i))); | 0 | ||||||||||||
| 200 | vals.append(QLatin1String(", ")); | - | ||||||||||||
| 201 | } executed 128 times by 2 tests:  end of blockExecuted by: 
 | 128 | ||||||||||||
| 202 | if (vals.isEmpty() 
 | 1-52 | ||||||||||||
| 203 | s.clear(); | - | ||||||||||||
| 204 | } executed 1 time by 1 test: else { end of blockExecuted by: 
 | 1 | ||||||||||||
| 205 | vals.chop(2); | - | ||||||||||||
| 206 | s[s.length() - 2] = QLatin1Char(')'); | - | ||||||||||||
| 207 | s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1Char(')')); | - | ||||||||||||
| 208 | } executed 52 times by 2 tests:  end of blockExecuted by: 
 | 52 | ||||||||||||
| 209 | break; executed 53 times by 2 tests: } break;Executed by: 
 | 53 | ||||||||||||
| 210 | } | - | ||||||||||||
| 211 | return executed 552 times by 4 tests: s; return s;Executed by: 
 executed 552 times by 4 tests:  return s;Executed by: 
 | 552 | ||||||||||||
| 212 | } | - | ||||||||||||
| 213 | QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const | - | ||||||||||||
| 214 | { | - | ||||||||||||
| 215 | const QLatin1String nullTxt("NULL"); | - | ||||||||||||
| 216 | - | |||||||||||||
| 217 | QString r; | - | ||||||||||||
| 218 | if (field.isNull() 
 | 0-126 | ||||||||||||
| 219 | r = nullTxt; never executed:  r = nullTxt; | 0 | ||||||||||||
| 220 | else { | - | ||||||||||||
| 221 | switch (field.type()) { | - | ||||||||||||
| 222 | case executed 82 times by 4 tests: QVariant::Int: case QVariant::Int:Executed by: 
 executed 82 times by 4 tests:  case QVariant::Int:Executed by: 
 | 82 | ||||||||||||
| 223 | case never executed: QVariant::UInt: case QVariant::UInt:never executed:  case QVariant::UInt: | 0 | ||||||||||||
| 224 | if (field.value().type() == QVariant::Bool 
 | 0-82 | ||||||||||||
| 225 | r = field.value().toBool() 
 never executed:  r = field.value().toBool() ? QLatin1String("1") : QLatin1String("0"); | 0 | ||||||||||||
| 226 | else | - | ||||||||||||
| 227 | r = field.value().toString(); executed 82 times by 4 tests:  r = field.value().toString();Executed by: 
 | 82 | ||||||||||||
| 228 | break; executed 82 times by 4 tests:  break;Executed by: 
 | 82 | ||||||||||||
| 229 | - | |||||||||||||
| 230 | case never executed: QVariant::Date: case QVariant::Date:never executed:  case QVariant::Date: | 0 | ||||||||||||
| 231 | if (field.value().toDate().isValid() 
 | 0 | ||||||||||||
| 232 | r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate) never executed:  r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 233 | + QLatin1Char('\''); never executed:  r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 234 | else | - | ||||||||||||
| 235 | r = nullTxt; never executed:  r = nullTxt; | 0 | ||||||||||||
| 236 | break; never executed:  break; | 0 | ||||||||||||
| 237 | case never executed: QVariant::Time: case QVariant::Time:never executed:  case QVariant::Time: | 0 | ||||||||||||
| 238 | if (field.value().toTime().isValid() 
 | 0 | ||||||||||||
| 239 | r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) never executed:  r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 240 | + QLatin1Char('\''); never executed:  r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 241 | else | - | ||||||||||||
| 242 | r = nullTxt; never executed:  r = nullTxt; | 0 | ||||||||||||
| 243 | break; never executed:  break; | 0 | ||||||||||||
| 244 | case never executed: QVariant::DateTime: case QVariant::DateTime:never executed:  case QVariant::DateTime: | 0 | ||||||||||||
| 245 | if (field.value().toDateTime().isValid() 
 | 0 | ||||||||||||
| 246 | r = QLatin1Char('\'') + never executed:  r = QLatin1Char('\'') + field.value().toDateTime().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 247 | field.value().toDateTime().toString(Qt::ISODate) + QLatin1Char('\''); never executed:  r = QLatin1Char('\'') + field.value().toDateTime().toString(Qt::ISODate) + QLatin1Char('\''); | 0 | ||||||||||||
| 248 | else | - | ||||||||||||
| 249 | r = nullTxt; never executed:  r = nullTxt; | 0 | ||||||||||||
| 250 | break; never executed:  break; | 0 | ||||||||||||
| 251 | - | |||||||||||||
| 252 | case executed 43 times by 3 tests: QVariant::String: case QVariant::String:Executed by: 
 executed 43 times by 3 tests:  case QVariant::String:Executed by: 
 | 43 | ||||||||||||
| 253 | case never executed: QVariant::Char: case QVariant::Char:never executed:  case QVariant::Char: | 0 | ||||||||||||
| 254 | { | - | ||||||||||||
| 255 | QString result = field.value().toString(); | - | ||||||||||||
| 256 | if (trimStrings 
 | 6-37 | ||||||||||||
| 257 | int end = result.length(); | - | ||||||||||||
| 258 | while (end 
 
 | 2-13 | ||||||||||||
| 259 | end--; executed 9 times by 1 test:  end--;Executed by: 
 | 9 | ||||||||||||
| 260 | result.truncate(end); | - | ||||||||||||
| 261 | } executed 6 times by 1 test:  end of blockExecuted by: 
 | 6 | ||||||||||||
| 262 | - | |||||||||||||
| 263 | result.replace(QLatin1Char('\''), QLatin1String("''")); | - | ||||||||||||
| 264 | r = QLatin1Char('\'') + result + QLatin1Char('\''); | - | ||||||||||||
| 265 | break; executed 43 times by 3 tests:  break;Executed by: 
 | 43 | ||||||||||||
| 266 | } | - | ||||||||||||
| 267 | case never executed: QVariant::Bool: case QVariant::Bool:never executed:  case QVariant::Bool: | 0 | ||||||||||||
| 268 | r = QString::number(field.value().toBool()); | - | ||||||||||||
| 269 | break; never executed:  break; | 0 | ||||||||||||
| 270 | case never executed: QVariant::ByteArray : case QVariant::ByteArray :never executed: { case QVariant::ByteArray : | 0 | ||||||||||||
| 271 | if (hasFeature(BLOB) 
 | 0 | ||||||||||||
| 272 | QByteArray ba = field.value().toByteArray(); | - | ||||||||||||
| 273 | QString res; | - | ||||||||||||
| 274 | static const char hexchars[] = "0123456789abcdef"; | - | ||||||||||||
| 275 | for (int i = 0; i < ba.size() 
 | 0 | ||||||||||||
| 276 | uchar s = (uchar) ba[i]; | - | ||||||||||||
| 277 | res += QLatin1Char(hexchars[s >> 4]); | - | ||||||||||||
| 278 | res += QLatin1Char(hexchars[s & 0x0f]); | - | ||||||||||||
| 279 | } never executed:  end of block | 0 | ||||||||||||
| 280 | r = QLatin1Char('\'') + res + QLatin1Char('\''); | - | ||||||||||||
| 281 | break; never executed:  break; | 0 | ||||||||||||
| 282 | } | - | ||||||||||||
| 283 | } | - | ||||||||||||
| 284 | - | |||||||||||||
| 285 | default executed 1 time by 1 test:  default:Executed by: 
 code before this statement never executed:  default:executed 1 time by 1 test: : default:Executed by: 
 code before this statement never executed:  default:executed 1 time by 1 test:  default:Executed by: 
 | 0-1 | ||||||||||||
| 286 | r = field.value().toString(); | - | ||||||||||||
| 287 | break; executed 1 time by 1 test:  break;Executed by: 
 | 1 | ||||||||||||
| 288 | } | - | ||||||||||||
| 289 | } | - | ||||||||||||
| 290 | return executed 126 times by 4 tests: r; return r;Executed by: 
 executed 126 times by 4 tests:  return r;Executed by: 
 | 126 | ||||||||||||
| 291 | } | - | ||||||||||||
| 292 | QVariant QSqlDriver::handle() const | - | ||||||||||||
| 293 | { | - | ||||||||||||
| 294 | return never executed: QVariant(); return QVariant();never executed:  return QVariant(); | 0 | ||||||||||||
| 295 | } | - | ||||||||||||
| 296 | bool QSqlDriver::subscribeToNotification(const QString &name) | - | ||||||||||||
| 297 | { | - | ||||||||||||
| 298 | (void)name;; | - | ||||||||||||
| 299 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 300 | } | - | ||||||||||||
| 301 | bool QSqlDriver::unsubscribeFromNotification(const QString &name) | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | (void)name;; | - | ||||||||||||
| 304 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | QStringList QSqlDriver::subscribedToNotifications() const | - | ||||||||||||
| 307 | { | - | ||||||||||||
| 308 | return never executed: QStringList(); return QStringList();never executed:  return QStringList(); | 0 | ||||||||||||
| 309 | } | - | ||||||||||||
| 310 | void QSqlDriver::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) | - | ||||||||||||
| 311 | { | - | ||||||||||||
| 312 | QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 313 | d->precisionPolicy = precisionPolicy; | - | ||||||||||||
| 314 | } executed 2 times by 1 test:  end of blockExecuted by: 
 | 2 | ||||||||||||
| 315 | QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const | - | ||||||||||||
| 316 | { | - | ||||||||||||
| 317 | const QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 318 | return executed 2194 times by 10 tests: d->precisionPolicy; return d->precisionPolicy;Executed by: 
 executed 2194 times by 10 tests:  return d->precisionPolicy;Executed by: 
 | 2194 | ||||||||||||
| 319 | } | - | ||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | - | |||||||||||||
| 324 | - | |||||||||||||
| 325 | - | |||||||||||||
| 326 | QSqlDriver::DbmsType QSqlDriver::dbmsType() const | - | ||||||||||||
| 327 | { | - | ||||||||||||
| 328 | const QSqlDriverPrivate * const d = d_func(); | - | ||||||||||||
| 329 | return executed 270 times by 8 tests: d->dbmsType; return d->dbmsType;Executed by: 
 executed 270 times by 8 tests:  return d->dbmsType;Executed by: 
 | 270 | ||||||||||||
| 330 | } | - | ||||||||||||
| 331 | bool QSqlDriver::cancelQuery() | - | ||||||||||||
| 332 | { | - | ||||||||||||
| 333 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | - | |||||||||||||
| Switch to Source code | Preprocessed file |