New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

squel

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

squel - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

.idea/.name

10

CHANGELOG.md
# Changelog for [squel](https://github.com/hiddentao/squel)
## 20 Dec 2011
## 27 Jan 2012 (1.0.3)
Initial version (1.0.0).
* Added 'usingValuePlaceholders' option for INSERT and UPDATE query builders.
## 20 Dec 2011 (1.0.0)
* Initial version.

2

package.json
{
"name": "squel",
"description": "SQL query string builder",
"version": "1.0.2",
"version": "1.0.3",
"author": "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",

@@ -6,0 +6,0 @@ "contributors": [ "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)" ],

@@ -7,2 +7,3 @@ # squel - SQL query string builder for Javascript

* Works in node.js and in the browser.
* Supports the construction of all standard SQL queries: SELECT, UPDATE, INSERT and DELETE.

@@ -16,2 +17,4 @@ * Uses method chaining for ease of use.

### node.js
Install using [npm](http://npmjs.org/):

@@ -21,2 +24,8 @@

### Browser
Add the following inside your HTML:
<script type="text/javascript" src="https://github.com/hiddentao/squel/raw/master/squel.min.js"></script>
## Examples

@@ -143,3 +152,3 @@

For now please refer to the annoted source code in the `docs/` folder. This is built using
Annotated source code can be found in the `docs/` folder. This is built using
[docco](http://jashkenas.github.com/docco/). To build it yourself you will first need to have the latest dev version

@@ -146,0 +155,0 @@ of [pygment](http://pygments.org/download/) installed in your local Python environment. Then do the following inside

@@ -28,3 +28,4 @@

(function() {
var Delete, Expression, ExpressionClassName, Insert, Select, Update, WhereOrderLimit, formatValue, getObjectClassName, sanitizeAlias, sanitizeCondition, sanitizeField, sanitizeLimitOffset, sanitizeName, sanitizeTable, sanitizeValue, _export, _extend,
var DefaultInsertBuilderOptions, DefaultUpdateBuilderOptions, Delete, Expression, ExpressionClassName, Insert, Select, Update, WhereOrderLimit, formatValue, getObjectClassName, sanitizeAlias, sanitizeCondition, sanitizeField, sanitizeLimitOffset, sanitizeName, sanitizeTable, sanitizeValue, _export, _extend,
__slice = Array.prototype.slice,
__hasProp = Object.prototype.hasOwnProperty,

@@ -34,9 +35,16 @@ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

_extend = function(dst, src) {
var k, v;
if (src == null) src = {};
for (k in src) {
if (!__hasProp.call(src, k)) continue;
v = src[k];
dst[k] = v;
_extend = function() {
var dst, k, sources, src, v, _i, _len;
dst = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (sources) {
for (_i = 0, _len = sources.length; _i < _len; _i++) {
src = sources[_i];
if (src) {
for (k in src) {
if (!__hasProp.call(src, k)) continue;
v = src[k];
dst[k] = v;
}
}
}
}

@@ -146,2 +154,6 @@ return dst;

DefaultInsertBuilderOptions = DefaultUpdateBuilderOptions = {
usingValuePlaceholders: false
};
getObjectClassName = function(obj) {

@@ -201,3 +213,3 @@ var arr;

formatValue = function(value, formattingOptions) {
formatValue = function(value, options) {
if (null === value) {

@@ -208,3 +220,3 @@ value = "NULL";

} else if ("number" !== typeof value) {
if (formattingOptions.autoQuotes) value = "\"" + value + "\"";
if (false === options.usingValuePlaceholders) value = "\"" + value + "\"";
}

@@ -461,3 +473,3 @@ return value;

Update.prototype.formattingOptions = null;
Update.prototype.options = null;

@@ -470,5 +482,3 @@ function Update(options) {

this.fields = {};
this.formattingOptions = _extend({
autoQuotes: true
}, options);
this.options = _extend({}, DefaultUpdateBuilderOptions, options);
}

@@ -522,3 +532,3 @@

if ("" !== fields) fields += ", ";
fields += "" + field + " = " + (formatValue(this.fields[field], this.formattingOptions));
fields += "" + field + " = " + (formatValue(this.fields[field], this.options));
}

@@ -574,3 +584,3 @@ ret += " SET " + fields;

Insert.prototype.formattingOptions = null;
Insert.prototype.options = null;

@@ -581,5 +591,3 @@ function Insert(options) {

this.into = __bind(this.into, this); this.fields = {};
this.formattingOptions = _extend({
autoQuotes: true
}, options);
this.options = _extend({}, DefaultInsertBuilderOptions, options);
}

@@ -621,3 +629,3 @@

if ("" !== values) values += ", ";
values += formatValue(this.fields[field], this.formattingOptions);
values += formatValue(this.fields[field], this.options);
}

@@ -624,0 +632,0 @@ return "INSERT INTO " + this.table + " (" + fields + ") VALUES (" + values + ")";

@@ -24,2 +24,2 @@ /*

OTHER DEALINGS IN THE SOFTWARE.
*/((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=Object.prototype.hasOwnProperty,t=function(a,b){return function(){return a.apply(b,arguments)}},u=function(a,b){function d(){this.constructor=a}for(var c in b)s.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};r=function(a,b){var c,d;b==null&&(b={});for(c in b){if(!s.call(b,c))continue;d=b[c],a[c]=d}return a},b=function(){function b(){this.toString=t(this.toString,this),this.or=t(this.or,this),this.and=t(this.and,this),this.end=t(this.end,this),this.or_begin=t(this.or_begin,this),this.and_begin=t(this.and_begin,this);var a=this;this.tree={parent:null,nodes:[]},this.current=this.tree,this._begin=function(b){var c;return c={type:b,parent:a.current,nodes:[]},a.current.nodes.push(c),a.current=a.current.nodes[a.current.nodes.length-1],a}}var a;return b.prototype.tree=null,b.prototype.current=null,b.prototype.and_begin=function(){return this._begin("AND")},b.prototype.or_begin=function(){return this._begin("OR")},b.prototype.end=function(){if(!this.current.parent)throw new Error("begin() needs to be called");return this.current=this.current.parent,this},b.prototype.and=function(a){if(!a||"string"!=typeof a)throw new Error("expr must be a string");return this.current.nodes.push({type:"AND",expr:a}),this},b.prototype.or=function(a){if(!a||"string"!=typeof a)throw new Error("expr must be a string");return this.current.nodes.push({type:"OR",expr:a}),this},b.prototype.toString=function(){if(null!==this.current.parent)throw new Error("end() needs to be called");return a(this.tree)},a=function(b){var c,d,e,f,g,h;e="",h=b.nodes;for(f=0,g=h.length;f<g;f++)c=h[f],c.expr!=null?d=c.expr:(d=a(c),""!==d&&(d="("+d+")")),""!==d&&(""!==e&&(e+=" "+c.type+" "),e+=d);return e},b}(),i=function(a){var b;if(a&&a.constructor&&a.constructor.toString){b=a.constructor.toString().match(/function\s*(\w+)/);if(b&&b.length===2)return b[1]}},c=i(new b),k=function(a){var b;b=typeof a;if(c!==i(a)&&"string"!==b)throw new Error("condition must be a string or Expression instance");return"Expression"===b&&(a=a.toString()),a},n=function(a,b){if("string"!=typeof a)throw new Error(""+b+" must be a string");return a},l=function(a){return n(a,"field name")},o=function(a){return n(a,"table name")},j=function(a){return n(a,"alias")},m=function(a){a=parseInt(a);if(0>a)throw new Error("limit/offset must be >=0");return a},p=function(a){var b;b=typeof a;if(null!==a&&"string"!==b&&"number"!==b&&"boolean"!==b)throw new Error("field value must be a string, number, boolean or null");return a},h=function(a,b){return null===a?a="NULL":"boolean"==typeof a?a=a?"TRUE":"FALSE":"number"!=typeof a&&b.autoQuotes&&(a='"'+a+'"'),a},g=function(){function a(){this.limitString=t(this.limitString,this),this.orderString=t(this.orderString,this),this.whereString=t(this.whereString,this),this.limit=t(this.limit,this),this.order=t(this.order,this),this.where=t(this.where,this),this.wheres=[],this.orders=[]}return a.prototype.wheres=null,a.prototype.orders=null,a.prototype.limits=null,a.prototype.where=function(a){return a=k(a),""!==a&&this.wheres.push(a),this},a.prototype.order=function(a,b){return b==null&&(b=!0),a=l(a),this.orders.push({field:a,dir:b?"ASC":"DESC"}),this},a.prototype.limit=function(a){return a=m(a),this.limits=a,this},a.prototype.whereString=function(){return 0<this.wheres.length?" WHERE ("+this.wheres.join(") AND (")+")":""},a.prototype.orderString=function(){var a,b,c,d,e;if(0<this.orders.length){b="",e=this.orders;for(c=0,d=e.length;c<d;c++)a=e[c],""!==b&&(b+=", "),b+=""+a.field+" "+a.dir;return" ORDER BY "+b}return""},a.prototype.limitString=function(){return this.limits?" LIMIT "+this.limits:""},a}(),e=function(a){function b(){this.toString=t(this.toString,this),this.offset=t(this.offset,this),this.group=t(this.group,this),this.outer_join=t(this.outer_join,this),this.right_join=t(this.right_join,this),this.left_join=t(this.left_join,this),this.join=t(this.join,this),this.field=t(this.field,this),this.from=t(this.from,this),this.distinct=t(this.distinct,this);var a=this;b.__super__.constructor.apply(this,arguments),this.froms=[],this.fields=[],this.joins=[],this.groups=[],this._join=function(b,c,d,e){return c=o(c),d&&(d=j(d)),e&&(e=k(e)),a.joins.push({type:b,table:c,alias:d,condition:e}),a}}return u(b,a),b.prototype.froms=null,b.prototype.fields=null,b.prototype.joins=null,b.prototype.groups=null,b.prototype.offsets=null,b.prototype.useDistinct=!1,b.prototype.distinct=function(){return this.useDistinct=!0,this},b.prototype.from=function(a,b){return b==null&&(b=null),a=o(a),b&&(b=j(b)),this.froms.push({name:a,alias:b}),this},b.prototype.field=function(a,b){return b==null&&(b=null),a=l(a),b&&(b=j(b)),this.fields.push({field:a,alias:b}),this},b.prototype.join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("INNER",a,b,c)},b.prototype.left_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("LEFT",a,b,c)},b.prototype.right_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("RIGHT",a,b,c)},b.prototype.outer_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("OUTER",a,b,c)},b.prototype.group=function(a){return a=l(a),this.groups.push(a),this},b.prototype.offset=function(a){return a=m(a),this.offsets=a,this},b.prototype.toString=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(0>=this.froms.length)throw new Error("from() needs to be called");g="SELECT ",this.useDistinct&&(g+="DISTINCT "),c="",r=this.fields;for(j=0,n=r.length;j<n;j++)b=r[j],""!==c&&(c+=", "),c+=b.field,b.alias&&(c+=' AS "'+b.alias+'"');g+=""===c?"*":c,i="",s=this.froms;for(k=0,o=s.length;k<o;k++)h=s[k],""!==i&&(i+=", "),i+=h.name,h.alias&&(i+=" `"+h.alias+"`");g+=" FROM "+i,f="",t=this.joins;for(l=0,p=t.length;l<p;l++)e=t[l],f+=" "+e.type+" JOIN "+e.table,e.alias&&(f+=" `"+e.alias+"`"),e.condition&&(f+=" ON ("+e.condition+")");g+=f,g+=this.whereString();if(0<this.groups.length){d="",u=this.groups;for(m=0,q=u.length;m<q;m++)a=u[m],""!==d&&(d+=", "),d+=a;g+=" GROUP BY "+d}return g+=this.orderString(),g+=this.limitString(),this.offsets&&(g+=" OFFSET "+this.offsets),g},b}(g),f=function(a){function b(a){this.toString=t(this.toString,this),this.set=t(this.set,this),this.table=t(this.table,this),b.__super__.constructor.apply(this,arguments),this.tables=[],this.fields={},this.formattingOptions=r({autoQuotes:!0},a)}return u(b,a),b.prototype.tables=null,b.prototype.fields=null,b.prototype.formattingOptions=null,b.prototype.table=function(a,b){return b==null&&(b=null),a=o(a),b&&(b=j(b)),this.tables.push({name:a,alias:b}),this},b.prototype.set=function(a,b){return a=l(a),b=p(b),this.fields[a]=b,this},b.prototype.toString=function(){var a,b,c,d,e,f,g,i,j,k,l;if(0>=this.tables.length)throw new Error("table() needs to be called");b=function(){var b,c;b=this.fields,c=[];for(a in b){if(!s.call(b,a))continue;c.push(a)}return c}.call(this);if(0>=b.length)throw new Error("set() needs to be called");d="UPDATE ",f="",l=this.tables;for(g=0,j=l.length;g<j;g++)e=l[g],""!==f&&(f+=", "),f+=e.name,e.alias&&(f+=" AS `"+e.alias+"`");d+=f,c="";for(i=0,k=b.length;i<k;i++)a=b[i],""!==c&&(c+=", "),c+=""+a+" = "+h(this.fields[a],this.formattingOptions);return d+=" SET "+c,d+=this.whereString(),d+=this.orderString(),d+=this.limitString(),d},b}(g),a=function(a){function b(){this.toString=t(this.toString,this),this.from=t(this.from,this),b.__super__.constructor.apply(this,arguments)}return u(b,a),b.prototype.table=null,b.prototype.from=function(a){return a=o(a),this.table=a,this},b.prototype.toString=function(){var a;if(!this.table)throw new Error("from() needs to be called");return a="DELETE FROM "+this.table,a+=this.whereString(),a+=this.orderString(),a+=this.limitString(),a},b}(g),d=function(){function a(a){this.toString=t(this.toString,this),this.set=t(this.set,this),this.into=t(this.into,this),this.fields={},this.formattingOptions=r({autoQuotes:!0},a)}return a.prototype.table=null,a.prototype.fields=null,a.prototype.formattingOptions=null,a.prototype.into=function(a){return a=o(a),this.table=a,this},a.prototype.set=function(a,b){return a=l(a),b=p(b),this.fields[a]=b,this},a.prototype.toString=function(){var a,b,c,d,e,f,g;if(!this.table)throw new Error("into() needs to be called");b=function(){var a,b;a=this.fields,b=[];for(d in a){if(!s.call(a,d))continue;b.push(d)}return b}.call(this);if(0>=b.length)throw new Error("set() needs to be called");c="",e="";for(f=0,g=b.length;f<g;f++)a=b[f],""!==c&&(c+=", "),c+=a,""!==e&&(e+=", "),e+=h(this.fields[a],this.formattingOptions);return"INSERT INTO "+this.table+" ("+c+") VALUES ("+e+")"},a}(),q={expr:function(){return new b},select:function(){return new e},update:function(a){return new f(a)},insert:function(a){return new d(a)},"delete":function(){return new a}},typeof module!="undefined"&&module!==null&&(module.exports=q),typeof window!="undefined"&&window!==null&&(window.squel=q)})).call(this);
*/((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=Array.prototype.slice,v=Object.prototype.hasOwnProperty,w=function(a,b){return function(){return a.apply(b,arguments)}},x=function(a,b){function d(){this.constructor=a}for(var c in b)v.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};t=function(){var a,b,c,d,e,f,g;a=arguments[0],c=2<=arguments.length?u.call(arguments,1):[];if(c)for(f=0,g=c.length;f<g;f++){d=c[f];if(d)for(b in d){if(!v.call(d,b))continue;e=d[b],a[b]=e}}return a},d=function(){function b(){this.toString=w(this.toString,this),this.or=w(this.or,this),this.and=w(this.and,this),this.end=w(this.end,this),this.or_begin=w(this.or_begin,this),this.and_begin=w(this.and_begin,this);var a=this;this.tree={parent:null,nodes:[]},this.current=this.tree,this._begin=function(b){var c;return c={type:b,parent:a.current,nodes:[]},a.current.nodes.push(c),a.current=a.current.nodes[a.current.nodes.length-1],a}}var a;return b.prototype.tree=null,b.prototype.current=null,b.prototype.and_begin=function(){return this._begin("AND")},b.prototype.or_begin=function(){return this._begin("OR")},b.prototype.end=function(){if(!this.current.parent)throw new Error("begin() needs to be called");return this.current=this.current.parent,this},b.prototype.and=function(a){if(!a||"string"!=typeof a)throw new Error("expr must be a string");return this.current.nodes.push({type:"AND",expr:a}),this},b.prototype.or=function(a){if(!a||"string"!=typeof a)throw new Error("expr must be a string");return this.current.nodes.push({type:"OR",expr:a}),this},b.prototype.toString=function(){if(null!==this.current.parent)throw new Error("end() needs to be called");return a(this.tree)},a=function(b){var c,d,e,f,g,h;e="",h=b.nodes;for(f=0,g=h.length;f<g;f++)c=h[f],c.expr!=null?d=c.expr:(d=a(c),""!==d&&(d="("+d+")")),""!==d&&(""!==e&&(e+=" "+c.type+" "),e+=d);return e},b}(),a=b={usingValuePlaceholders:!1},k=function(a){var b;if(a&&a.constructor&&a.constructor.toString){b=a.constructor.toString().match(/function\s*(\w+)/);if(b&&b.length===2)return b[1]}},e=k(new d),m=function(a){var b;b=typeof a;if(e!==k(a)&&"string"!==b)throw new Error("condition must be a string or Expression instance");return"Expression"===b&&(a=a.toString()),a},p=function(a,b){if("string"!=typeof a)throw new Error(""+b+" must be a string");return a},n=function(a){return p(a,"field name")},q=function(a){return p(a,"table name")},l=function(a){return p(a,"alias")},o=function(a){a=parseInt(a);if(0>a)throw new Error("limit/offset must be >=0");return a},r=function(a){var b;b=typeof a;if(null!==a&&"string"!==b&&"number"!==b&&"boolean"!==b)throw new Error("field value must be a string, number, boolean or null");return a},j=function(a,b){return null===a?a="NULL":"boolean"==typeof a?a=a?"TRUE":"FALSE":"number"!=typeof a&&!1===b.usingValuePlaceholders&&(a='"'+a+'"'),a},i=function(){function a(){this.limitString=w(this.limitString,this),this.orderString=w(this.orderString,this),this.whereString=w(this.whereString,this),this.limit=w(this.limit,this),this.order=w(this.order,this),this.where=w(this.where,this),this.wheres=[],this.orders=[]}return a.prototype.wheres=null,a.prototype.orders=null,a.prototype.limits=null,a.prototype.where=function(a){return a=m(a),""!==a&&this.wheres.push(a),this},a.prototype.order=function(a,b){return b==null&&(b=!0),a=n(a),this.orders.push({field:a,dir:b?"ASC":"DESC"}),this},a.prototype.limit=function(a){return a=o(a),this.limits=a,this},a.prototype.whereString=function(){return 0<this.wheres.length?" WHERE ("+this.wheres.join(") AND (")+")":""},a.prototype.orderString=function(){var a,b,c,d,e;if(0<this.orders.length){b="",e=this.orders;for(c=0,d=e.length;c<d;c++)a=e[c],""!==b&&(b+=", "),b+=""+a.field+" "+a.dir;return" ORDER BY "+b}return""},a.prototype.limitString=function(){return this.limits?" LIMIT "+this.limits:""},a}(),g=function(a){function b(){this.toString=w(this.toString,this),this.offset=w(this.offset,this),this.group=w(this.group,this),this.outer_join=w(this.outer_join,this),this.right_join=w(this.right_join,this),this.left_join=w(this.left_join,this),this.join=w(this.join,this),this.field=w(this.field,this),this.from=w(this.from,this),this.distinct=w(this.distinct,this);var a=this;b.__super__.constructor.apply(this,arguments),this.froms=[],this.fields=[],this.joins=[],this.groups=[],this._join=function(b,c,d,e){return c=q(c),d&&(d=l(d)),e&&(e=m(e)),a.joins.push({type:b,table:c,alias:d,condition:e}),a}}return x(b,a),b.prototype.froms=null,b.prototype.fields=null,b.prototype.joins=null,b.prototype.groups=null,b.prototype.offsets=null,b.prototype.useDistinct=!1,b.prototype.distinct=function(){return this.useDistinct=!0,this},b.prototype.from=function(a,b){return b==null&&(b=null),a=q(a),b&&(b=l(b)),this.froms.push({name:a,alias:b}),this},b.prototype.field=function(a,b){return b==null&&(b=null),a=n(a),b&&(b=l(b)),this.fields.push({field:a,alias:b}),this},b.prototype.join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("INNER",a,b,c)},b.prototype.left_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("LEFT",a,b,c)},b.prototype.right_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("RIGHT",a,b,c)},b.prototype.outer_join=function(a,b,c){return b==null&&(b=null),c==null&&(c=null),this._join("OUTER",a,b,c)},b.prototype.group=function(a){return a=n(a),this.groups.push(a),this},b.prototype.offset=function(a){return a=o(a),this.offsets=a,this},b.prototype.toString=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(0>=this.froms.length)throw new Error("from() needs to be called");g="SELECT ",this.useDistinct&&(g+="DISTINCT "),c="",r=this.fields;for(j=0,n=r.length;j<n;j++)b=r[j],""!==c&&(c+=", "),c+=b.field,b.alias&&(c+=' AS "'+b.alias+'"');g+=""===c?"*":c,i="",s=this.froms;for(k=0,o=s.length;k<o;k++)h=s[k],""!==i&&(i+=", "),i+=h.name,h.alias&&(i+=" `"+h.alias+"`");g+=" FROM "+i,f="",t=this.joins;for(l=0,p=t.length;l<p;l++)e=t[l],f+=" "+e.type+" JOIN "+e.table,e.alias&&(f+=" `"+e.alias+"`"),e.condition&&(f+=" ON ("+e.condition+")");g+=f,g+=this.whereString();if(0<this.groups.length){d="",u=this.groups;for(m=0,q=u.length;m<q;m++)a=u[m],""!==d&&(d+=", "),d+=a;g+=" GROUP BY "+d}return g+=this.orderString(),g+=this.limitString(),this.offsets&&(g+=" OFFSET "+this.offsets),g},b}(i),h=function(a){function c(a){this.toString=w(this.toString,this),this.set=w(this.set,this),this.table=w(this.table,this),c.__super__.constructor.apply(this,arguments),this.tables=[],this.fields={},this.options=t({},b,a)}return x(c,a),c.prototype.tables=null,c.prototype.fields=null,c.prototype.options=null,c.prototype.table=function(a,b){return b==null&&(b=null),a=q(a),b&&(b=l(b)),this.tables.push({name:a,alias:b}),this},c.prototype.set=function(a,b){return a=n(a),b=r(b),this.fields[a]=b,this},c.prototype.toString=function(){var a,b,c,d,e,f,g,h,i,k,l;if(0>=this.tables.length)throw new Error("table() needs to be called");b=function(){var b,c;b=this.fields,c=[];for(a in b){if(!v.call(b,a))continue;c.push(a)}return c}.call(this);if(0>=b.length)throw new Error("set() needs to be called");d="UPDATE ",f="",l=this.tables;for(g=0,i=l.length;g<i;g++)e=l[g],""!==f&&(f+=", "),f+=e.name,e.alias&&(f+=" AS `"+e.alias+"`");d+=f,c="";for(h=0,k=b.length;h<k;h++)a=b[h],""!==c&&(c+=", "),c+=""+a+" = "+j(this.fields[a],this.options);return d+=" SET "+c,d+=this.whereString(),d+=this.orderString(),d+=this.limitString(),d},c}(i),c=function(a){function b(){this.toString=w(this.toString,this),this.from=w(this.from,this),b.__super__.constructor.apply(this,arguments)}return x(b,a),b.prototype.table=null,b.prototype.from=function(a){return a=q(a),this.table=a,this},b.prototype.toString=function(){var a;if(!this.table)throw new Error("from() needs to be called");return a="DELETE FROM "+this.table,a+=this.whereString(),a+=this.orderString(),a+=this.limitString(),a},b}(i),f=function(){function b(b){this.toString=w(this.toString,this),this.set=w(this.set,this),this.into=w(this.into,this),this.fields={},this.options=t({},a,b)}return b.prototype.table=null,b.prototype.fields=null,b.prototype.options=null,b.prototype.into=function(a){return a=q(a),this.table=a,this},b.prototype.set=function(a,b){return a=n(a),b=r(b),this.fields[a]=b,this},b.prototype.toString=function(){var a,b,c,d,e,f,g;if(!this.table)throw new Error("into() needs to be called");b=function(){var a,b;a=this.fields,b=[];for(d in a){if(!v.call(a,d))continue;b.push(d)}return b}.call(this);if(0>=b.length)throw new Error("set() needs to be called");c="",e="";for(f=0,g=b.length;f<g;f++)a=b[f],""!==c&&(c+=", "),c+=a,""!==e&&(e+=", "),e+=j(this.fields[a],this.options);return"INSERT INTO "+this.table+" ("+c+") VALUES ("+e+")"},b}(),s={expr:function(){return new d},select:function(){return new g},update:function(a){return new h(a)},insert:function(a){return new f(a)},"delete":function(){return new c}},typeof module!="undefined"&&module!==null&&(module.exports=s),typeof window!="undefined"&&window!==null&&(window.squel=s)})).call(this);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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