Skip to content

Commit

Permalink
More performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
vadim-tropashko committed Feb 9, 2024
1 parent a452dfc commit cce8578
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 50 deletions.
75 changes: 39 additions & 36 deletions dist/quick-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function fe(d, h) {
}
return (d.startsWith("_") || d.startsWith("$") || d.startsWith("#")) && (D = !0), D || (k = ""), k + d + k;
}
function he(d) {
function ie(d) {
if (d == null)
return null;
if (d.indexOf('"') == 0)
Expand All @@ -36,7 +36,7 @@ function K(d, h, k) {
let I = d + h + k;
return D ? I = '"' + I + '"' : I = I.toLowerCase(), I;
}
var le = function() {
var se = function() {
var d = [
"Sales",
"Finance",
Expand Down Expand Up @@ -92,7 +92,7 @@ var le = function() {
function be(d) {
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
}
var ie = { exports: {} };
var re = { exports: {} };
(function(d, h) {
(function() {
var k = 9007199254740992, D = -k, I = "0123456789", x = "abcdefghijklmnopqrstuvwxyz", b = x.toUpperCase(), g = I + "abcdef";
Expand Down Expand Up @@ -7207,11 +7207,11 @@ var ie = { exports: {} };
return a ? n ? this.raw_hmac_md5(a, e) : this.hex_hmac_md5(a, e) : n ? this.raw_md5(e) : this.hex_md5(e);
}, d.exports && (h = d.exports = r), h.Chance = r, typeof importScripts < "u" && (chance = new r(), self.Chance = r), typeof window == "object" && typeof window.document == "object" && (window.Chance = r, window.chance = new r());
})();
})(ie, ie.exports);
var pe = ie.exports;
})(re, re.exports);
var pe = re.exports;
const ge = /* @__PURE__ */ be(pe);
function se(d, h, k, D) {
var I = new ge(te);
function ce(d, h, k, D) {
var I = new ge(oe);
k == null && console.log();
let x = k.toUpperCase(), b = d.toUpperCase(), g = h.toUpperCase();
if (D != null && 0 < D.length) {
Expand Down Expand Up @@ -7256,12 +7256,12 @@ function se(d, h, k, D) {
}
return "'N/A'";
}
var te = 1;
var oe = 1;
function Ce() {
te = 1;
oe = 1;
}
function X() {
var d = Math.sin(te++) * 1e4;
var d = Math.sin(oe++) * 1e4;
return d - Math.floor(d);
}
var $ = function() {
Expand Down Expand Up @@ -7573,7 +7573,7 @@ function ve(d) {
let k = d.toUpperCase();
return h[k] != null ? "the_" + d : d;
}
let ce = function() {
let ue = function() {
let d, h = " ", k = ["string", "varchar2", "varchar", "vc", "char"];
var D = ["yn", "boolean", "bool"];
function I(M, B, r) {
Expand Down Expand Up @@ -7664,7 +7664,7 @@ let ce = function() {
}
i = i.replace(/ num(ber)?\(\d+\)/g, ""), i = i.replace(/ num(ber)?\(\d+,\d+\)/g, ""), i = i.replace(/ num(ber)?\d+/g, ""), i = i.trim(), this.children.length == 0 && this.parent != null && this.parent.colprefix != null && (i = this.parent.colprefix + "_" + i);
var T = i.substr(0, 1);
return T >= "0" && T <= "9" && (i = "x" + i), this.parsedName = ve(he(i)), this.parsedName;
return T >= "0" && T <= "9" && (i = "x" + i), this.parsedName = ve(ie(i)), this.parsedName;
}, this.parseType = function(i) {
if (this.children != null && 0 < this.children.length)
return "table";
Expand Down Expand Up @@ -7978,9 +7978,10 @@ let ce = function() {
return t;
}, this.orderedTableNodes = function() {
var i = [this];
for (let s = 1; s < this.descendants().length; s++) {
var t = this.descendants()[s];
t.children.length != 0 && (t.isMany2One() ? t.isContainedIn(i) || i.unshift(t) : t.isContainedIn(i) || i.push(t));
const t = this.descendants();
for (let l = 1; l < t.length; l++) {
var s = t[l];
s.children.length != 0 && (s.isMany2One() ? s.isContainedIn(i) || i.unshift(s) : s.isContainedIn(i) || i.push(s));
}
return i;
}, this.isContainedIn = function(i) {
Expand Down Expand Up @@ -8390,7 +8391,7 @@ is
}
}
}
l += h + le(d.getOptionValue("Data Language"), se(s, W(L) + "_id", H, R)) + `,
l += h + se(d.getOptionValue("Data Language"), ce(s, W(L) + "_id", H, R)) + `,
`;
}
for (let N = 0; N < this.children.length; N++) {
Expand All @@ -8404,8 +8405,8 @@ is
let G = E[R];
G != null && (O = [], O[0] = G);
}
let H = se(s, R, L.parseType(), O);
l += h + le(d.getOptionValue("Data Language"), H) + `,
let H = ce(s, R, L.parseType(), O);
l += h + se(d.getOptionValue("Data Language"), H) + `,
`;
}
}
Expand Down Expand Up @@ -8687,7 +8688,7 @@ var Ae = function() {
return l += JSON.stringify(u, null, 3), l += `
`, l += `
-- Generated by json2qsql.js ${oe()} ` + (/* @__PURE__ */ new Date()).toLocaleString() + `
-- Generated by json2qsql.js ${le()} ` + (/* @__PURE__ */ new Date()).toLocaleString() + `
`, l += `#document =
`, l += JSON.stringify(i, null, 3), l += `
Expand Down Expand Up @@ -8885,7 +8886,7 @@ const ye = function() {
}
function x(b) {
for (var g = [], M = Se(b), B = 1; B < b.length; B++) {
var r = b[B - 1], o = b[B], i = re(r), t = re(o);
var r = b[B - 1], o = b[B], i = te(r), t = te(o);
t != 0 && i < t && t < i + M && g.push(
new d(
j.misalignedAttribute + M,
Expand All @@ -8901,7 +8902,7 @@ function Se(d) {
let h = [];
for (var k = 0; k < d.length; k++) {
var D = d[k];
h[k] = re(D);
h[k] = te(D);
}
let I = [];
for (let b = 0; b < h.length; b++) {
Expand All @@ -8916,7 +8917,7 @@ function Se(d) {
(x == null || I[x] <= I[b]) && (x = b);
return x;
}
function re(d) {
function te(d) {
for (var h = d.split(/ |\t/), k = 0, D = 0; D < h.length; D++) {
var I = h[D];
if (I == " " && (k += 4), I == "") {
Expand All @@ -8939,7 +8940,7 @@ const j = {
invalidDatatype: "Invalid Datatype",
undefinedObject: "Undefined Object: ",
misalignedAttribute: "Misaligned Table or Column; apparent indent = "
}, Te = { findErrors: ye, messages: j }, ne = "identityDataType", ue = "guid", me = "Timestamp with time zone", de = "Timestamp with local time zone", Y = function() {
}, Te = { findErrors: ye, messages: j }, ne = "identityDataType", me = "guid", de = "Timestamp with time zone", he = "Timestamp with local time zone", Y = function() {
const d = {
apex: { label: "APEX", value: "no", check: ["yes", "no"] },
auditcols: { label: "Audit Columns", value: "no", check: ["yes", "no"] },
Expand All @@ -8951,7 +8952,7 @@ const j = {
semantics: { label: "Character Strings", value: "CHAR", check: ["BYTE", "CHAR", "Default"] },
language: { label: "Data Language", value: "EN", check: ["EN", "JP", "KO"] },
datalimit: { label: "Data Limit Rows", value: 1e4 },
date: { label: "Date Data Type", value: "DATE", check: ["DATE", "TIMESTAMP", me, de] },
date: { label: "Date Data Type", value: "DATE", check: ["DATE", "TIMESTAMP", de, he] },
db: { label: "DB", value: "no", check: ["not used"] },
dv: { label: "Duality View", value: "no", check: ["yes", "no"] },
// switched default to 'no' until thorough development&testig
Expand All @@ -8964,7 +8965,7 @@ const j = {
overridesettings: { label: "Ignore toDDL() second parameter", value: "no", check: ["yes", "no"] },
prefix: { label: "Object Prefix", value: "" },
//ondelete: {label: 'On Delete', value:'Cascade',check:['restrict','cascade','set null']},
pk: { label: "Primary Key Maintenance", value: ne, check: [ne, ue, "SEQ", "NONE"] },
pk: { label: "Primary Key Maintenance", value: ne, check: [ne, me, "SEQ", "NONE"] },
prefixpkwithtname: { label: "Prefix primary keys with table name", value: "no", check: ["yes", "no"] },
rowkey: { label: "Alphanumeric Row Identifier", value: "no", check: ["yes", "no"] },
rowversion: { label: "Row Version Number", value: "no", check: ["yes", "no"] },
Expand All @@ -8978,7 +8979,7 @@ const j = {
if (D == null)
return null;
let I = D;
return typeof I == "string" && (I = I.toLowerCase()), I == "yes" ? !0 : I == "no" ? !1 : I == "y" ? !0 : I == "n" ? !1 : I == "true" ? !0 : I == "false" ? !1 : I == ne.toLowerCase() ? "identity" : I == ue.toLowerCase() ? "guid" : I == me.toLowerCase() ? "tswtz" : I == de.toLowerCase() ? "tswltz" : I;
return typeof I == "string" && (I = I.toLowerCase()), I == "yes" ? !0 : I == "no" ? !1 : I == "y" ? !0 : I == "n" ? !1 : I == "true" ? !0 : I == "false" ? !1 : I == ne.toLowerCase() ? "identity" : I == me.toLowerCase() ? "guid" : I == de.toLowerCase() ? "tswtz" : I == he.toLowerCase() ? "tswltz" : I;
}
function k(D, I) {
this.ddl = null, this.erd = null, this.errors = null, this.options = JSON.parse(JSON.stringify(d)), this.input = D, this.getOptionValue = function(b) {
Expand Down Expand Up @@ -9020,14 +9021,16 @@ const j = {
}, this.semantics = function() {
var b = "";
return this.optionEQvalue("semantics", "CHAR") ? b = " char" : this.optionEQvalue("semantics", "BYTE") && (b = " byte"), b;
}, this.find = function(b) {
}, this.name2node = null, this.find = function(b) {
if (this.name2node != null)
return this.name2node[ie(b)];
this.name2node = {};
for (var g = 0; g < this.forest.length; g++)
for (var M = this.forest[g].descendants(), B = 0; B < M.length; B++) {
var r = M[B];
if (r.parseName() == he(b))
return r;
this.name2node[r.parseName()] = r;
}
return null;
return this.name2node[ie(b)];
}, this.setOptions = function(b) {
b = b.trim(), b.startsWith("#") && (b = b.substring(1).trim());
const g = b.indexOf("=");
Expand Down Expand Up @@ -9061,9 +9064,9 @@ const j = {
return this.getOptionValue("prefix") != null && (M = this.getOptionValue("prefix")), g = g + M, M != "" && (g = g + "_"), g.toLowerCase();
};
let x = "";
0 < D.toLowerCase().indexOf("overridesettings") && ce(this), I != null && this.optionEQvalue("overrideSettings", !1) && (x = "# settings = " + I + `
0 < D.toLowerCase().indexOf("overridesettings") && ue(this), I != null && this.optionEQvalue("overrideSettings", !1) && (x = "# settings = " + I + `
`), this.input = x + D, this.forest = ce(this), this.getERD = function() {
`), this.input = x + D, this.forest = ue(this), this.getERD = function() {
if (this.erd != null)
return this.erd;
let b = this.descendants(), g = { items: [] };
Expand Down Expand Up @@ -9199,7 +9202,7 @@ const j = {
*/`, this.ddl = b, b;
}, this.getErrors = function() {
return this.errors != null ? this.errors : (this.errors = Te.findErrors(this, this.fullInput), this.errors);
}, this.version = oe;
}, this.version = le;
}
return k;
}();
Expand All @@ -9215,18 +9218,18 @@ function Pe(d, h) {
function Ee(d, h) {
return new Y(d, h).getErrors();
}
function oe() {
function le() {
return "1.2.1";
}
Y.version = oe;
Y.version = le;
Y.toDDL = Pe;
Y.toERD = Be;
Y.toErrors = Ee;
Y.fromJSON = Ie;
export {
Y as default,
Ie as fromJSON,
oe as qsql_version,
le as qsql_version,
Y as quicksql,
Pe as toDDL,
Be as toERD,
Expand Down
Loading

0 comments on commit cce8578

Please sign in to comment.