Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mbean authored and bean5 committed Jul 22, 2019
1 parent 6c16eaa commit f3a3992
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions websqldump.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
params: [name],
success: function(results) {
if (!results.rows || !results.rows.length) {
if (typeof config.error === "function")
config.error("No such table: " + table);
if (typeof config.error === "function") {
config.error(`No such ${type}: ${name}`);
}
return;
}
config.exportSql.push(results.rows.item(0)["sql"]);
config.exportSql.push(results.rows.item(0)["sql"] + ";");
if (config.schemaonly || type === "view") {
if (typeof config.success === "function") {
config.success(config.exportSql);
Expand Down Expand Up @@ -72,17 +73,18 @@
}
config.exportSql.push(
"INSERT INTO " +
table +
name +
"(" +
_fields.join(",") +
") VALUES (" +
_values.join(",") +
")"
");"
);
}
}
if (typeof config.success === "function")
config.success(config.exportSql.toString());
if (typeof config.success === "function") {
config.success(config.exportSql);
}
},
error: function(err) {
if (typeof config.error === "function") config.error(err);
Expand Down

0 comments on commit f3a3992

Please sign in to comment.