Remove DBBrowserDB::tableColumns() method

Remove the DBBrowserDB::tableColumns() method which queries the database
for the column names of a given table and which is used for the SQL
export only. This function isn't needed at all because it generates a
whole bunch of queries for data which is already hold in memory...
This commit is contained in:
Martin Kleusberg
2015-04-23 22:39:05 +02:00
parent dd8dd4852d
commit 9b2529bdf4
2 changed files with 1 additions and 16 deletions
+1 -14
View File
@@ -428,7 +428,7 @@ bool DBBrowserDB::dump(const QString& filename,
continue;
// get columns
QStringList cols(tableColumns(it->getTableName()));
QStringList cols(it->table.fieldNames());
QString sQuery = QString("SELECT * FROM `%1`;").arg(it->getTableName());
QByteArray utf8Query = sQuery.toUtf8();
@@ -1237,16 +1237,3 @@ bool DBBrowserDB::loadExtension(const QString& filename)
return false;
}
}
QStringList DBBrowserDB::tableColumns(const QString & tableName) {
QStringList cols;
sqlite3_stmt* stmt = NULL;
QString q(QString("PRAGMA table_info('%1');").arg(tableName));
int rc = sqlite3_prepare_v2(this->_db, q.toUtf8(), q.toUtf8().length(), &stmt, NULL);
if (rc == SQLITE_OK) {
while (sqlite3_step(stmt) == SQLITE_ROW)
cols.push_back(QString((const char*)sqlite3_column_text(stmt, 1)));
sqlite3_finalize(stmt);
}
return cols;
}
-2
View File
@@ -58,8 +58,6 @@ public:
bool executeSQL ( const QString & statement, bool dirtyDB=true, bool logsql=true);
bool executeMultiSQL(const QString& statement, bool dirty = true, bool log = false);
QStringList tableColumns(const QString& tableName);
/**
* @brief getRow Executes a sqlite statement to get the rowdata(columns)
* for the given rowid.