Skip to content

Commit 1430900

Browse files
resolves issue 67
1 parent 6929761 commit 1430900

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

dist/quick-sql.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8221,7 +8221,8 @@ let ue = function() {
82218221
let h = `where
82228222
`;
82238223
return 0 < o.indexOf(h) && o.indexOf(h) == o.length - h.length && (o = o.substring(0, o.length - h.length).trim()), h = `and
8224-
`, 0 < o.indexOf(h) && o.indexOf(h) == o.length - h.length && (o = o.substring(0, o.length - h.length).trim()), o += `/
8224+
`, 0 < o.indexOf(h) && o.indexOf(h) == o.length - h.length && (o = o.substring(0, o.length - h.length).trim()), o.endsWith("/n") || (o += `
8225+
`), o += `/
82258226
`, o.toLowerCase();
82268227
}, this.restEnable = function() {
82278228
if (this.parseType() != "table" || !this.isOption("rest"))

dist/quick-sql.umd.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
`;for(let f=2;f<t.length;f++)for(let B=2;B<t.length;B++)if(B!=f){var x=t[f].value,P=t[B].value,e=u.find(x);if(e!=null){var a=u.find(P);if(a!=null)for(var n in e.fks){var c=e.fks[n];c==P&&(o+=m+x+"."+H(c)+"_id(+) = "+P+`.id and
8383
`)}}}o=o.toLowerCase();let h=`where
8484
`;return 0<o.indexOf(h)&&o.indexOf(h)==o.length-h.length&&(o=o.substring(0,o.length-h.length).trim()),h=`and
85-
`,0<o.indexOf(h)&&o.indexOf(h)==o.length-h.length&&(o=o.substring(0,o.length-h.length).trim()),o+=`/
85+
`,0<o.indexOf(h)&&o.indexOf(h)==o.length-h.length&&(o=o.substring(0,o.length-h.length).trim()),o.endsWith("/n")||(o+=`
86+
`),o+=`/
8687
`,o.toLowerCase()},this.restEnable=function(){if(this.parseType()!="table"||!this.isOption("rest"))return"";let r=this.parseName();const t=r.indexOf('"')==0;let o=u.objPrefix()+r;return t?o=u.objPrefix()+r.substring(1,r.length-1):o=(u.objPrefix()+r).toUpperCase(),`begin
8788
`+m+"ords.enable_object(p_enabled=>TRUE, p_object=>'"+o+`');
8889
end;

src/tree.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,9 @@ let tree = (function(){
11681168
ret = ret.substring(0, ret.length-postfix.length).trim();
11691169
postfix = 'and\n';
11701170
if( 0 < ret.indexOf(postfix) && ret.indexOf(postfix) == ret.length-postfix.length )
1171-
ret = ret.substring(0, ret.length-postfix.length).trim();
1171+
ret = ret.substring(0, ret.length-postfix.length).trim();
1172+
if( !ret.endsWith('/n') )
1173+
ret += '\n';
11721174
ret += '/\n';
11731175
return ret.toLowerCase();
11741176
};

test/small_tests.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,21 +732,32 @@ addreess
732732
pdf blob
733733
`).getDDL();
734734
output = output.substring(0, output.indexOf("-- Generated by Quick SQL"));
735-
//console.log(output);
736735
assert( "output.indexOf(\"N/A\") < 0" );
737736
assert( "output.indexOf(\"efum ji ga sefze figi pomlot dadeziguz seak nigamu luv\") < 0" );
738737
assert( "0 < output.indexOf(\"Om pikawo pe amopi w\")" );
739738

740-
}
739+
// https://github.com/oracle/quicksql/issues/67
740+
output = new quicksql(`departments
741+
name
742+
employees
743+
name
741744
745+
view emp_v departments employees
746+
`).getDDL();
747+
output = output.substring(0, output.indexOf("-- Generated by Quick SQL"));
748+
//console.log(output);
749+
assert( "output.indexOf(\"departments.id/\") < 0" );
750+
751+
752+
}
742753

743754

744755
small_tests();
745756

746757
console.log(assertionCnt);
747758

748759
// metatest that watches tests
749-
const minimalTestCnt = 135;
760+
const minimalTestCnt = 150;
750761
if( assertionCnt < minimalTestCnt ) {
751762
console.error("assertionCnt < "+minimalTestCnt);
752763
throw new Error('Test failed');

0 commit comments

Comments
 (0)