exportsql: allow export schema only

This commit is contained in:
schdub
2015-04-17 15:39:38 +03:00
parent 569dffbc25
commit c340bb4668
4 changed files with 19 additions and 7 deletions
+2 -1
View File
@@ -85,7 +85,8 @@ void ExportSqlDialog::accept()
bool dumpOk = pdb->dump(fileName,
tables,
ui->checkColNames->isChecked(),
ui->checkMultiple->isChecked());
ui->checkMultiple->isChecked(),
ui->checkSchemaOnly->isChecked());
if (dumpOk)
QMessageBox::information(this, QApplication::applicationName(), tr("Export completed."));
else
+8 -1
View File
@@ -72,7 +72,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -85,6 +85,13 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkSchemaOnly">
<property name="text">
<string>Export schema only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+8 -4
View File
@@ -375,7 +375,8 @@ bool DBBrowserDB::close()
bool DBBrowserDB::dump(const QString& filename,
const QStringList & tablesToDump,
bool insertColNames,
bool insertNewSyntx)
bool insertNewSyntx,
bool exportSchemaOnly)
{
// Open file
QFile file(filename);
@@ -420,12 +421,15 @@ bool DBBrowserDB::dump(const QString& filename,
if (tablesToDump.indexOf(it->getTableName()) == -1)
continue;
// get columns
QStringList cols(tableColumns(it->getTableName()));
// Write the SQL string used to create this table to the output file
stream << it->getsql() << ";\n";
if (exportSchemaOnly)
continue;
// get columns
QStringList cols(tableColumns(it->getTableName()));
QString sQuery = QString("SELECT * FROM `%1`;").arg(it->getTableName());
QByteArray utf8Query = sQuery.toUtf8();
sqlite3_stmt *stmt;
+1 -1
View File
@@ -54,7 +54,7 @@ public:
bool revert (const QString& pointname = "RESTOREPOINT");
bool saveAll();
bool revertAll();
bool dump(const QString & filename, const QStringList &tablesToDump, bool insertColNames, bool insertNew);
bool dump(const QString & filename, const QStringList &tablesToDump, bool insertColNames, bool insertNew, bool exportSchemaOnly);
bool executeSQL ( const QString & statement, bool dirtyDB=true, bool logsql=true);
bool executeMultiSQL(const QString& statement, bool dirty = true, bool log = false);