mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-18 03:29:25 -05:00
exportsql: allow export schema only
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user