Comparing version 0.0.2 to 0.0.3
@@ -19,3 +19,3 @@ /** | ||
throw new TypeError('Invalid argument (joinType) for join'); | ||
if (!(typeof table === 'string' || table.isSelect)) | ||
if (!(typeof table === 'string' || table.isSelect || table.isRaw)) | ||
throw new TypeError('Invalid argument (table) for join'); | ||
@@ -22,0 +22,0 @@ this.type = 'join'; |
@@ -21,10 +21,2 @@ | ||
get text() { | ||
return this._text; | ||
} | ||
set text(str) { | ||
this._text = str || ''; | ||
} | ||
get isRaw() { | ||
@@ -31,0 +23,0 @@ return true; |
@@ -72,3 +72,8 @@ /** | ||
for (let i = 0; i < arguments.length; i++) | ||
this._tables.push(arguments[i] instanceof Table ? arguments[i] : new Table(String(arguments[i]))); | ||
this._tables.push( | ||
arguments[i] instanceof Table || | ||
arguments[i].isSelect || | ||
arguments[i].isRaw | ||
? arguments[i] : | ||
new Table(String(arguments[i]))); | ||
return this; | ||
@@ -75,0 +80,0 @@ } |
@@ -69,3 +69,3 @@ /** | ||
sb.indent = 0; | ||
sb.append((this.prettyPrint && sb.line.length > 40 ? '\n' : (sb.line ? ' ' : '')) + s); | ||
sb.append((this.prettyPrint && (sb.line.length > 40 || sb.lines > 1) ? '\n' : (sb.line ? ' ' : '')) + s); | ||
if (this.prettyPrint) sb.cr(); | ||
@@ -128,11 +128,18 @@ } | ||
if (table.isRaw) | ||
str += (str ? ', ' : '') + this._generateRaw(table); | ||
str += (str ? ', ' : ' ') + this._generateRaw(table); | ||
else if (table.type === 'table') { | ||
str += (str ? ', ' : '') + | ||
str += (str ? ', ' : ' ') + | ||
(table.schema ? table.schema + '.' : '') + | ||
table.table + | ||
(table.alias ? ' ' + table.alias : '') | ||
} else if (table.type === 'select') { | ||
let s = this._generateSelectSql(table); | ||
if (s) | ||
str += ' (' + s + ')' + (table._alias ? ' ' + table._alias : ''); | ||
} else if (table.type === 'raw') { | ||
let s = this._generateRaw(table); | ||
if (s) str += ' ' + s; | ||
} | ||
} | ||
return str ? 'from ' + str : ''; | ||
return str ? 'from' + str : ''; | ||
} | ||
@@ -290,4 +297,10 @@ | ||
} | ||
} else sb.append(' ' + join.table); | ||
} else { | ||
if (join.table.isRaw) | ||
sb.append(' ' + this._generateRaw(join.table)); | ||
else | ||
sb.append(' ' + join.table) | ||
} | ||
s = this._generateConditionGroup(join.conditions); | ||
@@ -294,0 +307,0 @@ if (s) |
{ | ||
"name": "sqb", | ||
"description": "Lightweight, multi-dialect SQL query builder for JavaScript", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27621
804
0