Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "squel", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"main": "squel.js", | ||
"ignore": [ | ||
"**/.*", | ||
"Makefile", | ||
"Gruntfile.js", | ||
"node_modules", | ||
@@ -9,0 +9,0 @@ "public", |
# Changelog for [squel](https://github.com/hiddentao/squel) | ||
## 21 Mar 2014 (3.1.2) | ||
* Auto-generate version string | ||
* Don't commit docs/ folder anymore. Also don't auto-build docs as part of build. | ||
## 21 Mar 2014 (3.1.1) | ||
@@ -4,0 +8,0 @@ * Don't format parameter values returned from the toParam() call, unless their custom value types (#54) |
@@ -7,2 +7,4 @@ 'use strict'; | ||
var SQUEL_VERSION = require('./package.json').version; | ||
grunt.initConfig({ | ||
@@ -30,2 +32,12 @@ clean: { | ||
}, | ||
replace: { | ||
squel: { | ||
src: ['./squel-basic.js', './squel.js'], | ||
overwrite: true, | ||
replacements: [{ | ||
from: '<<VERSION_STRING>>', | ||
to: SQUEL_VERSION | ||
}] | ||
} | ||
}, | ||
uglify: { | ||
@@ -67,6 +79,11 @@ build_basic: { | ||
grunt.registerTask('docs', [ | ||
'shell:docs' | ||
]); | ||
grunt.registerTask('test', [ | ||
'clean:build', | ||
'coffee', | ||
'replace', | ||
'mochaTest' | ||
@@ -78,5 +95,5 @@ ]); | ||
'coffee', | ||
'mochaTest', | ||
'replace', | ||
'uglify', | ||
'shell:docs' | ||
'mochaTest' | ||
]); | ||
@@ -83,0 +100,0 @@ |
{ | ||
"name": "squel", | ||
"description": "SQL query string builder", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"author": "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)", | ||
@@ -26,3 +26,4 @@ "contributors": [ | ||
"grunt-mocha-test": "~0.6.3", | ||
"grunt-shell": "~0.4.0" | ||
"grunt-shell": "~0.4.0", | ||
"grunt-text-replace": "~0.3.11" | ||
}, | ||
@@ -29,0 +30,0 @@ "keywords": [ |
@@ -15,4 +15,4 @@ # squel - SQL query string builder | ||
* Uses method chaining for ease of use. | ||
* Well tested (~290 tests). | ||
* Small: <4 KB minified and gzipped | ||
* And much more, [see the guide..](http://squeljs.org/) | ||
@@ -279,2 +279,7 @@ ## Installation | ||
Examples of custom queries in the wild: | ||
* https://github.com/bostrt/squel-top-start-at (blog post about it: http://blog.bostrt.net/extending-squel-js/) | ||
## Non-standard SQL | ||
@@ -281,0 +286,0 @@ |
@@ -1409,3 +1409,3 @@ /* | ||
squel = { | ||
VERSION: '2.0.0', | ||
VERSION: '3.1.2', | ||
expr: function() { | ||
@@ -1412,0 +1412,0 @@ return new cls.Expression; |
@@ -1,1 +0,1 @@ | ||
/*! squel | https://github.com/hiddentao/squel | BSD license */(function(){var a,b,c,d,e,f,g,h,i,j,k=[].slice,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};a={},e=function(){var a,b,c,d,e,f,g;if(a=arguments[0],c=2<=arguments.length?k.call(arguments,1):[])for(f=0,g=c.length;g>f;f++)if(d=c[f])for(b in d)l.call(d,b)&&(e=d[b],a[b]=e);return a},a.DefaultQueryBuilderOptions={autoQuoteTableNames:!1,autoQuoteFieldNames:!1,autoQuoteAliasNames:!0,nameQuoteCharacter:"`",tableAliasQuoteCharacter:"`",fieldAliasQuoteCharacter:'"',valueHandlers:[],numberedParameters:!1},a.globalValueHandlers=[],c=function(a,b,c){var d,e,f;if("function"!=typeof b)throw new Error("type must be a class constructor");if("function"!=typeof c)throw new Error("handler must be a function");for(e=0,f=a.length;f>e;e++)if(d=a[e],d.type===b)return void(d.handler=c);return a.push({type:b,handler:c})},b=function(){var a,b,c,d,e,f,g,h;for(d=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],e=0,g=a.length;g>e;e++)for(b=a[e],f=0,h=b.length;h>f;f++)if(c=b[f],d instanceof c.type)return c.handler;return void 0},a.registerValueHandler=function(b,d){return c(a.globalValueHandlers,b,d)},a.Cloneable=function(){function a(){}return a.prototype.clone=function(){var a;return a=new this.constructor,e(a,JSON.parse(JSON.stringify(this)))},a}(),a.BaseBuilder=function(d){function f(b){var c;c=JSON.parse(JSON.stringify(a.DefaultQueryBuilderOptions)),this.options=e({},c,b)}return m(f,d),f.prototype.registerValueHandler=function(a,b){return c(this.options.valueHandlers,a,b),this},f.prototype._getObjectClassName=function(a){var b;return a&&a.constructor&&a.constructor.toString&&(b=a.constructor.toString().match(/function\s*(\w+)/),b&&2===b.length)?b[1]:void 0},f.prototype._sanitizeCondition=function(b){if(b instanceof a.Expression&&(b=b.toString()),"string"!=typeof b)throw new Error("condition must be a string or Expression instance");return b},f.prototype._sanitizeName=function(a,b){if("string"!=typeof a)throw new Error(""+b+" must be a string");return a},f.prototype._sanitizeField=function(a){var b;return b=this._sanitizeName(a,"field name"),this.options.autoQuoteFieldNames?""+this.options.nameQuoteCharacter+b+this.options.nameQuoteCharacter:b},f.prototype._sanitizeTable=function(b,c){var d;if(null==c&&(c=!1),c){if("string"!=typeof b){if(b instanceof a.QueryBuilder&&b.isNestable())return b;throw new Error("table name must be a string or a nestable query instance")}d=b}else d=this._sanitizeName(b,"table name");return this.options.autoQuoteTableNames?""+this.options.nameQuoteCharacter+d+this.options.nameQuoteCharacter:d},f.prototype._sanitizeTableAlias=function(a){var b;return b=this._sanitizeName(a,"table alias"),this.options.autoQuoteAliasNames?""+this.options.tableAliasQuoteCharacter+b+this.options.tableAliasQuoteCharacter:b},f.prototype._sanitizeFieldAlias=function(a){var b;return b=this._sanitizeName(a,"field alias"),this.options.autoQuoteAliasNames?""+this.options.fieldAliasQuoteCharacter+b+this.options.fieldAliasQuoteCharacter:b},f.prototype._sanitizeLimitOffset=function(a){if(a=parseInt(a),0>a||isNaN(a))throw new Error("limit/offset must be >= 0");return a},f.prototype._sanitizeValue=function(c){var d,e;if(d=typeof c,null===c);else if("string"===d||"number"===d||"boolean"===d);else if(e=void 0!==b(c,this.options.valueHandlers,a.globalValueHandlers),!e)throw new Error("field value must be a string, number, boolean, null or one of the registered custom value types");return c},f.prototype._escapeValue=function(a){return a},f.prototype._formatCustomValue=function(c){var d;return d=b(c,this.options.valueHandlers,a.globalValueHandlers),d&&(c=d(c)),c},f.prototype._formatValue=function(a){return a=this._formatCustomValue(a),null===a?a="NULL":"boolean"==typeof a?a=a?"TRUE":"FALSE":"number"!=typeof a&&(a=this._escapeValue(a),a="'"+a+"'"),a},f}(a.Cloneable),a.Expression=function(a){function b(){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 c;return m(b,a),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 c(this.tree)},c=function(a){var b,d,e,f,g,h;for(e="",h=a.nodes,f=0,g=h.length;g>f;f++)b=h[f],null!=b.expr?d=b.expr:(d=c(b),""!==d&&(d="("+d+")")),""!==d&&(""!==e&&(e+=" "+b.type+" "),e+=d);return e},b.prototype.clone=function(){var a,b;return a=new this.constructor,(b=function(c){var d,e,f,g,h;for(g=c.nodes,h=[],e=0,f=g.length;f>e;e++)d=g[e],null!=d.expr?h.push(a.current.nodes.push(JSON.parse(JSON.stringify(d)))):(a._begin(d.type),b(d),h.push(!this.current===d?a.end():void 0));return h})(this.tree),a},b}(a.Cloneable),a.Block=function(b){function c(){return f=c.__super__.constructor.apply(this,arguments)}return m(c,b),c.prototype.exposedMethods=function(){var b,c,d;c={};for(b in this)d=this[b],"function"!=typeof d||"_"===b.charAt(0)||a.Block.prototype[b]||(c[b]=d);return c},c.prototype.buildStr=function(){return""},c.prototype.buildParam=function(a){return{text:this.buildStr(a),values:[]}},c}(a.BaseBuilder),a.StringBlock=function(a){function b(a,c){b.__super__.constructor.call(this,a),this.str=c}return m(b,a),b.prototype.buildStr=function(){return this.str},b}(a.Block),a.AbstractTableBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.tables=[]}return m(b,a),b.prototype._table=function(a,b){return null==b&&(b=null),b&&(b=this._sanitizeTableAlias(b)),a=this._sanitizeTable(a,this.options.allowNested||!1),this.options.singleTable&&(this.tables=[]),this.tables.push({table:a,alias:b})},b.prototype.buildStr=function(){var a,b,c,d,e;if(0>=this.tables.length)throw new Error("_table() needs to be called");for(b="",e=this.tables,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+="string"==typeof a.table?a.table:"("+a.table+")",a.alias&&(b+=" "+a.alias);return b},b}(a.Block),a.UpdateTableBlock=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.table=function(a,b){return null==b&&(b=null),this._table(a,b)},b}(a.AbstractTableBlock),a.FromTableBlock=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.from=function(a,b){return null==b&&(b=null),this._table(a,b)},b.prototype.buildStr=function(a){var c;if(0>=this.tables.length)throw new Error("from() needs to be called");return c=b.__super__.buildStr.call(this,a),"FROM "+c},b}(a.AbstractTableBlock),a.IntoTableBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.table=null}return m(b,a),b.prototype.into=function(a){return this.table=this._sanitizeTable(a,!1)},b.prototype.buildStr=function(){if(!this.table)throw new Error("into() needs to be called");return"INTO "+this.table},b}(a.Block),a.GetFieldBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this._fields=[]}return m(b,a),b.prototype.fields=function(a){var b,c,d;d=[];for(c in a)b=a[c],d.push(this.field(c,b));return d},b.prototype.field=function(a,b){return null==b&&(b=null),a=this._sanitizeField(a),b&&(b=this._sanitizeFieldAlias(b)),this._fields.push({name:a,alias:b})},b.prototype.buildStr=function(){var a,b,c,d,e;for(b="",e=this._fields,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=a.name,a.alias&&(b+=" AS "+a.alias);return""===b?"*":b},b}(a.Block),a.AbstractSetFieldBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.fields=[],this.values=[]}return m(b,a),b.prototype.set=function(a,b){var c;if(this.values.length>1)throw new Error("Cannot call set or setFields on multiple rows of fields.");return void 0!==b&&(b=this._sanitizeValue(b)),c=this.fields.indexOf(this._sanitizeField(a)),-1!==c?this.values[0][c]=b:(this.fields.push(this._sanitizeField(a)),c=this.fields.length-1,Array.isArray(this.values[0])?this.values[0][c]=b:this.values.push([b])),this},b.prototype.setFields=function(a){var b;if("object"!=typeof a)throw new Error("Expected an object but got "+typeof a);for(b in a)l.call(a,b)&&this.set(b,a[b]);return this},b.prototype.setFieldsRows=function(a){var b,c,d,e,f,g,h;if(!Array.isArray(a))throw new Error("Expected an array of objects but got "+typeof a);for(this.fields=[],this.values=[],c=f=0,g=a.length;g>=0?g>f:f>g;c=g>=0?++f:--f){h=a[c];for(b in h)if(l.call(h,b)){if(d=this.fields.indexOf(this._sanitizeField(b)),c>0&&-1===d)throw new Error("All fields in subsequent rows must match the fields in the first row");-1===d&&(this.fields.push(this._sanitizeField(b)),d=this.fields.length-1),e=this._sanitizeValue(a[c][b]),Array.isArray(this.values[c])?this.values[c][d]=e:this.values[c]=[e]}}return this},b.prototype.buildStr=function(){throw new Error("Not yet implemented")},b.prototype.buildParam=function(){throw new Error("Not yet implemented")},b}(a.Block),a.SetFieldBlock=function(a){function b(){return i=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.setFieldsRows=function(){throw new Error("Cannot call setFieldRows for an UPDATE SET")},b.prototype.buildStr=function(){var a,b,c,d,e,f;if(0>=this.fields.length)throw new Error("set() needs to be called");for(c="",b=e=0,f=this.fields.length;f>=0?f>e:e>f;b=f>=0?++e:--e)a=this.fields[b],""!==c&&(c+=", "),d=this.values[0][b],c+="undefined"==typeof d?a:""+a+" = "+this._formatValue(d);return"SET "+c},b.prototype.buildParam=function(){var a,b,c,d,e;if(0>=this.fields.length)throw new Error("set() needs to be called");for(b="",c=[],a=d=0,e=this.fields.length;e>=0?e>d:d>e;a=e>=0?++d:--d)""!==b&&(b+=", "),b+=""+this.fields[a]+" = ?",c.push(this._formatCustomValue(this.values[0][a]));return{text:"SET "+b,values:c}},b}(a.AbstractSetFieldBlock),a.InsertFieldValueBlock=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.buildStr=function(){var a,b,c,d,e,f,g,h;if(0>=this.fields.length)throw new Error("set() needs to be called");for(d=[],b=e=0,g=this.values.length;g>=0?g>e:e>g;b=g>=0?++e:--e)for(c=f=0,h=this.values[b].length;h>=0?h>f:f>h;c=h>=0?++f:--f)a=this._formatValue(this.values[b][c]),"string"==typeof d[b]?d[b]+=", "+a:d[b]=""+a;return"("+this.fields.join(", ")+") VALUES ("+d.join("), (")+")"},b.prototype.buildParam=function(){var a,b,c,d,e,f,g,h,i,j,k;if(0>=this.fields.length)throw new Error("set() needs to be called");for(d="",e=[],c=[],a=f=0,i=this.fields.length;i>=0?i>f:f>i;a=i>=0?++f:--f)""!==d&&(d+=", "),d+=this.fields[a];for(a=g=0,j=this.values.length;j>=0?j>g:g>j;a=j>=0?++g:--g)for(b=h=0,k=this.values[a].length;k>=0?k>h:h>k;b=k>=0?++h:--h)c.push(this._formatCustomValue(this.values[a][b])),"string"==typeof e[a]?e[a]+=", ?":e[a]="?";return{text:"("+d+") VALUES ("+e.join("), (")+")",values:c}},b}(a.AbstractSetFieldBlock),a.DistinctBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.useDistinct=!1}return m(b,a),b.prototype.distinct=function(){return this.useDistinct=!0},b.prototype.buildStr=function(){return this.useDistinct?"DISTINCT":""},b}(a.Block),a.GroupByBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.groups=[]}return m(b,a),b.prototype.group=function(a){return a=this._sanitizeField(a),this.groups.push(a)},b.prototype.buildStr=function(){var a,b,c,d,e;if(b="",0<this.groups.length){for(e=this.groups,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=a;b="GROUP BY "+b}return b},b}(a.Block),a.OffsetBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.offsets=null}return m(b,a),b.prototype.offset=function(a){return a=this._sanitizeLimitOffset(a),this.offsets=a},b.prototype.buildStr=function(){return this.offsets?"OFFSET "+this.offsets:""},b}(a.Block),a.WhereBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.wheres=[]}return m(b,a),b.prototype.where=function(){var a,b,c,d,e,f,g,h,i,j,l,m,n;for(b=arguments[0],i=2<=arguments.length?k.call(arguments,1):[],b=this._sanitizeCondition(b),c="",d=[],e=j=0,n=b.length;n>=0?n>j:j>n;e=n>=0?++j:--j)if(a=b.charAt(e),"?"===a&&0<i.length)if(h=i.shift(),Array.isArray(h)){for(f=[],l=0,m=h.length;m>l;l++)g=h[l],f.push(this._sanitizeValue(g));d=d.concat(f),c+="("+function(){var a,b,c;for(c=[],a=0,b=f.length;b>a;a++)g=f[a],c.push("?");return c}().join(", ")+")"}else c+="?",d.push(this._sanitizeValue(h));else c+=a;return""!==c?this.wheres.push({text:c,values:d}):void 0},b.prototype.buildStr=function(){var a,b,c,d,e,f,g,h,i;if(0>=this.wheres.length)return"";for(d="",h=this.wheres,e=0,g=h.length;g>e;e++)if(c=h[e],""!==d&&(d+=") AND ("),0<c.values.length)for(b=f=0,i=c.text.length;i>=0?i>f:f>i;b=i>=0?++f:--f)a=c.text.charAt(b),d+="?"===a?this._formatValue(c.values.shift()):a;else d+=c.text;return"WHERE ("+d+")"},b.prototype.buildParam=function(){var a,b,c,d,e,f,g,h,i,j;if(a={text:"",values:[]},0>=this.wheres.length)return a;for(d="",i=this.wheres,e=0,g=i.length;g>e;e++)for(c=i[e],""!==d&&(d+=") AND ("),d+=c.text,j=c.values,f=0,h=j.length;h>f;f++)b=j[f],a.values.push(this._formatCustomValue(b));return a.text="WHERE ("+d+")",a},b}(a.Block),a.OrderByBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.orders=[]}return m(b,a),b.prototype.order=function(a,b){return null==b&&(b=!0),a=this._sanitizeField(a),this.orders.push({field:a,dir:b?!0:!1})},b.prototype.buildStr=function(){var a,b,c,d,e;if(0<this.orders.length){for(b="",e=this.orders,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=""+a.field+" "+(a.dir?"ASC":"DESC");return"ORDER BY "+b}return""},b}(a.Block),a.LimitBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.limits=null}return m(b,a),b.prototype.limit=function(a){return a=this._sanitizeLimitOffset(a),this.limits=a},b.prototype.buildStr=function(){return this.limits?"LIMIT "+this.limits:""},b}(a.Block),a.JoinBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.joins=[]}return m(b,a),b.prototype.join=function(a,b,c,d){return null==b&&(b=null),null==c&&(c=null),null==d&&(d="INNER"),a=this._sanitizeTable(a,!0),b&&(b=this._sanitizeTableAlias(b)),c&&(c=this._sanitizeCondition(c)),this.joins.push({type:d,table:a,alias:b,condition:c}),this},b.prototype.left_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"LEFT")},b.prototype.right_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"RIGHT")},b.prototype.outer_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"OUTER")},b.prototype.left_outer_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"LEFT OUTER")},b.prototype.buildStr=function(){var a,b,c,d,e;for(b="",e=this.joins||[],c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=" "),b+=""+a.type+" JOIN ",b+="string"==typeof a.table?a.table:"("+a.table+")",a.alias&&(b+=" "+a.alias),a.condition&&(b+=" ON ("+a.condition+")");return b},b}(a.Block),a.QueryBuilder=function(a){function b(a,c){var d,e,f,g,h,i,j,k,l=this;for(b.__super__.constructor.call(this,a),this.blocks=c||[],j=this.blocks,h=0,i=j.length;i>h;h++){d=j[h],k=d.exposedMethods(),g=function(a,b,c){return l[b]=function(){return c.apply(a,arguments),l}};for(f in k){if(e=k[f],null!=this[f])throw new Error(""+this._getObjectClassName(this)+" already has a builder method called: "+f);g(d,f,e)}}}return m(b,a),b.prototype.registerValueHandler=function(a,c){var d,e,f,g;for(g=this.blocks,e=0,f=g.length;f>e;e++)d=g[e],d.registerValueHandler(a,c);return b.__super__.registerValueHandler.call(this,a,c),this},b.prototype.updateOptions=function(a){var b,c,d,f,g;for(this.options=e({},this.options,a),f=this.blocks,g=[],c=0,d=f.length;d>c;c++)b=f[c],g.push(b.options=e({},b.options,a));return g},b.prototype.toString=function(){var a;return function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.buildStr(this));return e}.call(this).filter(function(a){return 0<a.length}).join(" ")},b.prototype.toParam=function(){var a,b,c,d,e;return d={text:"",values:[]},b=function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.buildParam(this));return e}.call(this),d.text=function(){var c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a.text);return e}().filter(function(a){return 0<a.length}).join(" "),d.values=(e=[]).concat.apply(e,function(){var c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a.values);return e}()),this.options.numberedParameters&&(c=0,d.text=d.text.replace(/\?/g,function(){return"$"+ ++c})),d},b.prototype.clone=function(){var a;return new this.constructor(this.options,function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.clone());return e}.call(this))},b.prototype.isNestable=function(){return!1},b}(a.BaseBuilder),a.Select=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"SELECT"),new a.DistinctBlock(b),new a.GetFieldBlock(b),new a.FromTableBlock(e({},b,{allowNested:!0})),new a.JoinBlock(e({},b,{allowNested:!0})),new a.WhereBlock(b),new a.GroupByBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b),new a.OffsetBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c.prototype.isNestable=function(){return!0},c}(a.QueryBuilder),a.Update=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"UPDATE"),new a.UpdateTableBlock(b),new a.SetFieldBlock(b),new a.WhereBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),a.Delete=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"DELETE"),new a.FromTableBlock(e({},b,{singleTable:!0})),new a.JoinBlock(b),new a.WhereBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),a.Insert=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"INSERT"),new a.IntoTableBlock(b),new a.InsertFieldValueBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),d={VERSION:"2.0.0",expr:function(){return new a.Expression},select:function(b,c){return new a.Select(b,c)},update:function(b,c){return new a.Update(b,c)},insert:function(b,c){return new a.Insert(b,c)},"delete":function(b,c){return new a.Delete(b,c)},registerValueHandler:a.registerValueHandler},d.remove=d["delete"],d.cls=a,("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return d}):("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=d:"undefined"!=typeof window&&null!==window&&(window.squel=d),d.flavours={},d.useFlavour=function(a){if(!(d.flavours[a]instanceof Function))throw new Error("Flavour not available: "+a);return d.flavours[a].call(null,d),d}}).call(this); | ||
/*! squel | https://github.com/hiddentao/squel | BSD license */(function(){var a,b,c,d,e,f,g,h,i,j,k=[].slice,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};a={},e=function(){var a,b,c,d,e,f,g;if(a=arguments[0],c=2<=arguments.length?k.call(arguments,1):[])for(f=0,g=c.length;g>f;f++)if(d=c[f])for(b in d)l.call(d,b)&&(e=d[b],a[b]=e);return a},a.DefaultQueryBuilderOptions={autoQuoteTableNames:!1,autoQuoteFieldNames:!1,autoQuoteAliasNames:!0,nameQuoteCharacter:"`",tableAliasQuoteCharacter:"`",fieldAliasQuoteCharacter:'"',valueHandlers:[],numberedParameters:!1},a.globalValueHandlers=[],c=function(a,b,c){var d,e,f;if("function"!=typeof b)throw new Error("type must be a class constructor");if("function"!=typeof c)throw new Error("handler must be a function");for(e=0,f=a.length;f>e;e++)if(d=a[e],d.type===b)return void(d.handler=c);return a.push({type:b,handler:c})},b=function(){var a,b,c,d,e,f,g,h;for(d=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],e=0,g=a.length;g>e;e++)for(b=a[e],f=0,h=b.length;h>f;f++)if(c=b[f],d instanceof c.type)return c.handler;return void 0},a.registerValueHandler=function(b,d){return c(a.globalValueHandlers,b,d)},a.Cloneable=function(){function a(){}return a.prototype.clone=function(){var a;return a=new this.constructor,e(a,JSON.parse(JSON.stringify(this)))},a}(),a.BaseBuilder=function(d){function f(b){var c;c=JSON.parse(JSON.stringify(a.DefaultQueryBuilderOptions)),this.options=e({},c,b)}return m(f,d),f.prototype.registerValueHandler=function(a,b){return c(this.options.valueHandlers,a,b),this},f.prototype._getObjectClassName=function(a){var b;return a&&a.constructor&&a.constructor.toString&&(b=a.constructor.toString().match(/function\s*(\w+)/),b&&2===b.length)?b[1]:void 0},f.prototype._sanitizeCondition=function(b){if(b instanceof a.Expression&&(b=b.toString()),"string"!=typeof b)throw new Error("condition must be a string or Expression instance");return b},f.prototype._sanitizeName=function(a,b){if("string"!=typeof a)throw new Error(""+b+" must be a string");return a},f.prototype._sanitizeField=function(a){var b;return b=this._sanitizeName(a,"field name"),this.options.autoQuoteFieldNames?""+this.options.nameQuoteCharacter+b+this.options.nameQuoteCharacter:b},f.prototype._sanitizeTable=function(b,c){var d;if(null==c&&(c=!1),c){if("string"!=typeof b){if(b instanceof a.QueryBuilder&&b.isNestable())return b;throw new Error("table name must be a string or a nestable query instance")}d=b}else d=this._sanitizeName(b,"table name");return this.options.autoQuoteTableNames?""+this.options.nameQuoteCharacter+d+this.options.nameQuoteCharacter:d},f.prototype._sanitizeTableAlias=function(a){var b;return b=this._sanitizeName(a,"table alias"),this.options.autoQuoteAliasNames?""+this.options.tableAliasQuoteCharacter+b+this.options.tableAliasQuoteCharacter:b},f.prototype._sanitizeFieldAlias=function(a){var b;return b=this._sanitizeName(a,"field alias"),this.options.autoQuoteAliasNames?""+this.options.fieldAliasQuoteCharacter+b+this.options.fieldAliasQuoteCharacter:b},f.prototype._sanitizeLimitOffset=function(a){if(a=parseInt(a),0>a||isNaN(a))throw new Error("limit/offset must be >= 0");return a},f.prototype._sanitizeValue=function(c){var d,e;if(d=typeof c,null===c);else if("string"===d||"number"===d||"boolean"===d);else if(e=void 0!==b(c,this.options.valueHandlers,a.globalValueHandlers),!e)throw new Error("field value must be a string, number, boolean, null or one of the registered custom value types");return c},f.prototype._escapeValue=function(a){return a},f.prototype._formatCustomValue=function(c){var d;return d=b(c,this.options.valueHandlers,a.globalValueHandlers),d&&(c=d(c)),c},f.prototype._formatValue=function(a){return a=this._formatCustomValue(a),null===a?a="NULL":"boolean"==typeof a?a=a?"TRUE":"FALSE":"number"!=typeof a&&(a=this._escapeValue(a),a="'"+a+"'"),a},f}(a.Cloneable),a.Expression=function(a){function b(){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 c;return m(b,a),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 c(this.tree)},c=function(a){var b,d,e,f,g,h;for(e="",h=a.nodes,f=0,g=h.length;g>f;f++)b=h[f],null!=b.expr?d=b.expr:(d=c(b),""!==d&&(d="("+d+")")),""!==d&&(""!==e&&(e+=" "+b.type+" "),e+=d);return e},b.prototype.clone=function(){var a,b;return a=new this.constructor,(b=function(c){var d,e,f,g,h;for(g=c.nodes,h=[],e=0,f=g.length;f>e;e++)d=g[e],null!=d.expr?h.push(a.current.nodes.push(JSON.parse(JSON.stringify(d)))):(a._begin(d.type),b(d),h.push(!this.current===d?a.end():void 0));return h})(this.tree),a},b}(a.Cloneable),a.Block=function(b){function c(){return f=c.__super__.constructor.apply(this,arguments)}return m(c,b),c.prototype.exposedMethods=function(){var b,c,d;c={};for(b in this)d=this[b],"function"!=typeof d||"_"===b.charAt(0)||a.Block.prototype[b]||(c[b]=d);return c},c.prototype.buildStr=function(){return""},c.prototype.buildParam=function(a){return{text:this.buildStr(a),values:[]}},c}(a.BaseBuilder),a.StringBlock=function(a){function b(a,c){b.__super__.constructor.call(this,a),this.str=c}return m(b,a),b.prototype.buildStr=function(){return this.str},b}(a.Block),a.AbstractTableBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.tables=[]}return m(b,a),b.prototype._table=function(a,b){return null==b&&(b=null),b&&(b=this._sanitizeTableAlias(b)),a=this._sanitizeTable(a,this.options.allowNested||!1),this.options.singleTable&&(this.tables=[]),this.tables.push({table:a,alias:b})},b.prototype.buildStr=function(){var a,b,c,d,e;if(0>=this.tables.length)throw new Error("_table() needs to be called");for(b="",e=this.tables,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+="string"==typeof a.table?a.table:"("+a.table+")",a.alias&&(b+=" "+a.alias);return b},b}(a.Block),a.UpdateTableBlock=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.table=function(a,b){return null==b&&(b=null),this._table(a,b)},b}(a.AbstractTableBlock),a.FromTableBlock=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.from=function(a,b){return null==b&&(b=null),this._table(a,b)},b.prototype.buildStr=function(a){var c;if(0>=this.tables.length)throw new Error("from() needs to be called");return c=b.__super__.buildStr.call(this,a),"FROM "+c},b}(a.AbstractTableBlock),a.IntoTableBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.table=null}return m(b,a),b.prototype.into=function(a){return this.table=this._sanitizeTable(a,!1)},b.prototype.buildStr=function(){if(!this.table)throw new Error("into() needs to be called");return"INTO "+this.table},b}(a.Block),a.GetFieldBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this._fields=[]}return m(b,a),b.prototype.fields=function(a){var b,c,d;d=[];for(c in a)b=a[c],d.push(this.field(c,b));return d},b.prototype.field=function(a,b){return null==b&&(b=null),a=this._sanitizeField(a),b&&(b=this._sanitizeFieldAlias(b)),this._fields.push({name:a,alias:b})},b.prototype.buildStr=function(){var a,b,c,d,e;for(b="",e=this._fields,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=a.name,a.alias&&(b+=" AS "+a.alias);return""===b?"*":b},b}(a.Block),a.AbstractSetFieldBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.fields=[],this.values=[]}return m(b,a),b.prototype.set=function(a,b){var c;if(this.values.length>1)throw new Error("Cannot call set or setFields on multiple rows of fields.");return void 0!==b&&(b=this._sanitizeValue(b)),c=this.fields.indexOf(this._sanitizeField(a)),-1!==c?this.values[0][c]=b:(this.fields.push(this._sanitizeField(a)),c=this.fields.length-1,Array.isArray(this.values[0])?this.values[0][c]=b:this.values.push([b])),this},b.prototype.setFields=function(a){var b;if("object"!=typeof a)throw new Error("Expected an object but got "+typeof a);for(b in a)l.call(a,b)&&this.set(b,a[b]);return this},b.prototype.setFieldsRows=function(a){var b,c,d,e,f,g,h;if(!Array.isArray(a))throw new Error("Expected an array of objects but got "+typeof a);for(this.fields=[],this.values=[],c=f=0,g=a.length;g>=0?g>f:f>g;c=g>=0?++f:--f){h=a[c];for(b in h)if(l.call(h,b)){if(d=this.fields.indexOf(this._sanitizeField(b)),c>0&&-1===d)throw new Error("All fields in subsequent rows must match the fields in the first row");-1===d&&(this.fields.push(this._sanitizeField(b)),d=this.fields.length-1),e=this._sanitizeValue(a[c][b]),Array.isArray(this.values[c])?this.values[c][d]=e:this.values[c]=[e]}}return this},b.prototype.buildStr=function(){throw new Error("Not yet implemented")},b.prototype.buildParam=function(){throw new Error("Not yet implemented")},b}(a.Block),a.SetFieldBlock=function(a){function b(){return i=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.setFieldsRows=function(){throw new Error("Cannot call setFieldRows for an UPDATE SET")},b.prototype.buildStr=function(){var a,b,c,d,e,f;if(0>=this.fields.length)throw new Error("set() needs to be called");for(c="",b=e=0,f=this.fields.length;f>=0?f>e:e>f;b=f>=0?++e:--e)a=this.fields[b],""!==c&&(c+=", "),d=this.values[0][b],c+="undefined"==typeof d?a:""+a+" = "+this._formatValue(d);return"SET "+c},b.prototype.buildParam=function(){var a,b,c,d,e;if(0>=this.fields.length)throw new Error("set() needs to be called");for(b="",c=[],a=d=0,e=this.fields.length;e>=0?e>d:d>e;a=e>=0?++d:--d)""!==b&&(b+=", "),b+=""+this.fields[a]+" = ?",c.push(this._formatCustomValue(this.values[0][a]));return{text:"SET "+b,values:c}},b}(a.AbstractSetFieldBlock),a.InsertFieldValueBlock=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return m(b,a),b.prototype.buildStr=function(){var a,b,c,d,e,f,g,h;if(0>=this.fields.length)throw new Error("set() needs to be called");for(d=[],b=e=0,g=this.values.length;g>=0?g>e:e>g;b=g>=0?++e:--e)for(c=f=0,h=this.values[b].length;h>=0?h>f:f>h;c=h>=0?++f:--f)a=this._formatValue(this.values[b][c]),"string"==typeof d[b]?d[b]+=", "+a:d[b]=""+a;return"("+this.fields.join(", ")+") VALUES ("+d.join("), (")+")"},b.prototype.buildParam=function(){var a,b,c,d,e,f,g,h,i,j,k;if(0>=this.fields.length)throw new Error("set() needs to be called");for(d="",e=[],c=[],a=f=0,i=this.fields.length;i>=0?i>f:f>i;a=i>=0?++f:--f)""!==d&&(d+=", "),d+=this.fields[a];for(a=g=0,j=this.values.length;j>=0?j>g:g>j;a=j>=0?++g:--g)for(b=h=0,k=this.values[a].length;k>=0?k>h:h>k;b=k>=0?++h:--h)c.push(this._formatCustomValue(this.values[a][b])),"string"==typeof e[a]?e[a]+=", ?":e[a]="?";return{text:"("+d+") VALUES ("+e.join("), (")+")",values:c}},b}(a.AbstractSetFieldBlock),a.DistinctBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.useDistinct=!1}return m(b,a),b.prototype.distinct=function(){return this.useDistinct=!0},b.prototype.buildStr=function(){return this.useDistinct?"DISTINCT":""},b}(a.Block),a.GroupByBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.groups=[]}return m(b,a),b.prototype.group=function(a){return a=this._sanitizeField(a),this.groups.push(a)},b.prototype.buildStr=function(){var a,b,c,d,e;if(b="",0<this.groups.length){for(e=this.groups,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=a;b="GROUP BY "+b}return b},b}(a.Block),a.OffsetBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.offsets=null}return m(b,a),b.prototype.offset=function(a){return a=this._sanitizeLimitOffset(a),this.offsets=a},b.prototype.buildStr=function(){return this.offsets?"OFFSET "+this.offsets:""},b}(a.Block),a.WhereBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.wheres=[]}return m(b,a),b.prototype.where=function(){var a,b,c,d,e,f,g,h,i,j,l,m,n;for(b=arguments[0],i=2<=arguments.length?k.call(arguments,1):[],b=this._sanitizeCondition(b),c="",d=[],e=j=0,n=b.length;n>=0?n>j:j>n;e=n>=0?++j:--j)if(a=b.charAt(e),"?"===a&&0<i.length)if(h=i.shift(),Array.isArray(h)){for(f=[],l=0,m=h.length;m>l;l++)g=h[l],f.push(this._sanitizeValue(g));d=d.concat(f),c+="("+function(){var a,b,c;for(c=[],a=0,b=f.length;b>a;a++)g=f[a],c.push("?");return c}().join(", ")+")"}else c+="?",d.push(this._sanitizeValue(h));else c+=a;return""!==c?this.wheres.push({text:c,values:d}):void 0},b.prototype.buildStr=function(){var a,b,c,d,e,f,g,h,i;if(0>=this.wheres.length)return"";for(d="",h=this.wheres,e=0,g=h.length;g>e;e++)if(c=h[e],""!==d&&(d+=") AND ("),0<c.values.length)for(b=f=0,i=c.text.length;i>=0?i>f:f>i;b=i>=0?++f:--f)a=c.text.charAt(b),d+="?"===a?this._formatValue(c.values.shift()):a;else d+=c.text;return"WHERE ("+d+")"},b.prototype.buildParam=function(){var a,b,c,d,e,f,g,h,i,j;if(a={text:"",values:[]},0>=this.wheres.length)return a;for(d="",i=this.wheres,e=0,g=i.length;g>e;e++)for(c=i[e],""!==d&&(d+=") AND ("),d+=c.text,j=c.values,f=0,h=j.length;h>f;f++)b=j[f],a.values.push(this._formatCustomValue(b));return a.text="WHERE ("+d+")",a},b}(a.Block),a.OrderByBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.orders=[]}return m(b,a),b.prototype.order=function(a,b){return null==b&&(b=!0),a=this._sanitizeField(a),this.orders.push({field:a,dir:b?!0:!1})},b.prototype.buildStr=function(){var a,b,c,d,e;if(0<this.orders.length){for(b="",e=this.orders,c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=", "),b+=""+a.field+" "+(a.dir?"ASC":"DESC");return"ORDER BY "+b}return""},b}(a.Block),a.LimitBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.limits=null}return m(b,a),b.prototype.limit=function(a){return a=this._sanitizeLimitOffset(a),this.limits=a},b.prototype.buildStr=function(){return this.limits?"LIMIT "+this.limits:""},b}(a.Block),a.JoinBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.joins=[]}return m(b,a),b.prototype.join=function(a,b,c,d){return null==b&&(b=null),null==c&&(c=null),null==d&&(d="INNER"),a=this._sanitizeTable(a,!0),b&&(b=this._sanitizeTableAlias(b)),c&&(c=this._sanitizeCondition(c)),this.joins.push({type:d,table:a,alias:b,condition:c}),this},b.prototype.left_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"LEFT")},b.prototype.right_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"RIGHT")},b.prototype.outer_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"OUTER")},b.prototype.left_outer_join=function(a,b,c){return null==b&&(b=null),null==c&&(c=null),this.join(a,b,c,"LEFT OUTER")},b.prototype.buildStr=function(){var a,b,c,d,e;for(b="",e=this.joins||[],c=0,d=e.length;d>c;c++)a=e[c],""!==b&&(b+=" "),b+=""+a.type+" JOIN ",b+="string"==typeof a.table?a.table:"("+a.table+")",a.alias&&(b+=" "+a.alias),a.condition&&(b+=" ON ("+a.condition+")");return b},b}(a.Block),a.QueryBuilder=function(a){function b(a,c){var d,e,f,g,h,i,j,k,l=this;for(b.__super__.constructor.call(this,a),this.blocks=c||[],j=this.blocks,h=0,i=j.length;i>h;h++){d=j[h],k=d.exposedMethods(),g=function(a,b,c){return l[b]=function(){return c.apply(a,arguments),l}};for(f in k){if(e=k[f],null!=this[f])throw new Error(""+this._getObjectClassName(this)+" already has a builder method called: "+f);g(d,f,e)}}}return m(b,a),b.prototype.registerValueHandler=function(a,c){var d,e,f,g;for(g=this.blocks,e=0,f=g.length;f>e;e++)d=g[e],d.registerValueHandler(a,c);return b.__super__.registerValueHandler.call(this,a,c),this},b.prototype.updateOptions=function(a){var b,c,d,f,g;for(this.options=e({},this.options,a),f=this.blocks,g=[],c=0,d=f.length;d>c;c++)b=f[c],g.push(b.options=e({},b.options,a));return g},b.prototype.toString=function(){var a;return function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.buildStr(this));return e}.call(this).filter(function(a){return 0<a.length}).join(" ")},b.prototype.toParam=function(){var a,b,c,d,e;return d={text:"",values:[]},b=function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.buildParam(this));return e}.call(this),d.text=function(){var c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a.text);return e}().filter(function(a){return 0<a.length}).join(" "),d.values=(e=[]).concat.apply(e,function(){var c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a.values);return e}()),this.options.numberedParameters&&(c=0,d.text=d.text.replace(/\?/g,function(){return"$"+ ++c})),d},b.prototype.clone=function(){var a;return new this.constructor(this.options,function(){var b,c,d,e;for(d=this.blocks,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.clone());return e}.call(this))},b.prototype.isNestable=function(){return!1},b}(a.BaseBuilder),a.Select=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"SELECT"),new a.DistinctBlock(b),new a.GetFieldBlock(b),new a.FromTableBlock(e({},b,{allowNested:!0})),new a.JoinBlock(e({},b,{allowNested:!0})),new a.WhereBlock(b),new a.GroupByBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b),new a.OffsetBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c.prototype.isNestable=function(){return!0},c}(a.QueryBuilder),a.Update=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"UPDATE"),new a.UpdateTableBlock(b),new a.SetFieldBlock(b),new a.WhereBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),a.Delete=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"DELETE"),new a.FromTableBlock(e({},b,{singleTable:!0})),new a.JoinBlock(b),new a.WhereBlock(b),new a.OrderByBlock(b),new a.LimitBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),a.Insert=function(b){function c(b,d){null==d&&(d=null),d||(d=[new a.StringBlock(b,"INSERT"),new a.IntoTableBlock(b),new a.InsertFieldValueBlock(b)]),c.__super__.constructor.call(this,b,d)}return m(c,b),c}(a.QueryBuilder),d={VERSION:"3.1.2",expr:function(){return new a.Expression},select:function(b,c){return new a.Select(b,c)},update:function(b,c){return new a.Update(b,c)},insert:function(b,c){return new a.Insert(b,c)},"delete":function(b,c){return new a.Delete(b,c)},registerValueHandler:a.registerValueHandler},d.remove=d["delete"],d.cls=a,("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return d}):("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=d:"undefined"!=typeof window&&null!==window&&(window.squel=d),d.flavours={},d.useFlavour=function(a){if(!(d.flavours[a]instanceof Function))throw new Error("Flavour not available: "+a);return d.flavours[a].call(null,d),d}}).call(this); |
@@ -1409,3 +1409,3 @@ /* | ||
squel = { | ||
VERSION: '2.0.0', | ||
VERSION: '3.1.2', | ||
expr: function() { | ||
@@ -1412,0 +1412,0 @@ return new cls.Expression; |
127283
2776
369
16