Skip to content

Commit cce8578

Browse files
More performance improvement
1 parent a452dfc commit cce8578

File tree

6 files changed

+58
-50
lines changed

6 files changed

+58
-50
lines changed

dist/quick-sql.js

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function fe(d, h) {
2222
}
2323
return (d.startsWith("_") || d.startsWith("$") || d.startsWith("#")) && (D = !0), D || (k = ""), k + d + k;
2424
}
25-
function he(d) {
25+
function ie(d) {
2626
if (d == null)
2727
return null;
2828
if (d.indexOf('"') == 0)
@@ -36,7 +36,7 @@ function K(d, h, k) {
3636
let I = d + h + k;
3737
return D ? I = '"' + I + '"' : I = I.toLowerCase(), I;
3838
}
39-
var le = function() {
39+
var se = function() {
4040
var d = [
4141
"Sales",
4242
"Finance",
@@ -92,7 +92,7 @@ var le = function() {
9292
function be(d) {
9393
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
9494
}
95-
var ie = { exports: {} };
95+
var re = { exports: {} };
9696
(function(d, h) {
9797
(function() {
9898
var k = 9007199254740992, D = -k, I = "0123456789", x = "abcdefghijklmnopqrstuvwxyz", b = x.toUpperCase(), g = I + "abcdef";
@@ -7207,11 +7207,11 @@ var ie = { exports: {} };
72077207
return a ? n ? this.raw_hmac_md5(a, e) : this.hex_hmac_md5(a, e) : n ? this.raw_md5(e) : this.hex_md5(e);
72087208
}, 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());
72097209
})();
7210-
})(ie, ie.exports);
7211-
var pe = ie.exports;
7210+
})(re, re.exports);
7211+
var pe = re.exports;
72127212
const ge = /* @__PURE__ */ be(pe);
7213-
function se(d, h, k, D) {
7214-
var I = new ge(te);
7213+
function ce(d, h, k, D) {
7214+
var I = new ge(oe);
72157215
k == null && console.log();
72167216
let x = k.toUpperCase(), b = d.toUpperCase(), g = h.toUpperCase();
72177217
if (D != null && 0 < D.length) {
@@ -7256,12 +7256,12 @@ function se(d, h, k, D) {
72567256
}
72577257
return "'N/A'";
72587258
}
7259-
var te = 1;
7259+
var oe = 1;
72607260
function Ce() {
7261-
te = 1;
7261+
oe = 1;
72627262
}
72637263
function X() {
7264-
var d = Math.sin(te++) * 1e4;
7264+
var d = Math.sin(oe++) * 1e4;
72657265
return d - Math.floor(d);
72667266
}
72677267
var $ = function() {
@@ -7573,7 +7573,7 @@ function ve(d) {
75737573
let k = d.toUpperCase();
75747574
return h[k] != null ? "the_" + d : d;
75757575
}
7576-
let ce = function() {
7576+
let ue = function() {
75777577
let d, h = " ", k = ["string", "varchar2", "varchar", "vc", "char"];
75787578
var D = ["yn", "boolean", "bool"];
75797579
function I(M, B, r) {
@@ -7664,7 +7664,7 @@ let ce = function() {
76647664
}
76657665
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);
76667666
var T = i.substr(0, 1);
7667-
return T >= "0" && T <= "9" && (i = "x" + i), this.parsedName = ve(he(i)), this.parsedName;
7667+
return T >= "0" && T <= "9" && (i = "x" + i), this.parsedName = ve(ie(i)), this.parsedName;
76687668
}, this.parseType = function(i) {
76697669
if (this.children != null && 0 < this.children.length)
76707670
return "table";
@@ -7978,9 +7978,10 @@ let ce = function() {
79787978
return t;
79797979
}, this.orderedTableNodes = function() {
79807980
var i = [this];
7981-
for (let s = 1; s < this.descendants().length; s++) {
7982-
var t = this.descendants()[s];
7983-
t.children.length != 0 && (t.isMany2One() ? t.isContainedIn(i) || i.unshift(t) : t.isContainedIn(i) || i.push(t));
7981+
const t = this.descendants();
7982+
for (let l = 1; l < t.length; l++) {
7983+
var s = t[l];
7984+
s.children.length != 0 && (s.isMany2One() ? s.isContainedIn(i) || i.unshift(s) : s.isContainedIn(i) || i.push(s));
79847985
}
79857986
return i;
79867987
}, this.isContainedIn = function(i) {
@@ -8390,7 +8391,7 @@ is
83908391
}
83918392
}
83928393
}
8393-
l += h + le(d.getOptionValue("Data Language"), se(s, W(L) + "_id", H, R)) + `,
8394+
l += h + se(d.getOptionValue("Data Language"), ce(s, W(L) + "_id", H, R)) + `,
83948395
`;
83958396
}
83968397
for (let N = 0; N < this.children.length; N++) {
@@ -8404,8 +8405,8 @@ is
84048405
let G = E[R];
84058406
G != null && (O = [], O[0] = G);
84068407
}
8407-
let H = se(s, R, L.parseType(), O);
8408-
l += h + le(d.getOptionValue("Data Language"), H) + `,
8408+
let H = ce(s, R, L.parseType(), O);
8409+
l += h + se(d.getOptionValue("Data Language"), H) + `,
84098410
`;
84108411
}
84118412
}
@@ -8687,7 +8688,7 @@ var Ae = function() {
86878688
return l += JSON.stringify(u, null, 3), l += `
86888689
`, l += `
86898690
8690-
-- Generated by json2qsql.js ${oe()} ` + (/* @__PURE__ */ new Date()).toLocaleString() + `
8691+
-- Generated by json2qsql.js ${le()} ` + (/* @__PURE__ */ new Date()).toLocaleString() + `
86918692
86928693
`, l += `#document =
86938694
`, l += JSON.stringify(i, null, 3), l += `
@@ -8885,7 +8886,7 @@ const ye = function() {
88858886
}
88868887
function x(b) {
88878888
for (var g = [], M = Se(b), B = 1; B < b.length; B++) {
8888-
var r = b[B - 1], o = b[B], i = re(r), t = re(o);
8889+
var r = b[B - 1], o = b[B], i = te(r), t = te(o);
88898890
t != 0 && i < t && t < i + M && g.push(
88908891
new d(
88918892
j.misalignedAttribute + M,
@@ -8901,7 +8902,7 @@ function Se(d) {
89018902
let h = [];
89028903
for (var k = 0; k < d.length; k++) {
89038904
var D = d[k];
8904-
h[k] = re(D);
8905+
h[k] = te(D);
89058906
}
89068907
let I = [];
89078908
for (let b = 0; b < h.length; b++) {
@@ -8916,7 +8917,7 @@ function Se(d) {
89168917
(x == null || I[x] <= I[b]) && (x = b);
89178918
return x;
89188919
}
8919-
function re(d) {
8920+
function te(d) {
89208921
for (var h = d.split(/ |\t/), k = 0, D = 0; D < h.length; D++) {
89218922
var I = h[D];
89228923
if (I == " " && (k += 4), I == "") {
@@ -8939,7 +8940,7 @@ const j = {
89398940
invalidDatatype: "Invalid Datatype",
89408941
undefinedObject: "Undefined Object: ",
89418942
misalignedAttribute: "Misaligned Table or Column; apparent indent = "
8942-
}, Te = { findErrors: ye, messages: j }, ne = "identityDataType", ue = "guid", me = "Timestamp with time zone", de = "Timestamp with local time zone", Y = function() {
8943+
}, Te = { findErrors: ye, messages: j }, ne = "identityDataType", me = "guid", de = "Timestamp with time zone", he = "Timestamp with local time zone", Y = function() {
89438944
const d = {
89448945
apex: { label: "APEX", value: "no", check: ["yes", "no"] },
89458946
auditcols: { label: "Audit Columns", value: "no", check: ["yes", "no"] },
@@ -8951,7 +8952,7 @@ const j = {
89518952
semantics: { label: "Character Strings", value: "CHAR", check: ["BYTE", "CHAR", "Default"] },
89528953
language: { label: "Data Language", value: "EN", check: ["EN", "JP", "KO"] },
89538954
datalimit: { label: "Data Limit Rows", value: 1e4 },
8954-
date: { label: "Date Data Type", value: "DATE", check: ["DATE", "TIMESTAMP", me, de] },
8955+
date: { label: "Date Data Type", value: "DATE", check: ["DATE", "TIMESTAMP", de, he] },
89558956
db: { label: "DB", value: "no", check: ["not used"] },
89568957
dv: { label: "Duality View", value: "no", check: ["yes", "no"] },
89578958
// switched default to 'no' until thorough development&testig
@@ -8964,7 +8965,7 @@ const j = {
89648965
overridesettings: { label: "Ignore toDDL() second parameter", value: "no", check: ["yes", "no"] },
89658966
prefix: { label: "Object Prefix", value: "" },
89668967
//ondelete: {label: 'On Delete', value:'Cascade',check:['restrict','cascade','set null']},
8967-
pk: { label: "Primary Key Maintenance", value: ne, check: [ne, ue, "SEQ", "NONE"] },
8968+
pk: { label: "Primary Key Maintenance", value: ne, check: [ne, me, "SEQ", "NONE"] },
89688969
prefixpkwithtname: { label: "Prefix primary keys with table name", value: "no", check: ["yes", "no"] },
89698970
rowkey: { label: "Alphanumeric Row Identifier", value: "no", check: ["yes", "no"] },
89708971
rowversion: { label: "Row Version Number", value: "no", check: ["yes", "no"] },
@@ -8978,7 +8979,7 @@ const j = {
89788979
if (D == null)
89798980
return null;
89808981
let I = D;
8981-
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;
8982+
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;
89828983
}
89838984
function k(D, I) {
89848985
this.ddl = null, this.erd = null, this.errors = null, this.options = JSON.parse(JSON.stringify(d)), this.input = D, this.getOptionValue = function(b) {
@@ -9020,14 +9021,16 @@ const j = {
90209021
}, this.semantics = function() {
90219022
var b = "";
90229023
return this.optionEQvalue("semantics", "CHAR") ? b = " char" : this.optionEQvalue("semantics", "BYTE") && (b = " byte"), b;
9023-
}, this.find = function(b) {
9024+
}, this.name2node = null, this.find = function(b) {
9025+
if (this.name2node != null)
9026+
return this.name2node[ie(b)];
9027+
this.name2node = {};
90249028
for (var g = 0; g < this.forest.length; g++)
90259029
for (var M = this.forest[g].descendants(), B = 0; B < M.length; B++) {
90269030
var r = M[B];
9027-
if (r.parseName() == he(b))
9028-
return r;
9031+
this.name2node[r.parseName()] = r;
90299032
}
9030-
return null;
9033+
return this.name2node[ie(b)];
90319034
}, this.setOptions = function(b) {
90329035
b = b.trim(), b.startsWith("#") && (b = b.substring(1).trim());
90339036
const g = b.indexOf("=");
@@ -9061,9 +9064,9 @@ const j = {
90619064
return this.getOptionValue("prefix") != null && (M = this.getOptionValue("prefix")), g = g + M, M != "" && (g = g + "_"), g.toLowerCase();
90629065
};
90639066
let x = "";
9064-
0 < D.toLowerCase().indexOf("overridesettings") && ce(this), I != null && this.optionEQvalue("overrideSettings", !1) && (x = "# settings = " + I + `
9067+
0 < D.toLowerCase().indexOf("overridesettings") && ue(this), I != null && this.optionEQvalue("overrideSettings", !1) && (x = "# settings = " + I + `
90659068
9066-
`), this.input = x + D, this.forest = ce(this), this.getERD = function() {
9069+
`), this.input = x + D, this.forest = ue(this), this.getERD = function() {
90679070
if (this.erd != null)
90689071
return this.erd;
90699072
let b = this.descendants(), g = { items: [] };
@@ -9199,7 +9202,7 @@ const j = {
91999202
*/`, this.ddl = b, b;
92009203
}, this.getErrors = function() {
92019204
return this.errors != null ? this.errors : (this.errors = Te.findErrors(this, this.fullInput), this.errors);
9202-
}, this.version = oe;
9205+
}, this.version = le;
92039206
}
92049207
return k;
92059208
}();
@@ -9215,18 +9218,18 @@ function Pe(d, h) {
92159218
function Ee(d, h) {
92169219
return new Y(d, h).getErrors();
92179220
}
9218-
function oe() {
9221+
function le() {
92199222
return "1.2.1";
92209223
}
9221-
Y.version = oe;
9224+
Y.version = le;
92229225
Y.toDDL = Pe;
92239226
Y.toERD = Be;
92249227
Y.toErrors = Ee;
92259228
Y.fromJSON = Ie;
92269229
export {
92279230
Y as default,
92289231
Ie as fromJSON,
9229-
oe as qsql_version,
9232+
le as qsql_version,
92309233
Y as quicksql,
92319234
Pe as toDDL,
92329235
Be as toERD,

0 commit comments

Comments
 (0)