Permalink
Browse files

Revert "Fix sqlite driver memory eating due to close failure"

Introduced a problem for the SDK (QTBUG-23036).

This reverts commit 9a5fb6b.
  • Loading branch information...
1 parent 8a39004 commit ec31c6e5294285d0dc8e96d30d1300cfd1b0e96a Sinan Tanilkan committed Dec 7, 2011
Showing with 0 additions and 56 deletions.
  1. +0 −7 src/sql/drivers/sqlite/qsql_sqlite.cpp
  2. +0 −49 tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -104,7 +104,6 @@ class QSQLiteDriverPrivate
public:
inline QSQLiteDriverPrivate() : access(0) {}
sqlite3 *access;
- QList <QSQLiteResult *> results;
};
@@ -287,12 +286,10 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
{
d = new QSQLiteResultPrivate(this);
d->access = db->d->access;
- db->d->results.append(this);
}
QSQLiteResult::~QSQLiteResult()
{
- qobject_cast<const QSQLiteDriver *>(driver())->d->results.removeOne(this);
d->cleanup();
delete d;
}
@@ -556,10 +553,6 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
void QSQLiteDriver::close()
{
if (isOpen()) {
- foreach (QSQLiteResult *result, d->results) {
- result->d->finalize();
- }
-
if (sqlite3_close(d->access) != SQLITE_OK)
setLastError(qMakeError(d->access, tr("Error closing database"),
QSqlError::ConnectionError));
@@ -215,8 +215,6 @@ private slots:
void QTBUG_14132();
void QTBUG_21884_data() { generic_data("QSQLITE"); }
void QTBUG_21884();
- void QTBUG_16967_data() { generic_data("QSQLITE"); }
- void QTBUG_16967(); //clean close
void sqlite_constraint_data() { generic_data("QSQLITE"); }
void sqlite_constraint();
@@ -3152,53 +3150,6 @@ void tst_QSqlQuery::QTBUG_21884()
}
}
-/**
- * This test case test sqlite driver close function. Sqlite driver should close cleanly
- * even if there is still outstanding prepared statement.
- */
-void tst_QSqlQuery::QTBUG_16967()
-{
- QFETCH(QString, dbName);
- {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- db.close();
- QCOMPARE(db.lastError().type(), QSqlError::NoError);
- }
- {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- QSqlQuery q(db);
- q.prepare("CREATE TABLE t1 (id INTEGER PRIMARY KEY, str TEXT);");
- db.close();
- QCOMPARE(db.lastError().type(), QSqlError::NoError);
- }
- {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- QSqlQuery q(db);
- q.prepare("CREATE TABLE t1 (id INTEGER PRIMARY KEY, str TEXT);");
- q.exec();
- db.close();
- QCOMPARE(db.lastError().type(), QSqlError::NoError);
- }
- {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- QSqlQuery q(db);
- q.exec("INSERT INTO t1 (id, str) VALUES(1, \"test1\");");
- db.close();
- QCOMPARE(db.lastError().type(), QSqlError::NoError);
- }
- {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- QSqlQuery q(db);
- q.exec("SELECT * FROM t1;");
- db.close();
- QCOMPARE(db.lastError().type(), QSqlError::NoError);
- }
-}
void tst_QSqlQuery::oraOCINumber()
{

0 comments on commit ec31c6e

Please sign in to comment.