| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqlerror.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | QDebug operator<<(QDebug dbg, const QSqlError &s) | - | ||||||
| 6 | { | - | ||||||
| 7 | QDebugStateSaver saver(dbg); | - | ||||||
| 8 | dbg.nospace(); | - | ||||||
| 9 | dbg << "QSqlError(" << s.nativeErrorCode() << ", " << s.driverText() | - | ||||||
| 10 | << ", " << s.databaseText() << ')'; | - | ||||||
| 11 | return never executed: dbg;return dbg;never executed: return dbg; | 0 | ||||||
| 12 | } | - | ||||||
| 13 | - | |||||||
| 14 | - | |||||||
| 15 | class QSqlErrorPrivate | - | ||||||
| 16 | { | - | ||||||
| 17 | public: | - | ||||||
| 18 | QString driverError; | - | ||||||
| 19 | QString databaseError; | - | ||||||
| 20 | QSqlError::ErrorType errorType; | - | ||||||
| 21 | QString errorCode; | - | ||||||
| 22 | }; | - | ||||||
| 23 | QSqlError::QSqlError(const QString& driverText, const QString& databaseText, ErrorType type, | - | ||||||
| 24 | int number) | - | ||||||
| 25 | { | - | ||||||
| 26 | d = new QSqlErrorPrivate; | - | ||||||
| 27 | - | |||||||
| 28 | d->driverError = driverText; | - | ||||||
| 29 | d->databaseError = databaseText; | - | ||||||
| 30 | d->errorType = type; | - | ||||||
| 31 | if (number != -1
| 2-3 | ||||||
| 32 | d->errorCode = QString::number(number); executed 2 times by 2 tests: d->errorCode = QString::number(number);Executed by:
| 2 | ||||||
| 33 | } executed 5 times by 2 tests: end of blockExecuted by:
| 5 | ||||||
| 34 | QSqlError::QSqlError(const QString &driverText, const QString &databaseText, | - | ||||||
| 35 | ErrorType type, const QString &code) | - | ||||||
| 36 | { | - | ||||||
| 37 | d = new QSqlErrorPrivate; | - | ||||||
| 38 | - | |||||||
| 39 | d->driverError = driverText; | - | ||||||
| 40 | d->databaseError = databaseText; | - | ||||||
| 41 | d->errorType = type; | - | ||||||
| 42 | d->errorCode = code; | - | ||||||
| 43 | } executed 309827 times by 11 tests: end of blockExecuted by:
| 309827 | ||||||
| 44 | - | |||||||
| 45 | - | |||||||
| 46 | - | |||||||
| 47 | - | |||||||
| 48 | - | |||||||
| 49 | QSqlError::QSqlError(const QSqlError& other) | - | ||||||
| 50 | { | - | ||||||
| 51 | d = new QSqlErrorPrivate; | - | ||||||
| 52 | - | |||||||
| 53 | *d = *other.d; | - | ||||||
| 54 | } executed 247768 times by 10 tests: end of blockExecuted by:
| 247768 | ||||||
| 55 | - | |||||||
| 56 | - | |||||||
| 57 | - | |||||||
| 58 | - | |||||||
| 59 | - | |||||||
| 60 | QSqlError& QSqlError::operator=(const QSqlError& other) | - | ||||||
| 61 | { | - | ||||||
| 62 | *d = *other.d; | - | ||||||
| 63 | return executed 307318 times by 9 tests: *this;return *this;Executed by:
executed 307318 times by 9 tests: return *this;Executed by:
| 307318 | ||||||
| 64 | } | - | ||||||
| 65 | - | |||||||
| 66 | - | |||||||
| 67 | - | |||||||
| 68 | - | |||||||
| 69 | - | |||||||
| 70 | bool QSqlError::operator==(const QSqlError& other) const | - | ||||||
| 71 | { | - | ||||||
| 72 | return executed 1 time by 1 test: (d->errorType == other.d->errorType);return (d->errorType == other.d->errorType);Executed by:
executed 1 time by 1 test: return (d->errorType == other.d->errorType);Executed by:
| 1 | ||||||
| 73 | } | - | ||||||
| 74 | - | |||||||
| 75 | - | |||||||
| 76 | - | |||||||
| 77 | - | |||||||
| 78 | - | |||||||
| 79 | - | |||||||
| 80 | bool QSqlError::operator!=(const QSqlError& other) const | - | ||||||
| 81 | { | - | ||||||
| 82 | return executed 1 time by 1 test: (d->errorType != other.d->errorType);return (d->errorType != other.d->errorType);Executed by:
executed 1 time by 1 test: return (d->errorType != other.d->errorType);Executed by:
| 1 | ||||||
| 83 | } | - | ||||||
| 84 | - | |||||||
| 85 | - | |||||||
| 86 | - | |||||||
| 87 | - | |||||||
| 88 | - | |||||||
| 89 | - | |||||||
| 90 | QSqlError::~QSqlError() | - | ||||||
| 91 | { | - | ||||||
| 92 | delete d; | - | ||||||
| 93 | } executed 557602 times by 20 tests: end of blockExecuted by:
| 557602 | ||||||
| 94 | - | |||||||
| 95 | - | |||||||
| 96 | - | |||||||
| 97 | - | |||||||
| 98 | - | |||||||
| 99 | - | |||||||
| 100 | - | |||||||
| 101 | QString QSqlError::driverText() const | - | ||||||
| 102 | { | - | ||||||
| 103 | return executed 11607 times by 9 tests: d->driverError;return d->driverError;Executed by:
executed 11607 times by 9 tests: return d->driverError;Executed by:
| 11607 | ||||||
| 104 | } | - | ||||||
| 105 | void QSqlError::setDriverText(const QString& driverText) | - | ||||||
| 106 | { | - | ||||||
| 107 | d->driverError = driverText; | - | ||||||
| 108 | } never executed: end of block | 0 | ||||||
| 109 | QString QSqlError::databaseText() const | - | ||||||
| 110 | { | - | ||||||
| 111 | return executed 11575 times by 9 tests: d->databaseError;return d->databaseError;Executed by:
executed 11575 times by 9 tests: return d->databaseError;Executed by:
| 11575 | ||||||
| 112 | } | - | ||||||
| 113 | void QSqlError::setDatabaseText(const QString& databaseText) | - | ||||||
| 114 | { | - | ||||||
| 115 | d->databaseError = databaseText; | - | ||||||
| 116 | } never executed: end of block | 0 | ||||||
| 117 | - | |||||||
| 118 | - | |||||||
| 119 | - | |||||||
| 120 | - | |||||||
| 121 | - | |||||||
| 122 | - | |||||||
| 123 | QSqlError::ErrorType QSqlError::type() const | - | ||||||
| 124 | { | - | ||||||
| 125 | return executed 22 times by 3 tests: d->errorType;return d->errorType;Executed by:
executed 22 times by 3 tests: return d->errorType;Executed by:
| 22 | ||||||
| 126 | } | - | ||||||
| 127 | void QSqlError::setType(ErrorType type) | - | ||||||
| 128 | { | - | ||||||
| 129 | d->errorType = type; | - | ||||||
| 130 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||
| 131 | int QSqlError::number() const | - | ||||||
| 132 | { | - | ||||||
| 133 | return executed 12 times by 1 test: d->errorCode.isEmpty()return d->errorCode.isEmpty() ? -1 : d->errorCode.toInt();Executed by:
executed 12 times by 1 test: return d->errorCode.isEmpty() ? -1 : d->errorCode.toInt();Executed by:
| 2-12 | ||||||
| 134 | } | - | ||||||
| 135 | void QSqlError::setNumber(int number) | - | ||||||
| 136 | { | - | ||||||
| 137 | d->errorCode = QString::number(number); | - | ||||||
| 138 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||
| 139 | - | |||||||
| 140 | - | |||||||
| 141 | - | |||||||
| 142 | - | |||||||
| 143 | - | |||||||
| 144 | - | |||||||
| 145 | - | |||||||
| 146 | QString QSqlError::nativeErrorCode() const | - | ||||||
| 147 | { | - | ||||||
| 148 | return executed 11603 times by 9 tests: d->errorCode;return d->errorCode;Executed by:
executed 11603 times by 9 tests: return d->errorCode;Executed by:
| 11603 | ||||||
| 149 | } | - | ||||||
| 150 | QString QSqlError::text() const | - | ||||||
| 151 | { | - | ||||||
| 152 | QString result = d->databaseError; | - | ||||||
| 153 | if (!d->databaseError.endsWith(QLatin1String("\n"))
| 0 | ||||||
| 154 | result += QLatin1Char(' '); never executed: result += QLatin1Char(' '); | 0 | ||||||
| 155 | result += d->driverError; | - | ||||||
| 156 | return never executed: result;return result;never executed: return result; | 0 | ||||||
| 157 | } | - | ||||||
| 158 | bool QSqlError::isValid() const | - | ||||||
| 159 | { | - | ||||||
| 160 | return executed 236170 times by 10 tests: d->errorType != NoError;return d->errorType != NoError;Executed by:
executed 236170 times by 10 tests: return d->errorType != NoError;Executed by:
| 236170 | ||||||
| 161 | } | - | ||||||
| 162 | - | |||||||
| 163 | - | |||||||
| Switch to Source code | Preprocessed file |