| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqlquery.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | class QSqlQueryPrivate | - | ||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||
| 9 | public: | - | ||||||||||||||||||||||||
| 10 | QSqlQueryPrivate(QSqlResult* result); | - | ||||||||||||||||||||||||
| 11 | ~QSqlQueryPrivate(); | - | ||||||||||||||||||||||||
| 12 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 13 | QSqlResult* sqlResult; | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | static QSqlQueryPrivate* shared_null(); | - | ||||||||||||||||||||||||
| 16 | }; | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | namespace { namespace Q_QGS_nullQueryPrivate { typedef QSqlQueryPrivate Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 8 times by 8 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 8 times by 8 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (0))) : value (0) { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 1440 times by 8 tests: &holder.value;return &holder.value;Executed by:
executed 1440 times by 8 tests: } } } static QGlobalStatic<QSqlQueryPrivate, Q_QGS_nullQueryPrivate::innerFunction, Q_QGS_nullQueryPrivate::guard> nullQueryPrivate;return &holder.value;Executed by:
| 0-1440 | ||||||||||||||||||||||||
| 19 | namespace { namespace Q_QGS_nullDriver { typedef QSqlNullDriver Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 9 times by 9 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 9 times by 9 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 9 times by 9 tests: &holder.value;return &holder.value;Executed by:
executed 9 times by 9 tests: } } } static QGlobalStatic<QSqlNullDriver, Q_QGS_nullDriver::innerFunction, Q_QGS_nullDriver::guard> nullDriver;return &holder.value;Executed by:
| 0-9 | ||||||||||||||||||||||||
| 20 | namespace { namespace Q_QGS_nullResult { typedef QSqlNullResult Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 9 times by 9 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 9 times by 9 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (nullDriver()))) : value (nullDriver()) { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 2198 times by 17 tests: &holder.value;return &holder.value;Executed by:
executed 2198 times by 17 tests: } } } static QGlobalStatic<QSqlNullResult, Q_QGS_nullResult::innerFunction, Q_QGS_nullResult::guard> nullResult;return &holder.value;Executed by:
| 0-2198 | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | QSqlQueryPrivate* QSqlQueryPrivate::shared_null() | - | ||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||
| 24 | QSqlQueryPrivate *null = nullQueryPrivate(); | - | ||||||||||||||||||||||||
| 25 | null->ref.ref(); | - | ||||||||||||||||||||||||
| 26 | return executed 1440 times by 8 tests: null;return null;Executed by:
executed 1440 times by 8 tests: return null;Executed by:
| 1440 | ||||||||||||||||||||||||
| 27 | } | - | ||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | QSqlQueryPrivate::QSqlQueryPrivate(QSqlResult* result) | - | ||||||||||||||||||||||||
| 33 | : ref(1), sqlResult(result) | - | ||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||
| 35 | if (!sqlResult
| 8-2182 | ||||||||||||||||||||||||
| 36 | sqlResult = nullResult(); executed 8 times by 8 tests: sqlResult = nullResult();Executed by:
| 8 | ||||||||||||||||||||||||
| 37 | } executed 2190 times by 9 tests: end of blockExecuted by:
| 2190 | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | QSqlQueryPrivate::~QSqlQueryPrivate() | - | ||||||||||||||||||||||||
| 40 | { | - | ||||||||||||||||||||||||
| 41 | QSqlResult *nr = nullResult(); | - | ||||||||||||||||||||||||
| 42 | if (!nr
| 0-2190 | ||||||||||||||||||||||||
| 43 | return; executed 8 times by 8 tests: return;Executed by:
| 8 | ||||||||||||||||||||||||
| 44 | delete sqlResult; | - | ||||||||||||||||||||||||
| 45 | } executed 2182 times by 9 tests: end of blockExecuted by:
| 2182 | ||||||||||||||||||||||||
| 46 | QSqlQuery::QSqlQuery(QSqlResult *result) | - | ||||||||||||||||||||||||
| 47 | { | - | ||||||||||||||||||||||||
| 48 | d = new QSqlQueryPrivate(result); | - | ||||||||||||||||||||||||
| 49 | } executed 2182 times by 9 tests: end of blockExecuted by:
| 2182 | ||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | QSqlQuery::~QSqlQuery() | - | ||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||
| 57 | if (!d->ref.deref()
| 1604-2019 | ||||||||||||||||||||||||
| 58 | delete d; executed 1604 times by 9 tests: delete d;Executed by:
| 1604 | ||||||||||||||||||||||||
| 59 | } executed 3623 times by 9 tests: end of blockExecuted by:
| 3623 | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | QSqlQuery::QSqlQuery(const QSqlQuery& other) | - | ||||||||||||||||||||||||
| 66 | { | - | ||||||||||||||||||||||||
| 67 | d = other.d; | - | ||||||||||||||||||||||||
| 68 | d->ref.ref(); | - | ||||||||||||||||||||||||
| 69 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db) | - | ||||||||||||||||||||||||
| 75 | { | - | ||||||||||||||||||||||||
| 76 | QSqlDatabase database = db; | - | ||||||||||||||||||||||||
| 77 | if (!database.isValid()
| 667-773 | ||||||||||||||||||||||||
| 78 | database = QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection), false); executed 773 times by 5 tests: database = QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection), false);Executed by:
| 773 | ||||||||||||||||||||||||
| 79 | if (database.isValid()
| 260-1180 | ||||||||||||||||||||||||
| 80 | *q = QSqlQuery(database.driver()->createResult()); | - | ||||||||||||||||||||||||
| 81 | } executed 1180 times by 8 tests: end of blockExecuted by:
| 1180 | ||||||||||||||||||||||||
| 82 | if (!query.isEmpty()
| 540-900 | ||||||||||||||||||||||||
| 83 | q->exec(query); executed 540 times by 6 tests: q->exec(query);Executed by:
| 540 | ||||||||||||||||||||||||
| 84 | } executed 1440 times by 8 tests: end of blockExecuted by:
| 1440 | ||||||||||||||||||||||||
| 85 | QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db) | - | ||||||||||||||||||||||||
| 86 | { | - | ||||||||||||||||||||||||
| 87 | d = QSqlQueryPrivate::shared_null(); | - | ||||||||||||||||||||||||
| 88 | qInit(this, query, db); | - | ||||||||||||||||||||||||
| 89 | } executed 1109 times by 7 tests: end of blockExecuted by:
| 1109 | ||||||||||||||||||||||||
| 90 | QSqlQuery::QSqlQuery(QSqlDatabase db) | - | ||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||
| 92 | d = QSqlQueryPrivate::shared_null(); | - | ||||||||||||||||||||||||
| 93 | qInit(this, QString(), db); | - | ||||||||||||||||||||||||
| 94 | } executed 331 times by 7 tests: end of blockExecuted by:
| 331 | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | QSqlQuery& QSqlQuery::operator=(const QSqlQuery& other) | - | ||||||||||||||||||||||||
| 102 | { | - | ||||||||||||||||||||||||
| 103 | qAtomicAssign(d, other.d); | - | ||||||||||||||||||||||||
| 104 | return executed 2022 times by 8 tests: *this;return *this;Executed by:
executed 2022 times by 8 tests: return *this;Executed by:
| 2022 | ||||||||||||||||||||||||
| 105 | } | - | ||||||||||||||||||||||||
| 106 | bool QSqlQuery::isNull(int field) const | - | ||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||
| 108 | return executed 10 times by 1 test: !d->sqlResult->isActive()return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);Executed by:
executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);Executed by:
| 10 | ||||||||||||||||||||||||
| 109 | || !d->sqlResult->isValid() executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);Executed by:
| 10 | ||||||||||||||||||||||||
| 110 | || d->sqlResult->isNull(field); executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);Executed by:
| 10 | ||||||||||||||||||||||||
| 111 | } | - | ||||||||||||||||||||||||
| 112 | bool QSqlQuery::isNull(const QString &name) const | - | ||||||||||||||||||||||||
| 113 | { | - | ||||||||||||||||||||||||
| 114 | int index = d->sqlResult->record().indexOf(name); | - | ||||||||||||||||||||||||
| 115 | if (index > -1
| 1-4 | ||||||||||||||||||||||||
| 116 | return executed 4 times by 1 test: isNull(index);return isNull(index);Executed by:
executed 4 times by 1 test: return isNull(index);Executed by:
| 4 | ||||||||||||||||||||||||
| 117 | QMessageLogger(__FILE__, 342, __PRETTY_FUNCTION__).warning("QSqlQuery::isNull: unknown field name '%s'", QString(name).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
| 118 | return executed 1 time by 1 test: true;return true;Executed by:
executed 1 time by 1 test: return true;Executed by:
| 1 | ||||||||||||||||||||||||
| 119 | } | - | ||||||||||||||||||||||||
| 120 | bool QSqlQuery::exec(const QString& query) | - | ||||||||||||||||||||||||
| 121 | { | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | if (d->ref.load() != 1
| 5-2553 | ||||||||||||||||||||||||
| 127 | bool fo = isForwardOnly(); | - | ||||||||||||||||||||||||
| 128 | *this = QSqlQuery(driver()->createResult()); | - | ||||||||||||||||||||||||
| 129 | d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); | - | ||||||||||||||||||||||||
| 130 | setForwardOnly(fo); | - | ||||||||||||||||||||||||
| 131 | } executed 5 times by 1 test: else {end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 132 | d->sqlResult->clear(); | - | ||||||||||||||||||||||||
| 133 | d->sqlResult->setActive(false); | - | ||||||||||||||||||||||||
| 134 | d->sqlResult->setLastError(QSqlError()); | - | ||||||||||||||||||||||||
| 135 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 136 | d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); | - | ||||||||||||||||||||||||
| 137 | } executed 2553 times by 9 tests: end of blockExecuted by:
| 2553 | ||||||||||||||||||||||||
| 138 | d->sqlResult->setQuery(query.trimmed()); | - | ||||||||||||||||||||||||
| 139 | if (!driver()->isOpen()
| 0-2556 | ||||||||||||||||||||||||
| 140 | QMessageLogger(__FILE__, 391, __PRETTY_FUNCTION__).warning("QSqlQuery::exec: database not open"); | - | ||||||||||||||||||||||||
| 141 | return executed 2 times by 1 test: false;return false;Executed by:
executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||
| 142 | } | - | ||||||||||||||||||||||||
| 143 | if (query.isEmpty()
| 0-2556 | ||||||||||||||||||||||||
| 144 | QMessageLogger(__FILE__, 395, __PRETTY_FUNCTION__).warning("QSqlQuery::exec: empty query"); | - | ||||||||||||||||||||||||
| 145 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | bool retval = d->sqlResult->reset(query); | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||
| 154 | return executed 2556 times by 9 tests: retval;return retval;Executed by:
executed 2556 times by 9 tests: return retval;Executed by:
| 2556 | ||||||||||||||||||||||||
| 155 | } | - | ||||||||||||||||||||||||
| 156 | QVariant QSqlQuery::value(int index) const | - | ||||||||||||||||||||||||
| 157 | { | - | ||||||||||||||||||||||||
| 158 | if (isActive()
| 0-9138 | ||||||||||||||||||||||||
| 159 | return executed 9138 times by 8 tests: d->sqlResult->data(index);return d->sqlResult->data(index);Executed by:
executed 9138 times by 8 tests: return d->sqlResult->data(index);Executed by:
| 9138 | ||||||||||||||||||||||||
| 160 | QMessageLogger(__FILE__, 431, __PRETTY_FUNCTION__).warning("QSqlQuery::value: not positioned on a valid record"); | - | ||||||||||||||||||||||||
| 161 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
| 162 | } | - | ||||||||||||||||||||||||
| 163 | QVariant QSqlQuery::value(const QString& name) const | - | ||||||||||||||||||||||||
| 164 | { | - | ||||||||||||||||||||||||
| 165 | int index = d->sqlResult->record().indexOf(name); | - | ||||||||||||||||||||||||
| 166 | if (index > -1
| 0-5 | ||||||||||||||||||||||||
| 167 | return executed 5 times by 1 test: value(index);return value(index);Executed by:
executed 5 times by 1 test: return value(index);Executed by:
| 5 | ||||||||||||||||||||||||
| 168 | QMessageLogger(__FILE__, 449, __PRETTY_FUNCTION__).warning("QSqlQuery::value: unknown field name '%s'", QString(name).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
| 169 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
| 170 | } | - | ||||||||||||||||||||||||
| 171 | int QSqlQuery::at() const | - | ||||||||||||||||||||||||
| 172 | { | - | ||||||||||||||||||||||||
| 173 | return executed 10980 times by 9 tests: d->sqlResult->at();return d->sqlResult->at();Executed by:
executed 10980 times by 9 tests: return d->sqlResult->at();Executed by:
| 10980 | ||||||||||||||||||||||||
| 174 | } | - | ||||||||||||||||||||||||
| 175 | QString QSqlQuery::lastQuery() const | - | ||||||||||||||||||||||||
| 176 | { | - | ||||||||||||||||||||||||
| 177 | return executed 124 times by 3 tests: d->sqlResult->lastQuery();return d->sqlResult->lastQuery();Executed by:
executed 124 times by 3 tests: return d->sqlResult->lastQuery();Executed by:
| 124 | ||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | const QSqlDriver *QSqlQuery::driver() const | - | ||||||||||||||||||||||||
| 185 | { | - | ||||||||||||||||||||||||
| 186 | return executed 6714 times by 9 tests: d->sqlResult->driver();return d->sqlResult->driver();Executed by:
executed 6714 times by 9 tests: return d->sqlResult->driver();Executed by:
| 6714 | ||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | const QSqlResult* QSqlQuery::result() const | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | return executed 155 times by 3 tests: d->sqlResult;return d->sqlResult;Executed by:
executed 155 times by 3 tests: return d->sqlResult;Executed by:
| 155 | ||||||||||||||||||||||||
| 196 | } | - | ||||||||||||||||||||||||
| 197 | bool QSqlQuery::seek(int index, bool relative) | - | ||||||||||||||||||||||||
| 198 | { | - | ||||||||||||||||||||||||
| 199 | if (!isSelect()
| 0-3877 | ||||||||||||||||||||||||
| 200 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 201 | int actualIdx; | - | ||||||||||||||||||||||||
| 202 | if (!relative
| 3-3874 | ||||||||||||||||||||||||
| 203 | if (index < 0
| 2-3872 | ||||||||||||||||||||||||
| 204 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 205 | return executed 2 times by 1 test: false;return false;Executed by:
executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | actualIdx = index; | - | ||||||||||||||||||||||||
| 208 | } executed 3872 times by 5 tests: else {end of blockExecuted by:
| 3872 | ||||||||||||||||||||||||
| 209 | switch (at()) { | - | ||||||||||||||||||||||||
| 210 | case executed 1 time by 1 test: QSql::BeforeFirstRow:case QSql::BeforeFirstRow:Executed by:
executed 1 time by 1 test: case QSql::BeforeFirstRow:Executed by:
| 1 | ||||||||||||||||||||||||
| 211 | if (index > 0
| 0-1 | ||||||||||||||||||||||||
| 212 | actualIdx = index - 1; executed 1 time by 1 test: actualIdx = index - 1;Executed by:
| 1 | ||||||||||||||||||||||||
| 213 | else { | - | ||||||||||||||||||||||||
| 214 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||
| 216 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 217 | case executed 1 time by 1 test: QSql::AfterLastRow:case QSql::AfterLastRow:Executed by:
executed 1 time by 1 test: case QSql::AfterLastRow:Executed by:
| 1 | ||||||||||||||||||||||||
| 218 | if (index < 0
| 0-1 | ||||||||||||||||||||||||
| 219 | d->sqlResult->fetchLast(); | - | ||||||||||||||||||||||||
| 220 | actualIdx = at() + index + 1; | - | ||||||||||||||||||||||||
| 221 | } executed 1 time by 1 test: else {end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 222 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 223 | } | - | ||||||||||||||||||||||||
| 224 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 225 | default executed 1 time by 1 test: :default:Executed by:
executed 1 time by 1 test: default:Executed by:
| 1 | ||||||||||||||||||||||||
| 226 | if ((
| 0-1 | ||||||||||||||||||||||||
| 227 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 228 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||
| 230 | actualIdx = at() + index; | - | ||||||||||||||||||||||||
| 231 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||
| 232 | } | - | ||||||||||||||||||||||||
| 233 | } | - | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | if (isForwardOnly()
| 1-3873 | ||||||||||||||||||||||||
| 236 | QMessageLogger(__FILE__, 595, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query"); | - | ||||||||||||||||||||||||
| 237 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||||||||||||||
| 238 | } | - | ||||||||||||||||||||||||
| 239 | if (actualIdx == (at() + 1)
| 3-2650 | ||||||||||||||||||||||||
| 240 | if (!d->sqlResult->fetchNext()
| 0-1221 | ||||||||||||||||||||||||
| 241 | d->sqlResult->setAt(QSql::AfterLastRow); | - | ||||||||||||||||||||||||
| 242 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 243 | } | - | ||||||||||||||||||||||||
| 244 | return executed 1221 times by 4 tests: true;return true;Executed by:
executed 1221 times by 4 tests: return true;Executed by:
| 1221 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | if (actualIdx == (at() - 1)
| 39-2614 | ||||||||||||||||||||||||
| 247 | if (!d->sqlResult->fetchPrevious()
| 0-39 | ||||||||||||||||||||||||
| 248 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 249 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | return executed 39 times by 3 tests: true;return true;Executed by:
executed 39 times by 3 tests: return true;Executed by:
| 39 | ||||||||||||||||||||||||
| 252 | } | - | ||||||||||||||||||||||||
| 253 | if (!d->sqlResult->fetch(actualIdx)
| 270-2344 | ||||||||||||||||||||||||
| 254 | d->sqlResult->setAt(QSql::AfterLastRow); | - | ||||||||||||||||||||||||
| 255 | return executed 270 times by 5 tests: false;return false;Executed by:
executed 270 times by 5 tests: return false;Executed by:
| 270 | ||||||||||||||||||||||||
| 256 | } | - | ||||||||||||||||||||||||
| 257 | return executed 2344 times by 5 tests: true;return true;Executed by:
executed 2344 times by 5 tests: return true;Executed by:
| 2344 | ||||||||||||||||||||||||
| 258 | } | - | ||||||||||||||||||||||||
| 259 | bool QSqlQuery::next() | - | ||||||||||||||||||||||||
| 260 | { | - | ||||||||||||||||||||||||
| 261 | if (!isSelect()
| 0-3171 | ||||||||||||||||||||||||
| 262 | return executed 4 times by 2 tests: false;return false;Executed by:
executed 4 times by 2 tests: return false;Executed by:
| 4 | ||||||||||||||||||||||||
| 263 | bool b = false; | - | ||||||||||||||||||||||||
| 264 | switch (at()) { | - | ||||||||||||||||||||||||
| 265 | case executed 687 times by 8 tests: QSql::BeforeFirstRow:case QSql::BeforeFirstRow:Executed by:
executed 687 times by 8 tests: case QSql::BeforeFirstRow:Executed by:
| 687 | ||||||||||||||||||||||||
| 266 | b = d->sqlResult->fetchFirst(); | - | ||||||||||||||||||||||||
| 267 | return executed 687 times by 8 tests: b;return b;Executed by:
executed 687 times by 8 tests: return b;Executed by:
| 687 | ||||||||||||||||||||||||
| 268 | case executed 25 times by 8 tests: QSql::AfterLastRow:case QSql::AfterLastRow:Executed by:
executed 25 times by 8 tests: case QSql::AfterLastRow:Executed by:
| 25 | ||||||||||||||||||||||||
| 269 | return executed 25 times by 8 tests: false;return false;Executed by:
executed 25 times by 8 tests: return false;Executed by:
| 25 | ||||||||||||||||||||||||
| 270 | default executed 2459 times by 8 tests: :default:Executed by:
executed 2459 times by 8 tests: default:Executed by:
| 2459 | ||||||||||||||||||||||||
| 271 | if (!d->sqlResult->fetchNext()
| 821-1638 | ||||||||||||||||||||||||
| 272 | d->sqlResult->setAt(QSql::AfterLastRow); | - | ||||||||||||||||||||||||
| 273 | return executed 821 times by 8 tests: false;return false;Executed by:
executed 821 times by 8 tests: return false;Executed by:
| 821 | ||||||||||||||||||||||||
| 274 | } | - | ||||||||||||||||||||||||
| 275 | return executed 1638 times by 8 tests: true;return true;Executed by:
executed 1638 times by 8 tests: return true;Executed by:
| 1638 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | bool QSqlQuery::previous() | - | ||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||
| 280 | if (!isSelect()
| 0-3 | ||||||||||||||||||||||||
| 281 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 282 | if (isForwardOnly()
| 1-2 | ||||||||||||||||||||||||
| 283 | QMessageLogger(__FILE__, 702, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query"); | - | ||||||||||||||||||||||||
| 284 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||||||||||||||
| 285 | } | - | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | bool b = false; | - | ||||||||||||||||||||||||
| 288 | switch (at()) { | - | ||||||||||||||||||||||||
| 289 | case never executed: QSql::BeforeFirstRow:case QSql::BeforeFirstRow:never executed: case QSql::BeforeFirstRow: | 0 | ||||||||||||||||||||||||
| 290 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 291 | case executed 1 time by 1 test: QSql::AfterLastRow:case QSql::AfterLastRow:Executed by:
executed 1 time by 1 test: case QSql::AfterLastRow:Executed by:
| 1 | ||||||||||||||||||||||||
| 292 | b = d->sqlResult->fetchLast(); | - | ||||||||||||||||||||||||
| 293 | return executed 1 time by 1 test: b;return b;Executed by:
executed 1 time by 1 test: return b;Executed by:
| 1 | ||||||||||||||||||||||||
| 294 | default executed 1 time by 1 test: :default:Executed by:
executed 1 time by 1 test: default:Executed by:
| 1 | ||||||||||||||||||||||||
| 295 | if (!d->sqlResult->fetchPrevious()
| 0-1 | ||||||||||||||||||||||||
| 296 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 297 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 298 | } | - | ||||||||||||||||||||||||
| 299 | return executed 1 time by 1 test: true;return true;Executed by:
executed 1 time by 1 test: return true;Executed by:
| 1 | ||||||||||||||||||||||||
| 300 | } | - | ||||||||||||||||||||||||
| 301 | } | - | ||||||||||||||||||||||||
| 302 | bool QSqlQuery::first() | - | ||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||
| 304 | if (!isSelect()
| 0-18 | ||||||||||||||||||||||||
| 305 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||||||||||||||
| 306 | if (isForwardOnly()
| 1-15 | ||||||||||||||||||||||||
| 307 | QMessageLogger(__FILE__, 737, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query"); | - | ||||||||||||||||||||||||
| 308 | return executed 2 times by 1 test: false;return false;Executed by:
executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||
| 309 | } | - | ||||||||||||||||||||||||
| 310 | bool b = false; | - | ||||||||||||||||||||||||
| 311 | b = d->sqlResult->fetchFirst(); | - | ||||||||||||||||||||||||
| 312 | return executed 16 times by 2 tests: b;return b;Executed by:
executed 16 times by 2 tests: return b;Executed by:
| 16 | ||||||||||||||||||||||||
| 313 | } | - | ||||||||||||||||||||||||
| 314 | bool QSqlQuery::last() | - | ||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||
| 316 | if (!isSelect()
| 0-8 | ||||||||||||||||||||||||
| 317 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 318 | bool b = false; | - | ||||||||||||||||||||||||
| 319 | b = d->sqlResult->fetchLast(); | - | ||||||||||||||||||||||||
| 320 | return executed 8 times by 1 test: b;return b;Executed by:
executed 8 times by 1 test: return b;Executed by:
| 8 | ||||||||||||||||||||||||
| 321 | } | - | ||||||||||||||||||||||||
| 322 | int QSqlQuery::size() const | - | ||||||||||||||||||||||||
| 323 | { | - | ||||||||||||||||||||||||
| 324 | if (isActive()
| 0-5 | ||||||||||||||||||||||||
| 325 | return never executed: d->sqlResult->size();return d->sqlResult->size();never executed: return d->sqlResult->size(); | 0 | ||||||||||||||||||||||||
| 326 | return executed 6 times by 1 test: -1;return -1;Executed by:
executed 6 times by 1 test: return -1;Executed by:
| 6 | ||||||||||||||||||||||||
| 327 | } | - | ||||||||||||||||||||||||
| 328 | int QSqlQuery::numRowsAffected() const | - | ||||||||||||||||||||||||
| 329 | { | - | ||||||||||||||||||||||||
| 330 | if (isActive()
| 2-19 | ||||||||||||||||||||||||
| 331 | return executed 19 times by 1 test: d->sqlResult->numRowsAffected();return d->sqlResult->numRowsAffected();Executed by:
executed 19 times by 1 test: return d->sqlResult->numRowsAffected();Executed by:
| 19 | ||||||||||||||||||||||||
| 332 | return executed 2 times by 1 test: -1;return -1;Executed by:
executed 2 times by 1 test: return -1;Executed by:
| 2 | ||||||||||||||||||||||||
| 333 | } | - | ||||||||||||||||||||||||
| 334 | QSqlError QSqlQuery::lastError() const | - | ||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||
| 336 | return executed 11093 times by 7 tests: d->sqlResult->lastError();return d->sqlResult->lastError();Executed by:
executed 11093 times by 7 tests: return d->sqlResult->lastError();Executed by:
| 11093 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | bool QSqlQuery::isValid() const | - | ||||||||||||||||||||||||
| 345 | { | - | ||||||||||||||||||||||||
| 346 | return executed 9645 times by 8 tests: d->sqlResult->isValid();return d->sqlResult->isValid();Executed by:
executed 9645 times by 8 tests: return d->sqlResult->isValid();Executed by:
| 9645 | ||||||||||||||||||||||||
| 347 | } | - | ||||||||||||||||||||||||
| 348 | bool QSqlQuery::isActive() const | - | ||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||
| 350 | return executed 16973 times by 9 tests: d->sqlResult->isActive();return d->sqlResult->isActive();Executed by:
executed 16973 times by 9 tests: return d->sqlResult->isActive();Executed by:
| 16973 | ||||||||||||||||||||||||
| 351 | } | - | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | bool QSqlQuery::isSelect() const | - | ||||||||||||||||||||||||
| 359 | { | - | ||||||||||||||||||||||||
| 360 | return executed 7084 times by 9 tests: d->sqlResult->isSelect();return d->sqlResult->isSelect();Executed by:
executed 7084 times by 9 tests: return d->sqlResult->isSelect();Executed by:
| 7084 | ||||||||||||||||||||||||
| 361 | } | - | ||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | bool QSqlQuery::isForwardOnly() const | - | ||||||||||||||||||||||||
| 370 | { | - | ||||||||||||||||||||||||
| 371 | return executed 4291 times by 6 tests: d->sqlResult->isForwardOnly();return d->sqlResult->isForwardOnly();Executed by:
executed 4291 times by 6 tests: return d->sqlResult->isForwardOnly();Executed by:
| 4291 | ||||||||||||||||||||||||
| 372 | } | - | ||||||||||||||||||||||||
| 373 | void QSqlQuery::setForwardOnly(bool forward) | - | ||||||||||||||||||||||||
| 374 | { | - | ||||||||||||||||||||||||
| 375 | d->sqlResult->setForwardOnly(forward); | - | ||||||||||||||||||||||||
| 376 | } executed 647 times by 9 tests: end of blockExecuted by:
| 647 | ||||||||||||||||||||||||
| 377 | QSqlRecord QSqlQuery::record() const | - | ||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||
| 379 | QSqlRecord rec = d->sqlResult->record(); | - | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | if (isValid()
| 100-403 | ||||||||||||||||||||||||
| 382 | for (int i = 0; i < rec.count()
| 100-241 | ||||||||||||||||||||||||
| 383 | rec.setValue(i, value(i)); executed 241 times by 5 tests: rec.setValue(i, value(i));Executed by:
| 241 | ||||||||||||||||||||||||
| 384 | } executed 100 times by 5 tests: end of blockExecuted by:
| 100 | ||||||||||||||||||||||||
| 385 | return executed 503 times by 7 tests: rec;return rec;Executed by:
executed 503 times by 7 tests: return rec;Executed by:
| 503 | ||||||||||||||||||||||||
| 386 | } | - | ||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | void QSqlQuery::clear() | - | ||||||||||||||||||||||||
| 394 | { | - | ||||||||||||||||||||||||
| 395 | *this = QSqlQuery(driver()->createResult()); | - | ||||||||||||||||||||||||
| 396 | } executed 398 times by 7 tests: end of blockExecuted by:
| 398 | ||||||||||||||||||||||||
| 397 | bool QSqlQuery::prepare(const QString& query) | - | ||||||||||||||||||||||||
| 398 | { | - | ||||||||||||||||||||||||
| 399 | if (d->ref.load() != 1
| 2-230 | ||||||||||||||||||||||||
| 400 | bool fo = isForwardOnly(); | - | ||||||||||||||||||||||||
| 401 | *this = QSqlQuery(driver()->createResult()); | - | ||||||||||||||||||||||||
| 402 | setForwardOnly(fo); | - | ||||||||||||||||||||||||
| 403 | d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); | - | ||||||||||||||||||||||||
| 404 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 405 | d->sqlResult->setActive(false); | - | ||||||||||||||||||||||||
| 406 | d->sqlResult->setLastError(QSqlError()); | - | ||||||||||||||||||||||||
| 407 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 408 | d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); | - | ||||||||||||||||||||||||
| 409 | } executed 230 times by 7 tests: end of blockExecuted by:
| 230 | ||||||||||||||||||||||||
| 410 | if (!driver()
| 0-232 | ||||||||||||||||||||||||
| 411 | QMessageLogger(__FILE__, 972, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: no driver"); | - | ||||||||||||||||||||||||
| 412 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 413 | } | - | ||||||||||||||||||||||||
| 414 | if (!driver()->isOpen()
| 0-232 | ||||||||||||||||||||||||
| 415 | QMessageLogger(__FILE__, 976, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: database not open"); | - | ||||||||||||||||||||||||
| 416 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||
| 418 | if (query.isEmpty()
| 0-232 | ||||||||||||||||||||||||
| 419 | QMessageLogger(__FILE__, 980, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: empty query"); | - | ||||||||||||||||||||||||
| 420 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 421 | } | - | ||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | return executed 232 times by 7 tests: d->sqlResult->savePrepare(query);return d->sqlResult->savePrepare(query);Executed by:
executed 232 times by 7 tests: return d->sqlResult->savePrepare(query);Executed by:
| 232 | ||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||
| 427 | bool QSqlQuery::exec() | - | ||||||||||||||||||||||||
| 428 | { | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | d->sqlResult->resetBindCount(); | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | if (d->sqlResult->lastError().isValid()
| 24656-92072 | ||||||||||||||||||||||||
| 436 | d->sqlResult->setLastError(QSqlError()); executed 92072 times by 2 tests: d->sqlResult->setLastError(QSqlError());Executed by:
| 92072 | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | bool retval = d->sqlResult->exec(); | - | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | return executed 116728 times by 7 tests: retval;return retval;Executed by:
executed 116728 times by 7 tests: return retval;Executed by:
| 116728 | ||||||||||||||||||||||||
| 445 | } | - | ||||||||||||||||||||||||
| 446 | bool QSqlQuery::execBatch(BatchExecutionMode mode) | - | ||||||||||||||||||||||||
| 447 | { | - | ||||||||||||||||||||||||
| 448 | d->sqlResult->resetBindCount(); | - | ||||||||||||||||||||||||
| 449 | return executed 2 times by 1 test: d->sqlResult->execBatch(mode == ValuesAsColumns);return d->sqlResult->execBatch(mode == ValuesAsColumns);Executed by:
executed 2 times by 1 test: return d->sqlResult->execBatch(mode == ValuesAsColumns);Executed by:
| 2 | ||||||||||||||||||||||||
| 450 | } | - | ||||||||||||||||||||||||
| 451 | void QSqlQuery::bindValue(const QString& placeholder, const QVariant& val, | - | ||||||||||||||||||||||||
| 452 | QSql::ParamType paramType | - | ||||||||||||||||||||||||
| 453 | ) | - | ||||||||||||||||||||||||
| 454 | { | - | ||||||||||||||||||||||||
| 455 | d->sqlResult->bindValue(placeholder, val, paramType); | - | ||||||||||||||||||||||||
| 456 | } executed 48 times by 2 tests: end of blockExecuted by:
| 48 | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | void QSqlQuery::bindValue(int pos, const QVariant& val, QSql::ParamType paramType) | - | ||||||||||||||||||||||||
| 465 | { | - | ||||||||||||||||||||||||
| 466 | d->sqlResult->bindValue(pos, val, paramType); | - | ||||||||||||||||||||||||
| 467 | } executed 89 times by 4 tests: end of blockExecuted by:
| 89 | ||||||||||||||||||||||||
| 468 | void QSqlQuery::addBindValue(const QVariant& val, QSql::ParamType paramType) | - | ||||||||||||||||||||||||
| 469 | { | - | ||||||||||||||||||||||||
| 470 | d->sqlResult->addBindValue(val, paramType); | - | ||||||||||||||||||||||||
| 471 | } executed 233364 times by 5 tests: end of blockExecuted by:
| 233364 | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | QVariant QSqlQuery::boundValue(const QString& placeholder) const | - | ||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||
| 480 | return never executed: d->sqlResult->boundValue(placeholder);return d->sqlResult->boundValue(placeholder);never executed: return d->sqlResult->boundValue(placeholder); | 0 | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | QVariant QSqlQuery::boundValue(int pos) const | - | ||||||||||||||||||||||||
| 487 | { | - | ||||||||||||||||||||||||
| 488 | return executed 1 time by 1 test: d->sqlResult->boundValue(pos);return d->sqlResult->boundValue(pos);Executed by:
executed 1 time by 1 test: return d->sqlResult->boundValue(pos);Executed by:
| 1 | ||||||||||||||||||||||||
| 489 | } | - | ||||||||||||||||||||||||
| 490 | QMap<QString,QVariant> QSqlQuery::boundValues() const | - | ||||||||||||||||||||||||
| 491 | { | - | ||||||||||||||||||||||||
| 492 | QMap<QString,QVariant> map; | - | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | const QVector<QVariant> values(d->sqlResult->boundValues()); | - | ||||||||||||||||||||||||
| 495 | for (int i = 0; i < values.count()
| 53-122 | ||||||||||||||||||||||||
| 496 | map[d->sqlResult->boundValueName(i)] = values.at(i); executed 122 times by 1 test: map[d->sqlResult->boundValueName(i)] = values.at(i);Executed by:
| 122 | ||||||||||||||||||||||||
| 497 | return executed 53 times by 1 test: map;return map;Executed by:
executed 53 times by 1 test: return map;Executed by:
| 53 | ||||||||||||||||||||||||
| 498 | } | - | ||||||||||||||||||||||||
| 499 | QString QSqlQuery::executedQuery() const | - | ||||||||||||||||||||||||
| 500 | { | - | ||||||||||||||||||||||||
| 501 | return executed 1 time by 1 test: d->sqlResult->executedQuery();return d->sqlResult->executedQuery();Executed by:
executed 1 time by 1 test: return d->sqlResult->executedQuery();Executed by:
| 1 | ||||||||||||||||||||||||
| 502 | } | - | ||||||||||||||||||||||||
| 503 | QVariant QSqlQuery::lastInsertId() const | - | ||||||||||||||||||||||||
| 504 | { | - | ||||||||||||||||||||||||
| 505 | return executed 7 times by 2 tests: d->sqlResult->lastInsertId();return d->sqlResult->lastInsertId();Executed by:
executed 7 times by 2 tests: return d->sqlResult->lastInsertId();Executed by:
| 7 | ||||||||||||||||||||||||
| 506 | } | - | ||||||||||||||||||||||||
| 507 | void QSqlQuery::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) | - | ||||||||||||||||||||||||
| 508 | { | - | ||||||||||||||||||||||||
| 509 | d->sqlResult->setNumericalPrecisionPolicy(precisionPolicy); | - | ||||||||||||||||||||||||
| 510 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | QSql::NumericalPrecisionPolicy QSqlQuery::numericalPrecisionPolicy() const | - | ||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||
| 519 | return never executed: d->sqlResult->numericalPrecisionPolicy();return d->sqlResult->numericalPrecisionPolicy();never executed: return d->sqlResult->numericalPrecisionPolicy(); | 0 | ||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||
| 521 | void QSqlQuery::finish() | - | ||||||||||||||||||||||||
| 522 | { | - | ||||||||||||||||||||||||
| 523 | if (isActive()
| 0-3 | ||||||||||||||||||||||||
| 524 | d->sqlResult->setLastError(QSqlError()); | - | ||||||||||||||||||||||||
| 525 | d->sqlResult->setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 526 | d->sqlResult->detachFromResultSet(); | - | ||||||||||||||||||||||||
| 527 | d->sqlResult->setActive(false); | - | ||||||||||||||||||||||||
| 528 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 529 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 530 | bool QSqlQuery::nextResult() | - | ||||||||||||||||||||||||
| 531 | { | - | ||||||||||||||||||||||||
| 532 | if (isActive()
| 0 | ||||||||||||||||||||||||
| 533 | return never executed: d->sqlResult->nextResult();return d->sqlResult->nextResult();never executed: return d->sqlResult->nextResult(); | 0 | ||||||||||||||||||||||||
| 534 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 535 | } | - | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |