fix upstream QTBUG-15773 and QTBUG-70506

upstream commits:
49efea26a5
dedd4a7a7c

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-11-26 23:15:58 +00:00
parent f40fc06760
commit 4370a45efe
2 changed files with 17 additions and 7 deletions

3
README
View file

@ -76,7 +76,8 @@ QTBUG-40153, QTBUG-35479, QTBUG-1628, QTBUG-42989, QTBUG-34861, QTBUG-46767,
QTBUG-25114, QTBUG-24672, QTBUG-23524 (WIP), QTBUG-56088, QTBUG-42189, QTBUG-25114, QTBUG-24672, QTBUG-23524 (WIP), QTBUG-56088, QTBUG-42189,
QTBUG-39285, QTBUG-18173, QTBUG-28968, QTBUG-34336, QTBUG-40974, QTBUG-44286, QTBUG-39285, QTBUG-18173, QTBUG-28968, QTBUG-34336, QTBUG-40974, QTBUG-44286,
QTBUG-12564, QTBUG-20028, QTBUG-71967, QTBUG-70956, QTBUG-71446, QTBUG-61307, QTBUG-12564, QTBUG-20028, QTBUG-71967, QTBUG-70956, QTBUG-71446, QTBUG-61307,
QTBUG-27287, QTBUG-25143, QTBUG-22833, QTBUG-57399, QTBUG-59159 QTBUG-27287, QTBUG-25143, QTBUG-22833, QTBUG-57399, QTBUG-59159, QTBUG-15773,
QTBUG-70506
Unless you use QMake and QDoc porting to Katie or even supporting it along with Unless you use QMake and QDoc porting to Katie or even supporting it along with
Qt4 in the same codebase is trivial and requires only minor changes because Qt4 in the same codebase is trivial and requires only minor changes because

View file

@ -89,7 +89,7 @@ static QVariant::Type qGetColumnType(const QString &tpName)
} }
static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type, static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type,
int errorCode = -1) int errorCode)
{ {
return QSqlError(descr, return QSqlError(descr,
QString::fromUtf8(reinterpret_cast<const char *>(sqlite3_errmsg(access))), QString::fromUtf8(reinterpret_cast<const char *>(sqlite3_errmsg(access))),
@ -563,15 +563,23 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
sqlite3_enable_shared_cache(sharedCache); sqlite3_enable_shared_cache(sharedCache);
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { const int res = sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL);
if (res == SQLITE_OK) {
sqlite3_busy_timeout(d->access, timeOut); sqlite3_busy_timeout(d->access, timeOut);
setOpen(true); setOpen(true);
setOpenError(false); setOpenError(false);
return true; return true;
} else { } else {
setLastError(qMakeError(d->access, tr("Error opening database"), setLastError(qMakeError(d->access, tr("Error opening database"),
QSqlError::ConnectionError)); QSqlError::ConnectionError, res));
setOpenError(true); setOpenError(true);
if (d->access) {
sqlite3_close(d->access);
d->access = 0;
}
return false; return false;
} }
} }
@ -582,9 +590,10 @@ void QSQLiteDriver::close()
foreach (QSQLiteResult *result, d->results) foreach (QSQLiteResult *result, d->results)
result->d->finalize(); result->d->finalize();
if (sqlite3_close(d->access) != SQLITE_OK) const int res = sqlite3_close(d->access);
setLastError(qMakeError(d->access, tr("Error closing database"),
QSqlError::ConnectionError)); if (res != SQLITE_OK)
setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError, res));
d->access = 0; d->access = 0;
setOpen(false); setOpen(false);
setOpenError(false); setOpenError(false);