Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sqb

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqb - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

lib/core/join.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc