diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp index ad27a977..38d2a3b6 100644 --- a/src/sqlitedb.cpp +++ b/src/sqlitedb.cpp @@ -1,5 +1,5 @@ #include "sqlitedb.h" - +#include "sqlitetablemodel.h" #include "MainWindow.h" #include @@ -234,8 +234,11 @@ bool DBBrowserDB::dump(const QString& filename) unsigned int numRecordsTotal = 0, numRecordsCurrent = 0; QList tables = objMap.values("table"); for(QList::ConstIterator it=tables.begin();it!=tables.end();++it) - numRecordsTotal += getFindResults( - QString("SELECT COUNT(*) FROM `%1`;").arg((*it).getname())).value(0).toInt(); + { + SqliteTableModel tableModel(0, this); + tableModel.setTable((*it).getname()); + numRecordsTotal += tableModel.totalRowCount(); + } QProgressDialog progress(QObject::tr("Exporting database to SQL file..."), QObject::tr("Cancel"), 0, numRecordsTotal); progress.setWindowModality(Qt::ApplicationModal); @@ -256,16 +259,18 @@ bool DBBrowserDB::dump(const QString& filename) stream << (*it).getsql() << ";\n"; // Get data of this table - browseTable((*it).getname()); + SqliteTableModel tableModel(0, this); + tableModel.setTable((*it).getname()); + while(tableModel.canFetchMore()) + tableModel.fetchMore(); // Dump all the content of the table - rowList data = browseRecs; - for(int row=0;row