Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replaced Makefile with Gruntfile.

  • Loading branch information...
commit 90e421b8115186ed012923de075ad19d61381794 1 parent 16f088c
@hiddentao authored
View
4 .travis.yml
@@ -6,10 +6,12 @@ node_js:
- "0.10"
before_script:
+ - "npm install -g grunt-cli"
+ - "npm install -g docco"
- "npm install"
script:
- - "make test"
+ - "grunt"
notifications:
email:
View
4 CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog for [squel](https://github.com/hiddentao/squel)
+## In progress...
+* Switched from Make to Grunt
+
+
## 10 Jun 2013 (1.1.3)
* Table names in SELECT queries can now be queries themselves (i.e. SQL sub statements)
View
64 Gruntfile.js
@@ -0,0 +1,64 @@
+'use strict';
+
+module.exports = function (grunt) {
+ require('load-grunt-tasks')(grunt);
+ require('time-grunt')(grunt);
+
+ grunt.initConfig({
+ clean: {
+ build: ['squel.js', 'squel.min.js'],
+ docs: 'docs'
+ },
+ coffee: {
+ build: {
+ files: [{
+ src: 'src/*.coffee',
+ dest: './squel.js'
+ }]
+ }
+ },
+ uglify: {
+ build: {
+ options: {
+ banner: '/*! squel | https://github.com/hiddentao/squel | BSD license */'
+ },
+ files: {
+ './squel.min.js': [ './squel.js' ]
+ }
+ }
+ },
+ mochaTest: {
+ test: {
+ options: {
+ reporter: 'spec',
+ ui: 'exports',
+ require: 'coffee-script'
+ },
+ src: ['test/*.test.coffee']
+ }
+ },
+ shell: {
+ docs: {
+ command: 'docco src/*.coffee'
+ }
+ }
+ });
+
+
+
+ grunt.registerTask('test', [
+ 'mochaTest'
+ ]);
+
+ grunt.registerTask('build', [
+ 'clean',
+ 'coffee:build',
+ 'uglify:build',
+ 'shell:docs'
+ ]);
+
+ grunt.registerTask('default', [
+ 'test',
+ 'build'
+ ]);
+};
View
33 Makefile
@@ -1,33 +0,0 @@
-BIN = node_modules/.bin
-TESTS = test/*.test.coffee
-
-
-all: docs squel.min.js
-
-
-squel.js: src/squel.coffee
- $(BIN)/coffee -c -o . $?
-
-squel.min.js: squel.js
- $(BIN)/uglifyjs -o $@ $?
-
-docs/squel.html: src/squel.coffee
- $(BIN)/docco $?
-
-
-test:
- $(BIN)/mocha $(TESTS)
-
-docs: docs/squel.html
-
-clean_docs:
- rm -rf docs
-
-clean_js:
- rm *.js
-
-clean: clean_docs clean_js
-
-
-.PHONY: test docs all clean clean_docs clean_js
-
View
23 README.md
@@ -249,25 +249,24 @@ Squel allows you to override the built-in query builders with your own as well a
// 'PRAGMA COMPRESS test'
-## Documentation
-
-Full API documentation is available at [http://squeljs.org/](http://squeljs.org/).
+## Building it
-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
-of [pygment](http://pygments.org/download/) installed in your local Python environment. Then do the following inside
-the project folder:
+We use Grunt to do the build and [docco](http://jashkenas.github.com/docco/) to build annotated source code docs.
+ $ npm install -g grunt-cli
+ $ npm install -g docco
$ npm install
- $ make docs
+ $ grunt <-- this will build the code and run the tests
-## Testing
+Annotated source code can be found in the `docs/` folder.
-Tests are written in [Mocha](http://visionmedia.github.com/mocha/) and can be found in the `test/` folder. To run them do the following:
+Tests are written in [Mocha](http://visionmedia.github.com/mocha/) and can be found in the `test/` folder. To run them:
- $ npm install
- $ make test
+ $ grunt test
+
+## Documentation
+Full documentation (guide and API) is available at [http://squeljs.org/](http://squeljs.org/).
## Contributing
View
2  bower.json
@@ -1,6 +1,6 @@
{
"name": "squel",
- "version": "1.1.3",
+ "version": "1.2",
"main": "squel.js",
"ignore": [
"**/.*",
View
606 docs/docco.css
@@ -1,186 +1,500 @@
-/*--------------------- Layout and Typography ----------------------------*/
+/*--------------------- Typography ----------------------------*/
+
+@font-face {
+ font-family: 'aller-light';
+ src: url('public/fonts/aller-light.eot');
+ src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'),
+ url('public/fonts/aller-light.woff') format('woff'),
+ url('public/fonts/aller-light.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'aller-bold';
+ src: url('public/fonts/aller-bold.eot');
+ src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'),
+ url('public/fonts/aller-bold.woff') format('woff'),
+ url('public/fonts/aller-bold.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'novecento-bold';
+ src: url('public/fonts/novecento-bold.eot');
+ src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
+ url('public/fonts/novecento-bold.woff') format('woff'),
+ url('public/fonts/novecento-bold.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+}
+
+/*--------------------- Layout ----------------------------*/
+html { height: 100%; }
body {
- font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
- font-size: 15px;
- line-height: 22px;
- color: #252519;
+ font-family: "aller-light";
+ font-size: 14px;
+ line-height: 18px;
+ color: #30404f;
margin: 0; padding: 0;
+ height:100%;
}
+#container { min-height: 100%; }
+
a {
- color: #261a3b;
+ color: #000;
}
- a:visited {
- color: #261a3b;
- }
-p {
- margin: 0 0 15px 0;
+
+b, strong {
+ font-weight: normal;
+ font-family: "aller-bold";
}
+
+p, ul, ol {
+ margin: 15px 0 0px;
+}
+
h1, h2, h3, h4, h5, h6 {
- margin: 0px 0 15px 0;
+ color: #112233;
+ line-height: 1em;
+ font-weight: normal;
+ font-family: "novecento-bold";
+ text-transform: uppercase;
+ margin: 30px 0 15px 0;
+}
+
+h1 {
+ margin-top: 40px;
+}
+
+hr {
+ border: 0;
+ background: 1px solid #ddd;
+ height: 1px;
+ margin: 20px 0;
+}
+
+pre, tt, code {
+ font-size: 12px; line-height: 16px;
+ font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
+ margin: 0; padding: 0;
+}
+ .annotation pre {
+ display: block;
+ margin: 0;
+ padding: 7px 10px;
+ background: #fcfcfc;
+ -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
+ -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
+ overflow-x: auto;
+ }
+ .annotation pre code {
+ border: 0;
+ padding: 0;
+ background: transparent;
+ }
+
+
+blockquote {
+ border-left: 5px solid #ccc;
+ margin: 0;
+ padding: 1px 0 1px 1em;
}
- h1 {
- margin-top: 40px;
+ .sections blockquote p {
+ font-family: Menlo, Consolas, Monaco, monospace;
+ font-size: 12px; line-height: 16px;
+ color: #999;
+ margin: 10px 0 0;
+ white-space: pre-wrap;
}
-#container {
- position: relative;
+
+ul.sections {
+ list-style: none;
+ padding:0 0 5px 0;;
+ margin:0;
}
-#background {
- position: fixed;
- top: 0; left: 525px; right: 0; bottom: 0;
- background: #f5f5ff;
- border-left: 1px solid #e5e5ee;
- z-index: -1;
+
+/*
+ Force border-box so that % widths fit the parent
+ container without overlap because of margin/padding.
+
+ More Info : http://www.quirksmode.org/css/box.html
+*/
+ul.sections > li > div {
+ -moz-box-sizing: border-box; /* firefox */
+ -ms-box-sizing: border-box; /* ie */
+ -webkit-box-sizing: border-box; /* webkit */
+ -khtml-box-sizing: border-box; /* konqueror */
+ box-sizing: border-box; /* css3 */
}
+
+
+/*---------------------- Jump Page -----------------------------*/
#jump_to, #jump_page {
+ margin: 0;
background: white;
-webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
-webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
- font: 10px Arial;
- text-transform: uppercase;
+ font: 16px Arial;
cursor: pointer;
text-align: right;
+ list-style: none;
+}
+
+#jump_to a {
+ text-decoration: none;
+}
+
+#jump_to a.large {
+ display: none;
+}
+#jump_to a.small {
+ font-size: 22px;
+ font-weight: bold;
+ color: #676767;
}
+
#jump_to, #jump_wrapper {
position: fixed;
right: 0; top: 0;
- padding: 5px 10px;
+ padding: 10px 15px;
+ margin:0;
+}
+
+#jump_wrapper {
+ display: none;
+ padding:0;
+}
+
+#jump_to:hover #jump_wrapper {
+ display: block;
+}
+
+#jump_page {
+ padding: 5px 0 3px;
+ margin: 0 0 25px 25px;
+}
+
+#jump_page .source {
+ display: block;
+ padding: 15px;
+ text-decoration: none;
+ border-top: 1px solid #eee;
+}
+
+#jump_page .source:hover {
+ background: #f5f5ff;
+}
+
+#jump_page .source:first-child {
+}
+
+/*---------------------- Low resolutions (> 320px) ---------------------*/
+@media only screen and (min-width: 320px) {
+ .pilwrap { display: none; }
+
+ ul.sections > li > div {
+ display: block;
+ padding:5px 10px 0 10px;
+ }
+
+ ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
+ padding-left: 30px;
+ }
+
+ ul.sections > li > div.content {
+ background: #f5f5ff;
+ overflow-x:auto;
+ -webkit-box-shadow: inset 0 0 5px #e5e5ee;
+ box-shadow: inset 0 0 5px #e5e5ee;
+ border: 1px solid #dedede;
+ margin:5px 10px 5px 10px;
+ padding-bottom: 5px;
+ }
+
+ ul.sections > li > div.annotation pre {
+ margin: 7px 0 7px;
+ padding-left: 15px;
+ }
+
+ ul.sections > li > div.annotation p tt, .annotation code {
+ background: #f8f8ff;
+ border: 1px solid #dedede;
+ font-size: 12px;
+ padding: 0 0.2em;
+ }
}
+
+/*---------------------- (> 481px) ---------------------*/
+@media only screen and (min-width: 481px) {
+ #container {
+ position: relative;
+ }
+ body {
+ background-color: #F5F5FF;
+ font-size: 15px;
+ line-height: 21px;
+ }
+ pre, tt, code {
+ line-height: 18px;
+ }
+ p, ul, ol {
+ margin: 0 0 15px;
+ }
+
+
+ #jump_to {
+ padding: 5px 10px;
+ }
#jump_wrapper {
padding: 0;
+ }
+ #jump_to, #jump_page {
+ font: 10px Arial;
+ text-transform: uppercase;
+ }
+ #jump_page .source {
+ padding: 5px 10px;
+ }
+ #jump_to a.large {
+ display: inline-block;
+ }
+ #jump_to a.small {
display: none;
}
- #jump_to:hover #jump_wrapper {
- display: block;
- }
- #jump_page {
- padding: 5px 0 3px;
- margin: 0 0 25px 25px;
- }
- #jump_page .source {
- display: block;
- padding: 5px 10px;
- text-decoration: none;
- border-top: 1px solid #eee;
- }
- #jump_page .source:hover {
- background: #f5f5ff;
- }
- #jump_page .source:first-child {
- }
-table td {
- border: 0;
- outline: 0;
-}
- td.docs, th.docs {
- max-width: 450px;
- min-width: 450px;
+
+
+
+ #background {
+ position: absolute;
+ top: 0; bottom: 0;
+ width: 350px;
+ background: #fff;
+ border-right: 1px solid #e5e5ee;
+ z-index: -1;
+ }
+
+ ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol {
+ padding-left: 40px;
+ }
+
+ ul.sections > li {
+ white-space: nowrap;
+ }
+
+ ul.sections > li > div {
+ display: inline-block;
+ }
+
+ ul.sections > li > div.annotation {
+ max-width: 350px;
+ min-width: 350px;
min-height: 5px;
- padding: 10px 25px 1px 50px;
+ padding: 13px;
overflow-x: hidden;
+ white-space: normal;
vertical-align: top;
text-align: left;
}
- .docs pre {
- margin: 15px 0 15px;
- padding-left: 15px;
- }
- .docs p tt, .docs p code {
- background: #f8f8ff;
- border: 1px solid #dedede;
- font-size: 12px;
- padding: 0 0.2em;
- }
- .pilwrap {
- position: relative;
- }
- .pilcrow {
- font: 12px Arial;
- text-decoration: none;
- color: #454545;
- position: absolute;
- top: 3px; left: -20px;
- padding: 1px 2px;
- opacity: 0;
- -webkit-transition: opacity 0.2s linear;
- }
- td.docs:hover .pilcrow {
- opacity: 1;
- }
- td.code, th.code {
- padding: 14px 15px 16px 25px;
- width: 100%;
+ ul.sections > li > div.annotation pre {
+ margin: 15px 0 15px;
+ padding-left: 15px;
+ }
+
+ ul.sections > li > div.content {
+ padding: 13px;
vertical-align: top;
background: #f5f5ff;
- border-left: 1px solid #e5e5ee;
+ border: none;
+ -webkit-box-shadow: none;
+ box-shadow: none;
}
- pre, tt, code {
- font-size: 12px; line-height: 18px;
- font-family: Monaco, Consolas, "Lucida Console", monospace;
- margin: 0; padding: 0;
+
+ .pilwrap {
+ position: relative;
+ display: inline;
+ }
+
+ .pilcrow {
+ font: 12px Arial;
+ text-decoration: none;
+ color: #454545;
+ position: absolute;
+ top: 3px; left: -20px;
+ padding: 1px 2px;
+ opacity: 0;
+ -webkit-transition: opacity 0.2s linear;
+ }
+ .for-h1 .pilcrow {
+ top: 47px;
+ }
+ .for-h2 .pilcrow, .for-h3 .pilcrow, .for-h4 .pilcrow {
+ top: 35px;
}
+ ul.sections > li > div.annotation:hover .pilcrow {
+ opacity: 1;
+ }
+}
+
+/*---------------------- (> 1025px) ---------------------*/
+@media only screen and (min-width: 1025px) {
+
+ body {
+ font-size: 16px;
+ line-height: 24px;
+ }
+
+ #background {
+ width: 525px;
+ }
+ ul.sections > li > div.annotation {
+ max-width: 525px;
+ min-width: 525px;
+ padding: 10px 25px 1px 50px;
+ }
+ ul.sections > li > div.content {
+ padding: 9px 15px 16px 25px;
+ }
+}
/*---------------------- Syntax Highlighting -----------------------------*/
+
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
-body .hll { background-color: #ffffcc }
-body .c { color: #408080; font-style: italic } /* Comment */
-body .err { border: 1px solid #FF0000 } /* Error */
-body .k { color: #954121 } /* Keyword */
-body .o { color: #666666 } /* Operator */
-body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-body .cp { color: #BC7A00 } /* Comment.Preproc */
-body .c1 { color: #408080; font-style: italic } /* Comment.Single */
-body .cs { color: #408080; font-style: italic } /* Comment.Special */
-body .gd { color: #A00000 } /* Generic.Deleted */
-body .ge { font-style: italic } /* Generic.Emph */
-body .gr { color: #FF0000 } /* Generic.Error */
-body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-body .gi { color: #00A000 } /* Generic.Inserted */
-body .go { color: #808080 } /* Generic.Output */
-body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-body .gs { font-weight: bold } /* Generic.Strong */
-body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-body .gt { color: #0040D0 } /* Generic.Traceback */
-body .kc { color: #954121 } /* Keyword.Constant */
-body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
-body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
-body .kp { color: #954121 } /* Keyword.Pseudo */
-body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
-body .kt { color: #B00040 } /* Keyword.Type */
-body .m { color: #666666 } /* Literal.Number */
-body .s { color: #219161 } /* Literal.String */
-body .na { color: #7D9029 } /* Name.Attribute */
-body .nb { color: #954121 } /* Name.Builtin */
-body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-body .no { color: #880000 } /* Name.Constant */
-body .nd { color: #AA22FF } /* Name.Decorator */
-body .ni { color: #999999; font-weight: bold } /* Name.Entity */
-body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-body .nf { color: #0000FF } /* Name.Function */
-body .nl { color: #A0A000 } /* Name.Label */
-body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-body .nt { color: #954121; font-weight: bold } /* Name.Tag */
-body .nv { color: #19469D } /* Name.Variable */
-body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-body .w { color: #bbbbbb } /* Text.Whitespace */
-body .mf { color: #666666 } /* Literal.Number.Float */
-body .mh { color: #666666 } /* Literal.Number.Hex */
-body .mi { color: #666666 } /* Literal.Number.Integer */
-body .mo { color: #666666 } /* Literal.Number.Oct */
-body .sb { color: #219161 } /* Literal.String.Backtick */
-body .sc { color: #219161 } /* Literal.String.Char */
-body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
-body .s2 { color: #219161 } /* Literal.String.Double */
-body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-body .sh { color: #219161 } /* Literal.String.Heredoc */
-body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-body .sx { color: #954121 } /* Literal.String.Other */
-body .sr { color: #BB6688 } /* Literal.String.Regex */
-body .s1 { color: #219161 } /* Literal.String.Single */
-body .ss { color: #19469D } /* Literal.String.Symbol */
-body .bp { color: #954121 } /* Name.Builtin.Pseudo */
-body .vc { color: #19469D } /* Name.Variable.Class */
-body .vg { color: #19469D } /* Name.Variable.Global */
-body .vi { color: #19469D } /* Name.Variable.Instance */
-body .il { color: #666666 } /* Literal.Number.Integer.Long */
+/*
+
+github.com style (c) Vasily Polovnyov <vast@whiteants.net>
+
+*/
+
+pre code {
+ display: block; padding: 0.5em;
+ color: #000;
+ background: #f8f8ff
+}
+
+pre .comment,
+pre .template_comment,
+pre .diff .header,
+pre .javadoc {
+ color: #408080;
+ font-style: italic
+}
+
+pre .keyword,
+pre .assignment,
+pre .literal,
+pre .css .rule .keyword,
+pre .winutils,
+pre .javascript .title,
+pre .lisp .title,
+pre .subst {
+ color: #954121;
+ /*font-weight: bold*/
+}
+
+pre .number,
+pre .hexcolor {
+ color: #40a070
+}
+
+pre .string,
+pre .tag .value,
+pre .phpdoc,
+pre .tex .formula {
+ color: #219161;
+}
+
+pre .title,
+pre .id {
+ color: #19469D;
+}
+pre .params {
+ color: #00F;
+}
+
+pre .javascript .title,
+pre .lisp .title,
+pre .subst {
+ font-weight: normal
+}
+
+pre .class .title,
+pre .haskell .label,
+pre .tex .command {
+ color: #458;
+ font-weight: bold
+}
+
+pre .tag,
+pre .tag .title,
+pre .rules .property,
+pre .django .tag .keyword {
+ color: #000080;
+ font-weight: normal
+}
+
+pre .attribute,
+pre .variable,
+pre .instancevar,
+pre .lisp .body {
+ color: #008080
+}
+
+pre .regexp {
+ color: #B68
+}
+
+pre .class {
+ color: #458;
+ font-weight: bold
+}
+
+pre .symbol,
+pre .ruby .symbol .string,
+pre .ruby .symbol .keyword,
+pre .ruby .symbol .keymethods,
+pre .lisp .keyword,
+pre .tex .special,
+pre .input_number {
+ color: #990073
+}
+
+pre .builtin,
+pre .constructor,
+pre .built_in,
+pre .lisp .title {
+ color: #0086b3
+}
+
+pre .preprocessor,
+pre .pi,
+pre .doctype,
+pre .shebang,
+pre .cdata {
+ color: #999;
+ font-weight: bold
+}
+
+pre .deletion {
+ background: #fdd
+}
+
+pre .addition {
+ background: #dfd
+}
+
+pre .diff .change {
+ background: #0086b3
+}
+
+pre .chunk {
+ color: #aaa
+}
+
+pre .tex .formula {
+ opacity: 0.5;
+}
View
2,859 docs/squel.html
2,312 additions, 547 deletions not shown
View
65 package.json
@@ -1,28 +1,41 @@
{
- "name" : "squel",
- "description" : "SQL query string builder",
- "version" : "1.1.3",
- "author" : "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
- "contributors" : [
- "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
- "nl_0 <nl.imbecile@gmail.com>"
- ],
- "dependencies": {},
- "devDependencies": {
- "coffee-script" : "1.6.x",
- "docco" : "0.6.x",
- "uglify-js" : "1.3.x",
- "chai" : "1.5.x",
- "mocha" : "1.9.x",
- "sinon" : "1.6.x",
- "underscore" : "1.4.x"
-},
- "keywords" : ["sql", "database", "rdbms"],
- "main" : "squel",
- "repository" : {
- "type" : "git",
- "url" : "https://github.com/hiddentao/squel.git"
- },
- "engines": { "node": ">= 0.6.0" }
+ "name": "squel",
+ "description": "SQL query string builder",
+ "version": "1.2",
+ "author": "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
+ "contributors": [
+ "Ramesh Nair <ram@hiddentao.com> (http://www.hiddentao.com/)",
+ "nl_0 <nl.imbecile@gmail.com>"
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "coffee-script": "~1.6.3",
+ "docco": "0.6.x",
+ "uglify-js": "1.3.x",
+ "chai": "1.5.x",
+ "mocha": "1.9.x",
+ "sinon": "1.6.x",
+ "underscore": "1.4.x",
+ "grunt-contrib-coffee": "~0.7.0",
+ "time-grunt": "~0.1.1",
+ "grunt-contrib-clean": "~0.5.0",
+ "load-grunt-tasks": "~0.1.0",
+ "grunt": "~0.4.1",
+ "grunt-contrib-uglify": "~0.2.4",
+ "grunt-mocha-test": "~0.6.3",
+ "grunt-shell": "~0.4.0"
+ },
+ "keywords": [
+ "sql",
+ "database",
+ "rdbms"
+ ],
+ "main": "squel",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/hiddentao/squel.git"
+ },
+ "engines": {
+ "node": ">= 0.6.0"
+ }
}
-
View
138 squel.js
@@ -1,5 +1,3 @@
-// Generated by CoffeeScript 1.3.3
-
/*
Copyright (c) 2012-2013 Ramesh Nair (hiddentao.com)
@@ -27,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
(function() {
- var cls, getValueHandler, registerValueHandler, squel, _extend,
+ var cls, getValueHandler, registerValueHandler, squel, _extend, _ref, _ref1, _ref2,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
@@ -106,7 +104,6 @@ OTHER DEALINGS IN THE SOFTWARE.
};
cls.Cloneable = (function() {
-
function Cloneable() {}
Cloneable.prototype.clone = function() {
@@ -120,7 +117,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})();
cls.BaseBuilder = (function(_super) {
-
__extends(BaseBuilder, _super);
function BaseBuilder(options) {
@@ -362,11 +358,11 @@ OTHER DEALINGS IN THE SOFTWARE.
})();
cls.Block = (function(_super) {
-
__extends(Block, _super);
function Block() {
- return Block.__super__.constructor.apply(this, arguments);
+ _ref = Block.__super__.constructor.apply(this, arguments);
+ return _ref;
}
Block.prototype.exposedMethods = function() {
@@ -390,7 +386,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.BaseBuilder);
cls.StringBlock = (function(_super) {
-
__extends(StringBlock, _super);
function StringBlock(options, str) {
@@ -407,7 +402,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.AbstractTableBlock = (function(_super) {
-
__extends(AbstractTableBlock, _super);
function AbstractTableBlock(options) {
@@ -433,14 +427,14 @@ OTHER DEALINGS IN THE SOFTWARE.
};
AbstractTableBlock.prototype.buildStr = function(queryBuilder) {
- var table, tables, _i, _len, _ref;
+ var table, tables, _i, _len, _ref1;
if (0 >= this.tables.length) {
throw new Error("_table() needs to be called");
}
tables = "";
- _ref = this.tables;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- table = _ref[_i];
+ _ref1 = this.tables;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ table = _ref1[_i];
if ("" !== tables) {
tables += ", ";
}
@@ -461,11 +455,11 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.UpdateTableBlock = (function(_super) {
-
__extends(UpdateTableBlock, _super);
function UpdateTableBlock() {
- return UpdateTableBlock.__super__.constructor.apply(this, arguments);
+ _ref1 = UpdateTableBlock.__super__.constructor.apply(this, arguments);
+ return _ref1;
}
UpdateTableBlock.prototype.table = function(table, alias) {
@@ -480,11 +474,11 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.AbstractTableBlock);
cls.FromTableBlock = (function(_super) {
-
__extends(FromTableBlock, _super);
function FromTableBlock() {
- return FromTableBlock.__super__.constructor.apply(this, arguments);
+ _ref2 = FromTableBlock.__super__.constructor.apply(this, arguments);
+ return _ref2;
}
FromTableBlock.prototype.from = function(table, alias) {
@@ -508,7 +502,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.AbstractTableBlock);
cls.IntoTableBlock = (function(_super) {
-
__extends(IntoTableBlock, _super);
function IntoTableBlock(options) {
@@ -532,7 +525,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.GetFieldBlock = (function(_super) {
-
__extends(GetFieldBlock, _super);
function GetFieldBlock(options) {
@@ -555,11 +547,11 @@ OTHER DEALINGS IN THE SOFTWARE.
};
GetFieldBlock.prototype.buildStr = function(queryBuilder) {
- var field, fields, _i, _len, _ref;
+ var field, fields, _i, _len, _ref3;
fields = "";
- _ref = this.fields;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- field = _ref[_i];
+ _ref3 = this.fields;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ field = _ref3[_i];
if ("" !== fields) {
fields += ", ";
}
@@ -580,7 +572,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.SetFieldBlock = (function(_super) {
-
__extends(SetFieldBlock, _super);
function SetFieldBlock(options) {
@@ -598,11 +589,11 @@ OTHER DEALINGS IN THE SOFTWARE.
SetFieldBlock.prototype.buildStr = function(queryBuilder) {
var field, fieldNames, fields, _i, _len;
fieldNames = (function() {
- var _ref, _results;
- _ref = this.fields;
+ var _ref3, _results;
+ _ref3 = this.fields;
_results = [];
- for (field in _ref) {
- if (!__hasProp.call(_ref, field)) continue;
+ for (field in _ref3) {
+ if (!__hasProp.call(_ref3, field)) continue;
_results.push(field);
}
return _results;
@@ -626,7 +617,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.InsertFieldValueBlock = (function(_super) {
-
__extends(InsertFieldValueBlock, _super);
function InsertFieldValueBlock(options) {
@@ -637,11 +627,11 @@ OTHER DEALINGS IN THE SOFTWARE.
InsertFieldValueBlock.prototype.buildStr = function(queryBuilder) {
var field, fieldNames, fields, name, values, _i, _len;
fieldNames = (function() {
- var _ref, _results;
- _ref = this.fields;
+ var _ref3, _results;
+ _ref3 = this.fields;
_results = [];
- for (name in _ref) {
- if (!__hasProp.call(_ref, name)) continue;
+ for (name in _ref3) {
+ if (!__hasProp.call(_ref3, name)) continue;
_results.push(name);
}
return _results;
@@ -670,7 +660,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.SetFieldBlock);
cls.DistinctBlock = (function(_super) {
-
__extends(DistinctBlock, _super);
function DistinctBlock(options) {
@@ -695,7 +684,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.GroupByBlock = (function(_super) {
-
__extends(GroupByBlock, _super);
function GroupByBlock(options) {
@@ -709,12 +697,12 @@ OTHER DEALINGS IN THE SOFTWARE.
};
GroupByBlock.prototype.buildStr = function(queryBuilder) {
- var f, groups, _i, _len, _ref;
+ var f, groups, _i, _len, _ref3;
groups = "";
if (0 < this.groups.length) {
- _ref = this.groups;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- f = _ref[_i];
+ _ref3 = this.groups;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ f = _ref3[_i];
if ("" !== groups) {
groups += ", ";
}
@@ -730,7 +718,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.OffsetBlock = (function(_super) {
-
__extends(OffsetBlock, _super);
function OffsetBlock(options) {
@@ -756,7 +743,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.WhereBlock = (function(_super) {
-
__extends(WhereBlock, _super);
function WhereBlock(options) {
@@ -800,7 +786,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.OrderByBlock = (function(_super) {
-
__extends(OrderByBlock, _super);
function OrderByBlock(options) {
@@ -820,12 +805,12 @@ OTHER DEALINGS IN THE SOFTWARE.
};
OrderByBlock.prototype.buildStr = function(queryBuilder) {
- var o, orders, _i, _len, _ref;
+ var o, orders, _i, _len, _ref3;
if (0 < this.orders.length) {
orders = "";
- _ref = this.orders;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- o = _ref[_i];
+ _ref3 = this.orders;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ o = _ref3[_i];
if ("" !== orders) {
orders += ", ";
}
@@ -842,7 +827,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.LimitBlock = (function(_super) {
-
__extends(LimitBlock, _super);
function LimitBlock(options) {
@@ -868,7 +852,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.JoinBlock = (function(_super) {
-
__extends(JoinBlock, _super);
function JoinBlock(options) {
@@ -933,11 +916,11 @@ OTHER DEALINGS IN THE SOFTWARE.
};
JoinBlock.prototype.buildStr = function(queryBuilder) {
- var j, joins, _i, _len, _ref;
+ var j, joins, _i, _len, _ref3;
joins = "";
- _ref = this.joins || [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- j = _ref[_i];
+ _ref3 = this.joins || [];
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ j = _ref3[_i];
if (joins !== "") {
joins += " ";
}
@@ -962,26 +945,25 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.Block);
cls.QueryBuilder = (function(_super) {
-
__extends(QueryBuilder, _super);
function QueryBuilder(options, blocks) {
- var block, methodBody, methodName, _fn, _i, _len, _ref, _ref1,
+ var block, methodBody, methodName, _fn, _i, _len, _ref3, _ref4,
_this = this;
QueryBuilder.__super__.constructor.call(this, options);
this.blocks = blocks || [];
- _ref = this.blocks;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- block = _ref[_i];
- _ref1 = block.exposedMethods();
+ _ref3 = this.blocks;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ block = _ref3[_i];
+ _ref4 = block.exposedMethods();
_fn = function(block, name, body) {
return _this[name] = function() {
body.apply(block, arguments);
return _this;
};
};
- for (methodName in _ref1) {
- methodBody = _ref1[methodName];
+ for (methodName in _ref4) {
+ methodBody = _ref4[methodName];
if (this[methodName] != null) {
throw new Error("" + (this._getObjectClassName(this)) + " already has a builder method called: " + methodName);
}
@@ -991,10 +973,10 @@ OTHER DEALINGS IN THE SOFTWARE.
}
QueryBuilder.prototype.registerValueHandler = function(type, handler) {
- var block, _i, _len, _ref;
- _ref = this.blocks;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- block = _ref[_i];
+ var block, _i, _len, _ref3;
+ _ref3 = this.blocks;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ block = _ref3[_i];
block.registerValueHandler(type, handler);
}
QueryBuilder.__super__.registerValueHandler.call(this, type, handler);
@@ -1002,12 +984,12 @@ OTHER DEALINGS IN THE SOFTWARE.
};
QueryBuilder.prototype.updateOptions = function(options) {
- var block, _i, _len, _ref, _results;
+ var block, _i, _len, _ref3, _results;
this.options = _extend({}, this.options, options);
- _ref = this.blocks;
+ _ref3 = this.blocks;
_results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- block = _ref[_i];
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ block = _ref3[_i];
_results.push(block.options = _extend({}, block.options, options));
}
return _results;
@@ -1016,11 +998,11 @@ OTHER DEALINGS IN THE SOFTWARE.
QueryBuilder.prototype.toString = function() {
var block;
return ((function() {
- var _i, _len, _ref, _results;
- _ref = this.blocks;
+ var _i, _len, _ref3, _results;
+ _ref3 = this.blocks;
_results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- block = _ref[_i];
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ block = _ref3[_i];
_results.push(block.buildStr(this));
}
return _results;
@@ -1032,11 +1014,11 @@ OTHER DEALINGS IN THE SOFTWARE.
QueryBuilder.prototype.clone = function() {
var block;
return new this.constructor(this.options, (function() {
- var _i, _len, _ref, _results;
- _ref = this.blocks;
+ var _i, _len, _ref3, _results;
+ _ref3 = this.blocks;
_results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- block = _ref[_i];
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ block = _ref3[_i];
_results.push(block.clone());
}
return _results;
@@ -1052,7 +1034,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.BaseBuilder);
cls.Select = (function(_super) {
-
__extends(Select, _super);
function Select(options, blocks) {
@@ -1078,7 +1059,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.QueryBuilder);
cls.Update = (function(_super) {
-
__extends(Update, _super);
function Update(options, blocks) {
@@ -1094,7 +1074,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.QueryBuilder);
cls.Delete = (function(_super) {
-
__extends(Delete, _super);
function Delete(options, blocks) {
@@ -1114,7 +1093,6 @@ OTHER DEALINGS IN THE SOFTWARE.
})(cls.QueryBuilder);
cls.Insert = (function(_super) {
-
__extends(Insert, _super);
function Insert(options, blocks) {
View
26 squel.min.js
@@ -1,25 +1 @@
-// Generated by CoffeeScript 1.3.3
-/*
-Copyright (c) 2012-2013 Ramesh Nair (hiddentao.com)
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/(function(){var e,t,n,r,i,s=[].slice,o={}.hasOwnProperty,u=function(e,t){function r(){this.constructor=e}for(var n in t)o.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};e={},i=function(){var e,t,n,r,i,u,a;e=arguments[0],n=2<=arguments.length?s.call(arguments,1):[];if(n)for(u=0,a=n.length;u<a;u++){r=n[u];if(r)for(t in r){if(!o.call(r,t))continue;i=r[t],e[t]=i}}return e},e.DefaultQueryBuilderOptions={autoQuoteTableNames:!1,autoQuoteFieldNames:!1,autoQuoteAliasNames:!0,nameQuoteCharacter:"`",tableAliasQuoteCharacter:"`",fieldAliasQuoteCharacter:'"',usingValuePlaceholders:!1,valueHandlers:[]},e.globalValueHandlers=[],n=function(e,t,n){var r,i,s;if("function"!=typeof t)throw new Error("type must be a class constructor");if("function"!=typeof n)throw new Error("handler must be a function");for(i=0,s=e.length;i<s;i++){r=e[i];if(r.type===t){r.handler=n;return}}return e.push({type:t,handler:n})},t=function(){var e,t,n,r,i,o,u,a;r=arguments[0],e=2<=arguments.length?s.call(arguments,1):[];for(i=0,u=e.length;i<u;i++){t=e[i];for(o=0,a=t.length;o<a;o++){n=t[o];if(r instanceof n.type)return n.handler}}return void 0},e.registerValueHandler=function(t,r){return n(e.globalValueHandlers,t,r)},e.Cloneable=function(){function e(){}return e.prototype.clone=function(){var e;return e=new this.constructor,i(e,JSON.parse(JSON.stringify(this)))},e}(),e.BaseBuilder=function(r){function s(t){var n;n=JSON.parse(JSON.stringify(e.DefaultQueryBuilderOptions)),this.options=i({},n,t)}return u(s,r),s.prototype.registerValueHandler=function(e,t){return n(this.options.valueHandlers,e,t),this},s.prototype._getObjectClassName=function(e){var t;if(e&&e.constructor&&e.constructor.toString){t=e.constructor.toString().match(/function\s*(\w+)/);if(t&&t.length===2)return t[1]}return void 0},s.prototype._sanitizeCondition=function(t){t instanceof e.Expression&&(t=t.toString());if("string"!=typeof t)throw new Error("condition must be a string or Expression instance");return t},s.prototype._sanitizeName=function(e,t){if("string"!=typeof e)throw new Error(""+t+" must be a string");return e},s.prototype._sanitizeField=function(e){var t;return t=this._sanitizeName(e,"field name"),this.options.autoQuoteFieldNames?""+this.options.nameQuoteCharacter+t+this.options.nameQuoteCharacter:t},s.prototype._sanitizeTable=function(t,n){var r;n==null&&(n=!1);if(n){if("string"!=typeof t){if(t instanceof e.QueryBuilder&&t.isNestable())return t;throw new Error("table name must be a string or a nestable query instance")}r=t}else r=this._sanitizeName(t,"table name");return this.options.autoQuoteTableNames?""+this.options.nameQuoteCharacter+r+this.options.nameQuoteCharacter:r},s.prototype._sanitizeTableAlias=function(e){var t;return t=this._sanitizeName(e,"table alias"),this.options.autoQuoteAliasNames?""+this.options.tableAliasQuoteCharacter+t+this.options.tableAliasQuoteCharacter:t},s.prototype._sanitizeFieldAlias=function(e){var t;return t=this._sanitizeName(e,"field alias"),this.options.autoQuoteAliasNames?""+this.options.fieldAliasQuoteCharacter+t+this.options.fieldAliasQuoteCharacter:t},s.prototype._sanitizeLimitOffset=function(e){e=parseInt(e);if(0>e||isNaN(e))throw new Error("limit/offset must be >= 0");return e},s.prototype._sanitizeValue=function(n){var r,i;r=typeof n;if(null!==n&&"string"!==r&&"number"!==r&&"boolean"!==r){i=void 0!==t(n,this.options.valueHandlers,e.globalValueHandlers);if(!i)throw new Error("field value must be a string, number, boolean, null or one of the registered custom value types")}return n},s.prototype._formatValue=function(n){var r;return r=t(n,this.options.valueHandlers,e.globalValueHandlers),r&&(n=r(n)),null===n?n="NULL":"boolean"==typeof n?n=n?"TRUE":"FALSE":"number"!=typeof n&&!1===this.options.usingValuePlaceholders&&(n="'"+n+"'"),n},s}(e.Cloneable),e.Expression=function(){function t(){var e=this;this.tree={parent:null,nodes:[]},this.current=this.tree,this._begin=function(t){var n;return n={type:t,parent:e.current,nodes:[]},e.current.nodes.push(n),e.current=e.current.nodes[e.current.nodes.length-1],e}}var e;return t.prototype.tree=null,t.prototype.current=null,t.prototype.and_begin=function(){return this._begin("AND")},t.prototype.or_begin=function(){return this._begin("OR")},t.prototype.end=function(){if(!this.current.parent)throw new Error("begin() needs to be called");return this.current=this.current.parent,this},t.prototype.and=function(e){if(!e||"string"!=typeof e)throw new Error("expr must be a string");return this.current.nodes.push({type:"AND",expr:e}),this},t.prototype.or=function(e){if(!e||"string"!=typeof e)throw new Error("expr must be a string");return this.current.nodes.push({type:"OR",expr:e}),this},t.prototype.toString=function(){if(null!==this.current.parent)throw new Error("end() needs to be called");return e(this.tree)},e=function(t){var n,r,i,s,o,u;i="",u=t.nodes;for(s=0,o=u.length;s<o;s++)n=u[s],n.expr!=null?r=n.expr:(r=e(n),""!==r&&(r="("+r+")")),""!==r&&(""!==i&&(i+=" "+n.type+" "),i+=r);return i},t}(),e.Block=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return u(n,t),n.prototype.exposedMethods=function(){var t,n,r;n={};for(t in this)r=this[t],typeof r=="function"&&t.charAt(0)!=="_"&&!e.Block.prototype[t]&&(n[t]=r);return n},n.prototype.buildStr=function(e){return""},n}(e.BaseBuilder),e.StringBlock=function(e){function t(e,n){t.__super__.constructor.call(this,e),this.str=n}return u(t,e),t.prototype.buildStr=function(e){return this.str},t}(e.Block),e.AbstractTableBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.tables=[]}return u(t,e),t.prototype._table=function(e,t){return t==null&&(t=null),t&&(t=this._sanitizeTableAlias(t)),e=this._sanitizeTable(e,this.options.allowNested||!1),this.options.singleTable&&(this.tables=[]),this.tables.push({table:e,alias:t})},t.prototype.buildStr=function(e){var t,n,r,i,s;if(0>=this.tables.length)throw new Error("_table() needs to be called");n="",s=this.tables;for(r=0,i=s.length;r<i;r++)t=s[r],""!==n&&(n+=", "),"string"==typeof t.table?n+=t.table:n+="("+t.table+")",t.alias&&(n+=" "+t.alias);return n},t}(e.Block),e.UpdateTableBlock=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return u(t,e),t.prototype.table=function(e,t){return t==null&&(t=null),this._table(e,t)},t}(e.AbstractTableBlock),e.FromTableBlock=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return u(t,e),t.prototype.from=function(e,t){return t==null&&(t=null),this._table(e,t)},t.prototype.buildStr=function(e){var n;if(0>=this.tables.length)throw new Error("from() needs to be called");return n=t.__super__.buildStr.call(this,e),"FROM "+n},t}(e.AbstractTableBlock),e.IntoTableBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.table=null}return u(t,e),t.prototype.into=function(e){return this.table=this._sanitizeTable(e,!1)},t.prototype.buildStr=function(e){if(!this.table)throw new Error("into() needs to be called");return"INTO "+this.table},t}(e.Block),e.GetFieldBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.fields=[]}return u(t,e),t.prototype.field=function(e,t){return t==null&&(t=null),e=this._sanitizeField(e),t&&(t=this._sanitizeFieldAlias(t)),this.fields.push({name:e,alias:t})},t.prototype.buildStr=function(e){var t,n,r,i,s;n="",s=this.fields;for(r=0,i=s.length;r<i;r++)t=s[r],""!==n&&(n+=", "),n+=t.name,t.alias&&(n+=" AS "+t.alias);return""===n?"*":n},t}(e.Block),e.SetFieldBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.fields={}}return u(t,e),t.prototype.set=function(e,t){return e=this._sanitizeField(e),t=this._sanitizeValue(t),this.fields[e]=t,this},t.prototype.buildStr=function(e){var t,n,r,i,s;n=function(){var e,n;e=this.fields,n=[];for(t in e){if(!o.call(e,t))continue;n.push(t)}return n}.call(this);if(0>=n.length)throw new Error("set() needs to be called");r="";for(i=0,s=n.length;i<s;i++)t=n[i],""!==r&&(r+=", "),r+=""+t+" = "+this._formatValue(this.fields[t]);return"SET "+r},t}(e.Block),e.InsertFieldValueBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.fields={}}return u(t,e),t.prototype.buildStr=function(e){var t,n,r,i,s,u,a;n=function(){var e,t;e=this.fields,t=[];for(i in e){if(!o.call(e,i))continue;t.push(i)}return t}.call(this);if(0>=n.length)throw new Error("set() needs to be called");r="",s="";for(u=0,a=n.length;u<a;u++)t=n[u],""!==r&&(r+=", "),r+=t,""!==s&&(s+=", "),s+=this._formatValue(this.fields[t]);return"("+r+") VALUES ("+s+")"},t}(e.SetFieldBlock),e.DistinctBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.useDistinct=!1}return u(t,e),t.prototype.distinct=function(){return this.useDistinct=!0},t.prototype.buildStr=function(e){return this.useDistinct?"DISTINCT":""},t}(e.Block),e.GroupByBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.groups=[]}return u(t,e),t.prototype.group=function(e){return e=this._sanitizeField(e),this.groups.push(e)},t.prototype.buildStr=function(e){var t,n,r,i,s;n="";if(0<this.groups.length){s=this.groups;for(r=0,i=s.length;r<i;r++)t=s[r],""!==n&&(n+=", "),n+=t;n="GROUP BY "+n}return n},t}(e.Block),e.OffsetBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.offsets=null}return u(t,e),t.prototype.offset=function(e){return e=this._sanitizeLimitOffset(e),this.offsets=e},t.prototype.buildStr=function(e){return this.offsets?"OFFSET "+this.offsets:""},t}(e.Block),e.WhereBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.wheres=[]}return u(t,e),t.prototype.where=function(){var e,t,n,r,i,o,u,a,f;e=arguments[0],i=2<=arguments.length?s.call(arguments,1):[],e=this._sanitizeCondition(e);for(o=0,a=i.length;o<a;o++){r=i[o];if(Array.isArray(r)){t=[];for(u=0,f=r.length;u<f;u++)n=r[u],t.push(this._formatValue(this._sanitizeValue(n)));r="("+t.join(", ")+")"}else r=this._formatValue(this._sanitizeValue(r));e=e.replace("?",r)}if(""!==e)return this.wheres.push(e)},t.prototype.buildStr=function(e){return 0<this.wheres.length?"WHERE ("+this.wheres.join(") AND (")+")":""},t}(e.Block),e.OrderByBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.orders=[]}return u(t,e),t.prototype.order=function(e,t){return t==null&&(t=!0),e=this._sanitizeField(e),this.orders.push({field:e,dir:t?!0:!1})},t.prototype.buildStr=function(e){var t,n,r,i,s;if(0<this.orders.length){n="",s=this.orders;for(r=0,i=s.length;r<i;r++)t=s[r],""!==n&&(n+=", "),n+=""+t.field+" "+(t.dir?"ASC":"DESC");return"ORDER BY "+n}return""},t}(e.Block),e.LimitBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.limits=null}return u(t,e),t.prototype.limit=function(e){return e=this._sanitizeLimitOffset(e),this.limits=e},t.prototype.buildStr=function(e){return this.limits?"LIMIT "+this.limits:""},t}(e.Block),e.JoinBlock=function(e){function t(e){t.__super__.constructor.call(this,e),this.joins=[]}return u(t,e),t.prototype.join=function(e,t,n,r){return t==null&&(t=null),n==null&&(n=null),r==null&&(r="INNER"),e=this._sanitizeTable(e,!0),t&&(t=this._sanitizeTableAlias(t)),n&&(n=this._sanitizeCondition(n)),this.joins.push({type:r,table:e,alias:t,condition:n}),this},t.prototype.left_join=function(e,t,n){return t==null&&(t=null),n==null&&(n=null),this.join(e,t,n,"LEFT")},t.prototype.right_join=function(e,t,n){return t==null&&(t=null),n==null&&(n=null),this.join(e,t,n,"RIGHT")},t.prototype.outer_join=function(e,t,n){return t==null&&(t=null),n==null&&(n=null),this.join(e,t,n,"OUTER")},t.prototype.buildStr=function(e){var t,n,r,i,s;n="",s=this.joins||[];for(r=0,i=s.length;r<i;r++)t=s[r],n!==""&&(n+=" "),n+=""+t.type+" JOIN ","string"==typeof t.table?n+=t.table:n+="("+t.table+")",t.alias&&(n+=" "+t.alias),t.condition&&(n+=" ON ("+t.condition+")");return n},t}(e.Block),e.QueryBuilder=function(e){function t(e,n){var r,i,s,o,u,a,f,l,c=this;t.__super__.constructor.call(this,e),this.blocks=n||[],f=this.blocks;for(u=0,a=f.length;u<a;u++){r=f[u],l=r.exposedMethods(),o=function(e,t,n){return c[t]=function(){return n.apply(e,arguments),c}};for(s in l){i=l[s];if(this[s]!=null)throw new Error(""+this._getObjectClassName(this)+" already has a builder method called: "+s);o(r,s,i)}}}return u(t,e),t.prototype.registerValueHandler=function(e,n){var r,i,s,o;o=this.blocks;for(i=0,s=o.length;i<s;i++)r=o[i],r.registerValueHandler(e,n);return t.__super__.registerValueHandler.call(this,e,n),this},t.prototype.updateOptions=function(e){var t,n,r,s,o;this.options=i({},this.options,e),s=this.blocks,o=[];for(n=0,r=s.length;n<r;n++)t=s[n],o.push(t.options=i({},t.options,e));return o},t.prototype.toString=function(){var e;return function(){var t,n,r,i;r=this.blocks,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.buildStr(this));return i}.call(this).filter(function(e){return 0<e.length}).join(" ")},t.prototype.clone=function(){var e;return new this.constructor(this.options,function(){var t,n,r,i;r=this.blocks,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.clone());return i}.call(this))},t.prototype.isNestable=function(){return!1},t}(e.BaseBuilder),e.Select=function(t){function n(t,r){r==null&&(r=null),r||(r=[new e.StringBlock(t,"SELECT"),new e.DistinctBlock(t),new e.GetFieldBlock(t),new e.FromTableBlock(i({},t,{allowNested:!0})),new e.JoinBlock(i({},t,{allowNested:!0})),new e.WhereBlock(t),new e.GroupByBlock(t),new e.OrderByBlock(t),new e.LimitBlock(t),new e.OffsetBlock(t)]),n.__super__.constructor.call(this,t,r)}return u(n,t),n.prototype.isNestable=function(){return!0},n}(e.QueryBuilder),e.Update=function(t){function n(t,r){r==null&&(r=null),r||(r=[new e.StringBlock(t,"UPDATE"),new e.UpdateTableBlock(t),new e.SetFieldBlock(t),new e.WhereBlock(t),new e.OrderByBlock(t),new e.LimitBlock(t)]),n.__super__.constructor.call(this,t,r)}return u(n,t),n}(e.QueryBuilder),e.Delete=function(t){function n(t,r){r==null&&(r=null),r||(r=[new e.StringBlock(t,"DELETE"),new e.FromTableBlock(i({},t,{singleTable:!0})),new e.JoinBlock(t),new e.WhereBlock(t),new e.OrderByBlock(t),new e.LimitBlock(t)]),n.__super__.constructor.call(this,t,r)}return u(n,t),n}(e.QueryBuilder),e.Insert=function(t){function n(t,r){r==null&&(r=null),r||(r=[new e.StringBlock(t,"INSERT"),new e.IntoTableBlock(t),new e.InsertFieldValueBlock(t)]),n.__super__.constructor.call(this,t,r)}return u(n,t),n}(e.QueryBuilder),r={expr:function(){return new e.Expression},select:function(t,n){return new e.Select(t,n)},update:function(t,n){return new e.Update(t,n)},insert:function(t,n){return new e.Insert(t,n)},"delete":function(t,n){return new e.Delete(t,n)},registerValueHandler:e.registerValueHandler},r.remove=r["delete"],r.cls=e,(typeof define!="undefined"&&define!==null?define.amd:void 0)?define(function(){return r}):(typeof module!="undefined"&&module!==null?module.exports:void 0)?module.exports=r:typeof window!="undefined"&&window!==null&&(window.squel=r)}).call(this);
+/*! squel | https://github.com/hiddentao/squel | BSD license */(function(){var a,b,c,d,e,f,g,h,i=[].slice,j={}.hasOwnProperty,k=function(a,b){function c(){this.constructor=a}for(var d in b)j.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?i.call(arguments,1):[])for(f=0,g=c.length;g>f;f++)if(d=c[f])for(b in d)j.call(d,b)&&(e=d[b],a[b]=e);return a},a.DefaultQueryBuilderOptions={autoQuoteTableNames:!1,autoQuoteFieldNames:!1,autoQuoteAliasNames:!0,nameQuoteCharacter:"`",tableAliasQuoteCharacter:"`",fieldAliasQuoteCharacter:'"',usingValuePlaceholders:!1,valueHandlers:[]},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 d.handler=c,void 0;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?i.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 k(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._formatValue=function(c){var d;return d=b(c,this.options.valueHandlers,a.globalValueHandlers),d&&(c=d(c)),null===c?c="NULL":"boolean"==typeof c?c=c?"TRUE":"FALSE":"number"!=typeof c&&!1===this.options.usingValuePlaceholders&&(c="'"+c+"'"),c},f}(a.Cloneable),a.Expression=function(){function a(){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 b;return a.prototype.tree=null,a.prototype.current=null,a.prototype.and_begin=function(){return this._begin("AND")},a.prototype.or_begin=function(){return this._begin("OR")},a.prototype.end=function(){if(!this.current.parent)throw new Error("begin() needs to be called");return this.current=this.current.parent,this},a.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},a.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},a.prototype.toString=function(){if(null!==this.current.parent)throw new Error("end() needs to be called");return b(this.tree)},b=function(a){var c,d,e,f,g,h;for(e="",h=a.nodes,f=0,g=h.length;g>f;f++)c=h[f],null!=c.expr?d=c.expr:(d=b(c),""!==d&&(d="("+d+")")),""!==d&&(""!==e&&(e+=" "+c.type+" "),e+=d);return e},a}(),a.Block=function(b){function c(){return f=c.__super__.constructor.apply(this,arguments)}return k(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}(a.BaseBuilder),a.StringBlock=function(a){function b(a,c){b.__super__.constructor.call(this,a),this.str=c}return k(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 k(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 k(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 k(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 k(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 k(b,a),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.SetFieldBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.fields={}}return k(b,a),b.prototype.set=function(a,b){return a=this._sanitizeField(a),b=this._sanitizeValue(b),this.fields[a]=b,this},b.prototype.buildStr=function(){var a,b,c,d,e;if(b=function(){var b,c;b=this.fields,c=[];for(a in b)j.call(b,a)&&c.push(a);return c}.call(this),0>=b.length)throw new Error("set() needs to be called");for(c="",d=0,e=b.length;e>d;d++)a=b[d],""!==c&&(c+=", "),c+=""+a+" = "+this._formatValue(this.fields[a]);return"SET "+c},b}(a.Block),a.InsertFieldValueBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.fields={}}return k(b,a),b.prototype.buildStr=function(){var a,b,c,d,e,f,g;if(b=function(){var a,b;a=this.fields,b=[];for(d in a)j.call(a,d)&&b.push(d);return b}.call(this),0>=b.length)throw new Error("set() needs to be called");for(c="",e="",f=0,g=b.length;g>f;f++)a=b[f],""!==c&&(c+=", "),c+=a,""!==e&&(e+=", "),e+=this._formatValue(this.fields[a]);return"("+c+") VALUES ("+e+")"},b}(a.SetFieldBlock),a.DistinctBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.useDistinct=!1}return k(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 k(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 k(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 k(b,a),b.prototype.where=function(){var a,b,c,d,e,f,g,h,j;for(a=arguments[0],e=2<=arguments.length?i.call(arguments,1):[],a=this._sanitizeCondition(a),f=0,h=e.length;h>f;f++){if(d=e[f],Array.isArray(d)){for(b=[],g=0,j=d.length;j>g;g++)c=d[g],b.push(this._formatValue(this._sanitizeValue(c)));d="("+b.join(", ")+")"}else d=this._formatValue(this._sanitizeValue(d));a=a.replace("?",d)}return""!==a?this.wheres.push(a):void 0},b.prototype.buildStr=function(){return 0<this.wheres.length?"WHERE ("+this.wheres.join(") AND (")+")":""},b}(a.Block),a.OrderByBlock=function(a){function b(a){b.__super__.constructor.call(this,a),this.orders=[]}return k(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 k(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 k(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.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 k(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.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 k(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 k(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 k(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 k(c,b),c}(a.QueryBuilder),d={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)}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.