Skip to content

Commit

Permalink
Adds type=table to queries on sqlite_master. Avoids returning indices…
Browse files Browse the repository at this point in the history
…, which could cause duplicate "create table" statements on dump.
  • Loading branch information
ottosch committed May 3, 2017
1 parent c97ad01 commit 59bb802
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions websqldump.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ wd.exportTable = function(config) {
if (!config.dataonly) {
wd.execute({
db: config.db,
sql: "SELECT sql FROM sqlite_master WHERE tbl_name=?;",
sql: "SELECT sql FROM sqlite_master WHERE type='table' AND tbl_name=?;",
params: [table],
success: function(results) {
if (!results.rows || !results.rows.length) {
Expand Down Expand Up @@ -100,7 +100,7 @@ wd.export = function(config) {
// Export all tables in db
wd.execute({
db: config.db,
sql: "SELECT tbl_name FROM sqlite_master;",
sql: "SELECT tbl_name FROM sqlite_master WHERE type='table';",
success: function(results) {
if (results.rows) {
// First count the outstanding tables
Expand Down

0 comments on commit 59bb802

Please sign in to comment.