Update docs
This commit is contained in:
parent
da085f9e14
commit
d19ec16b8d
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -88,6 +92,15 @@ module.exports = {
|
||||
*/
|
||||
execute: function(sql, params, callback) {
|
||||
throw new Error("Correct adapter not defined for query execution");
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the connection that is open on the current adapter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
close: function() {
|
||||
throw new Error("Close method not defined for the current adapter");
|
||||
}
|
||||
};</pre>
|
||||
</article>
|
||||
@ -110,7 +123,7 @@ module.exports = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -95,6 +99,8 @@ var d = {
|
||||
* @private
|
||||
*/
|
||||
_quote: function(str) {
|
||||
//if (/[0-9]+|\'(.*?)\'/ig.test(str)) return str;
|
||||
|
||||
return (helpers.isString(str) && ! (str.startsWith(d.identifierChar) || str.endsWith(d.identifierChar)))
|
||||
? d.identifierChar + str + d.identifierChar
|
||||
: str;
|
||||
@ -146,6 +152,12 @@ var d = {
|
||||
return str.map(d.quoteIdentifiers);
|
||||
}
|
||||
|
||||
if ( ! helpers.isString(str))
|
||||
{
|
||||
console.error(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// Handle commas
|
||||
if (str.contains(','))
|
||||
{
|
||||
@ -252,7 +264,7 @@ module.exports = d;</pre>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -213,7 +217,7 @@ module.exports = h;</pre>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -153,7 +157,7 @@ query.select('foo')
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
259
docs/module-State.html
Normal file
259
docs/module-State.html
Normal file
@ -0,0 +1,259 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>DocStrap Module: State</title>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="index.html">DocStrap</a>
|
||||
<ul class="nav">
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
|
||||
class="caret"></b></a>
|
||||
|
||||
<ul class="dropdown-menu ">
|
||||
|
||||
<li>
|
||||
<a href="module-adapter.html">adapter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-driver.html">driver</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-helpers.html">helpers</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-node-query.html">node-query</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-query-builder.html">query-builder</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
|
||||
<div class="span8">
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
|
||||
<h1 class="page-title">Module: State</h1>
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<h2>
|
||||
State
|
||||
</h2>
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="state.js.html">state.js</a>,
|
||||
<a href="state.js.html#sunlight-1-line-3">line 3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<footer>
|
||||
|
||||
|
||||
<span class="copyright">
|
||||
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="span3">
|
||||
<div id="toc"></div>
|
||||
</div>
|
||||
|
||||
<br clear="both">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--<script src="scripts/sunlight.js"></script>-->
|
||||
<script src="scripts/docstrap.lib.js"></script>
|
||||
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||
<script src="scripts/toc.js"></script>
|
||||
|
||||
<script>
|
||||
$( function () {
|
||||
$( "[id*='$']" ).each( function () {
|
||||
var $this = $( this );
|
||||
|
||||
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
|
||||
} );
|
||||
|
||||
$( "#toc" ).toc( {
|
||||
anchorName : function ( i, heading, prefix ) {
|
||||
return $( heading ).attr( "id" ) || ( prefix + i );
|
||||
},
|
||||
selectors : "h1,h2,h3,h4",
|
||||
showAndHide : false,
|
||||
scrollTo : "100px"
|
||||
} );
|
||||
|
||||
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||
$( '.dropdown-toggle' ).dropdown();
|
||||
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
|
||||
|
||||
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
|
||||
var $this = $( this );
|
||||
|
||||
var example = $this.find( "code" );
|
||||
exampleText = example.html();
|
||||
var lang = /{@lang (.*?)}/.exec( exampleText );
|
||||
if ( lang && lang[1] ) {
|
||||
exampleText = exampleText.replace( lang[0], "" );
|
||||
example.html( exampleText );
|
||||
lang = lang[1];
|
||||
} else {
|
||||
lang = "javascript";
|
||||
}
|
||||
|
||||
if ( lang ) {
|
||||
|
||||
$this
|
||||
.addClass( "sunlight-highlight-" + lang )
|
||||
.addClass( "linenums" )
|
||||
.html( example.html() );
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
Sunlight.highlightAll( {
|
||||
lineNumbers : true,
|
||||
showMenu : true,
|
||||
enableDoclinks : true
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!--Navigation and Symbol Display-->
|
||||
|
||||
|
||||
|
||||
<!--Google Analytics-->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -148,6 +152,93 @@
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="close"><span class="type-signature"><static> </span>close<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Close the connection that is open on the current adapter</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="adapter.js.html">adapter.js</a>,
|
||||
<a href="adapter.js.html#sunlight-1-line-23">line 23</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>void</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="execute"><span class="type-signature"><static> </span>execute<span class="signature">(sql, params, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
@ -354,7 +445,7 @@
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -170,7 +174,7 @@
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -1027,7 +1031,7 @@ in the passed array</p>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -485,7 +489,7 @@
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -188,7 +192,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-12">line 12</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-13">line 13</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -383,7 +387,94 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-879">line 879</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-859">line 859</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>void</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="end"><span class="type-signature"></span>end<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Closes the database connection for the current adapter</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-347">line 347</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -519,7 +610,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-415">line 415</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-395">line 395</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -764,7 +855,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-801">line 801</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-781">line 781</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -955,7 +1046,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-941">line 941</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-921">line 921</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1154,7 +1245,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-919">line 919</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-899">line 899</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1355,7 +1446,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-902">line 902</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-882">line 882</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1546,7 +1637,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-930">line 930</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-910">line 910</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1641,7 +1732,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-362">line 362</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-338">line 338</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1788,7 +1879,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-683">line 683</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-663">line 663</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1875,7 +1966,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-782">line 782</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-762">line 762</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1962,7 +2053,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-746">line 746</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-726">line 726</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2147,7 +2238,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-488">line 488</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-468">line 468</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2357,7 +2448,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-824">line 824</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-804">line 804</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2539,7 +2630,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-844">line 844</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-824">line 824</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2771,7 +2862,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-658">line 658</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-638">line 638</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -2997,7 +3088,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-437">line 437</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-417">line 417</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3176,7 +3267,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-734">line 734</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-714">line 714</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3402,7 +3493,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-450">line 450</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-430">line 430</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3593,7 +3684,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-706">line 706</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-686">line 686</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3681,7 +3772,7 @@ prefixed with 'OR'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-759">line 759</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-739">line 739</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -3866,7 +3957,7 @@ prefixed with 'OR'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-502">line 502</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-482">line 482</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4092,7 +4183,7 @@ prefixed with 'OR'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-463">line 463</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-443">line 443</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4180,7 +4271,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-771">line 771</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-751">line 751</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4406,7 +4497,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-476">line 476</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-456">line 456</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4591,7 +4682,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-528">line 528</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-508">line 508</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4750,7 +4841,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-596">line 596</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-576">line 576</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -4886,7 +4977,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-572">line 572</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-552">line 552</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5022,7 +5113,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-561">line 561</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-541">line 541</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5181,7 +5272,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-620">line 620</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-600">line 600</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5320,7 +5411,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-381">line 381</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-361">line 361</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5502,7 +5593,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-632">line 632</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-612">line 612</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5712,7 +5803,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-860">line 860</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-840">line 840</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5897,7 +5988,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-516">line 516</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-496">line 496</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -6056,7 +6147,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-584">line 584</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-564">line 564</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -6192,7 +6283,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-550">line 550</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-530">line 530</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -6328,7 +6419,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-539">line 539</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-519">line 519</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -6487,7 +6578,7 @@ prefixed with 'OR NOT'</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-608">line 608</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-588">line 588</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -6551,7 +6642,7 @@ prefixed with 'OR NOT'</p>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -113,7 +117,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-31">line 31</a>
|
||||
<a href="query-parser.js.html#sunlight-1-line-49">line 49</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -244,7 +248,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-73">line 73</a>
|
||||
<a href="query-parser.js.html#sunlight-1-line-103">line 103</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -294,6 +298,154 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="hasOperator"><span class="type-signature"></span>hasOperator<span class="signature">(string)</span><span class="type-signature"> → {Array|null}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Check if the string contains an operator, and if so, return the operator(s).
|
||||
If there are no matches, return null</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>string</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>the string to check</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-66">line 66</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">Array</span>
|
||||
|
|
||||
|
||||
<span class="param-type">null</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
@ -394,7 +546,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-47">line 47</a>
|
||||
<a href="query-parser.js.html#sunlight-1-line-76">line 76</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -438,6 +590,179 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="parseWhere"><span class="type-signature"></span>parseWhere<span class="signature">(driver, state)</span><span class="type-signature"> → {String}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Parse a where clause to separate functions from values</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>driver</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>state</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">State</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-126">line 126</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<ul>
|
||||
<li>The parsed/escaped where condition</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
@ -466,7 +791,7 @@
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -158,7 +162,7 @@
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -151,7 +155,7 @@ module.exports = new NodeQuery();</pre>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -77,14 +81,15 @@
|
||||
|
||||
/** @module query-builder */
|
||||
var getArgs = require('getargs'),
|
||||
helpers = require('./helpers');
|
||||
helpers = require('./helpers'),
|
||||
State = require('./state');
|
||||
|
||||
/**
|
||||
* Variables controlling the sql building
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var state = {};
|
||||
var state = new State();
|
||||
|
||||
/*
|
||||
* SQL generation object
|
||||
@ -230,10 +235,17 @@ var QueryBuilder = function(driver, adapter) {
|
||||
|
||||
var obj = {};
|
||||
|
||||
if (helpers.isScalar(args.$key) && !helpers.isUndefined(args.$val) && !helpers.isNull(args.$val))
|
||||
|
||||
if (helpers.isScalar(args.$key) && !helpers.isUndefined(args.$val))
|
||||
{
|
||||
// Convert key/val pair to a simple object
|
||||
obj[args.$key] = args.$val;
|
||||
}
|
||||
else if (helpers.isScalar(args.$key) && helpers.isUndefined(args.$val))
|
||||
{
|
||||
// If just a string for the key, and no value, create a simple object with duplicate key/val
|
||||
obj[args.$key] = args.$key;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = args.$key;
|
||||
@ -252,15 +264,17 @@ var QueryBuilder = function(driver, adapter) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return state[args.$varName];
|
||||
},
|
||||
whereMixedSet: function(/*key, val*/) {
|
||||
var args = getArgs('key:string|object, [val]', arguments);
|
||||
|
||||
state.whereMap = [];
|
||||
state.rawWhereValues = [];
|
||||
|
||||
_p.mixedSet('whereMap', 'both', args.key, args.val);
|
||||
_p.mixedSet('whereValues', 'value', args.key, args.val);
|
||||
_p.mixedSet('rawWhereValues', 'value', args.key, args.val);
|
||||
},
|
||||
fixConjunction: function(conj) {
|
||||
var lastItem = state.queryMap[state.queryMap.length - 1];
|
||||
@ -285,24 +299,16 @@ var QueryBuilder = function(driver, adapter) {
|
||||
// Normalize key and value and insert into state.whereMap
|
||||
_p.whereMixedSet(key, val);
|
||||
|
||||
Object.keys(state.whereMap).forEach(function(field) {
|
||||
// Split each key by spaces, in case there
|
||||
// is an operator such as >, <, !=, etc.
|
||||
var fieldArray = field.trim().split(' ').map(helpers.stringTrim);
|
||||
// Parse the where condition to account for operators,
|
||||
// functions, identifiers, and literal values
|
||||
state = parser.parseWhere(driver, state);
|
||||
|
||||
var item = driver.quoteIdentifiers(fieldArray[0]);
|
||||
|
||||
// Simple key value, or an operator?
|
||||
item += (fieldArray.length === 1 || fieldArray[1] === '') ? '=?' : " " + fieldArray[1] + " ?";
|
||||
|
||||
// Determine the correct conjunction
|
||||
state.whereMap.forEach(function(clause) {
|
||||
var conj = _p.fixConjunction(defaultConj);
|
||||
|
||||
_p.appendMap(conj, item, 'where');
|
||||
|
||||
// Clear the where Map
|
||||
state.whereMap = {};
|
||||
_p.appendMap(conj, clause, 'where');
|
||||
});
|
||||
|
||||
state.whereMap = {};
|
||||
},
|
||||
whereNull: function(field, stmt, conj) {
|
||||
field = driver.quoteIdentifiers(field);
|
||||
@ -318,20 +324,15 @@ var QueryBuilder = function(driver, adapter) {
|
||||
// Normalize key/val and put in state.whereMap
|
||||
_p.whereMixedSet(args.key, args.val);
|
||||
|
||||
Object.keys(state.whereMap).forEach(function(field) {
|
||||
// Split each key by spaces, in case there
|
||||
// is an operator such as >, <, !=, etc.
|
||||
var fieldArray = field.split(' ').map(helpers.stringTrim);
|
||||
|
||||
var item = driver.quoteIdentifiers(fieldArray[0]);
|
||||
|
||||
// Simple key value, or an operator?
|
||||
item += (fieldArray.length === 1) ? '=?' : " " + fieldArray[1] + " ?";
|
||||
// Parse the having condition to account for operators,
|
||||
// functions, identifiers, and literal values
|
||||
state = parser.parseWhere(driver, state);
|
||||
|
||||
state.whereMap.forEach(function(clause) {
|
||||
// Put in the having map
|
||||
state.havingMap.push({
|
||||
conjunction: (state.havingMap.length > 0) ? " " + args.conj + " " : ' HAVING ',
|
||||
string: item
|
||||
string: clause
|
||||
});
|
||||
});
|
||||
|
||||
@ -366,7 +367,7 @@ var QueryBuilder = function(driver, adapter) {
|
||||
vals = state.values.concat(state.whereValues);
|
||||
}
|
||||
|
||||
//console.log(state.queryMap);
|
||||
//console.log(state);
|
||||
//console.log(sql);
|
||||
//console.log(vals);
|
||||
//console.log(callback);
|
||||
@ -389,28 +390,7 @@ var QueryBuilder = function(driver, adapter) {
|
||||
return sql;
|
||||
},
|
||||
resetState: function() {
|
||||
state = {
|
||||
// Arrays/Maps
|
||||
queryMap: [],
|
||||
values: [],
|
||||
whereValues: [],
|
||||
setArrayKeys: [],
|
||||
orderArray: [],
|
||||
groupArray: [],
|
||||
havingMap: [],
|
||||
whereMap: {},
|
||||
|
||||
// Partials
|
||||
selectString: '',
|
||||
fromString: '',
|
||||
setString: '',
|
||||
orderString: '',
|
||||
groupString: '',
|
||||
|
||||
// Other various values
|
||||
limit: null,
|
||||
offset: null
|
||||
};
|
||||
state = new State();
|
||||
}
|
||||
};
|
||||
|
||||
@ -438,10 +418,14 @@ var QueryBuilder = function(driver, adapter) {
|
||||
return state;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Set up state object
|
||||
this.resetQuery();
|
||||
/**
|
||||
* Closes the database connection for the current adapter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
this.end = function() {
|
||||
adapter.close();
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// ! Query Builder Methods
|
||||
@ -1041,7 +1025,7 @@ module.exports = QueryBuilder;</pre>
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -78,21 +82,39 @@
|
||||
var helpers = require('./helpers');
|
||||
|
||||
var matchPatterns = {
|
||||
'function': /([a-zA-Z0-9_]+\((.*?)\))/i,
|
||||
identifier: /([a-zA-Z0-9_\-]+\.?)+/ig,
|
||||
operator: /\=|AND|&&?|~|\|\|?|\^|\/|>=?|<=?|-|%|OR|\+|NOT|\!=?|<>|XOR/i
|
||||
'function': /([a-z0-9_]+\((.*)\))/i,
|
||||
operator: /\!=?|\=|\+|&&?|~|\|\|?|\^|\/|<>|>=?|<=?|\-|%|OR|AND|NOT|XOR/ig,
|
||||
literal: /([0-9]+)|'(.*?)'|true|false/ig
|
||||
};
|
||||
|
||||
// Full pattern for identifiers
|
||||
// Making sure that literals and functions aren't matched
|
||||
matchPatterns.identifier = new RegExp(
|
||||
'('
|
||||
+ '(?!'
|
||||
+ matchPatterns['function'].source + '|'
|
||||
+ matchPatterns.literal.source
|
||||
+ ')'
|
||||
+ '([a-z_\-]+[0-9]*\\.?)'
|
||||
+ ')+'
|
||||
, 'ig');
|
||||
|
||||
// Full pattern for determining ordering of the pieces
|
||||
matchPatterns.combined = new RegExp(matchPatterns['function'].source + "+|"
|
||||
matchPatterns.joinCombined = new RegExp(
|
||||
matchPatterns['function'].source + "+|"
|
||||
+ matchPatterns.literal.source + '+|'
|
||||
+ matchPatterns.identifier.source
|
||||
+ '|(' + matchPatterns.operator.source + ')+', 'ig');
|
||||
+ '|(' + matchPatterns.operator.source + ')+'
|
||||
, 'ig');
|
||||
|
||||
var identifierBlacklist = ['true','false','null'];
|
||||
|
||||
var filterMatches = function(array) {
|
||||
var output = [];
|
||||
|
||||
// Return non-array matches
|
||||
if (helpers.isScalar(array) || helpers.isNull(array) || helpers.isUndefined(array)) return output;
|
||||
if (helpers.isNull(array)) return null;
|
||||
if (helpers.isScalar(array) || helpers.isUndefined(array)) return output;
|
||||
|
||||
array.forEach(function(item) {
|
||||
output.push(item);
|
||||
@ -113,6 +135,17 @@ var QueryParser = function(driver) {
|
||||
// That 'new' keyword is annoying
|
||||
if ( ! (this instanceof QueryParser)) return new QueryParser(driver);
|
||||
|
||||
/**
|
||||
* Check if the string contains an operator, and if so, return the operator(s).
|
||||
* If there are no matches, return null
|
||||
*
|
||||
* @param {String} string - the string to check
|
||||
* @return {Array|null}
|
||||
*/
|
||||
this.hasOperator = function(string) {
|
||||
return filterMatches(string.match(matchPatterns.operator));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenize the sql into parts for additional processing
|
||||
*
|
||||
@ -124,12 +157,13 @@ var QueryParser = function(driver) {
|
||||
var output = {};
|
||||
|
||||
// Get clause components
|
||||
matches['function'] = sql.match(matchPatterns['function']);
|
||||
matches.functions = sql.match(new RegExp(matchPatterns['function'].source, 'ig'));
|
||||
matches.identifiers = sql.match(matchPatterns.identifier);
|
||||
matches.operators = sql.match(matchPatterns.operator);
|
||||
matches.literals = sql.match(matchPatterns.literal);
|
||||
|
||||
// Get everything at once for ordering
|
||||
matches.combined = sql.match(matchPatterns.combined);
|
||||
matches.combined = sql.match(matchPatterns.joinCombined);
|
||||
|
||||
// Flatten the matches to increase relevance
|
||||
Object.keys(matches).forEach(function(key) {
|
||||
@ -160,10 +194,148 @@ var QueryParser = function(driver) {
|
||||
|
||||
return parts.combined.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse a where clause to separate functions from values
|
||||
*
|
||||
* @param {Object} driver
|
||||
* @param {State} state
|
||||
* @return {String} - The parsed/escaped where condition
|
||||
*/
|
||||
this.parseWhere = function(driver, state) {
|
||||
var whereMap = state.whereMap,
|
||||
whereValues = state.rawWhereValues;
|
||||
|
||||
var outputMap = [];
|
||||
var outputValues = [];
|
||||
var that = this;
|
||||
|
||||
Object.keys(whereMap).forEach(function(key) {
|
||||
// Combine fields, operators, functions and values into a full clause
|
||||
// to have a common starting flow
|
||||
var fullClause = '';
|
||||
|
||||
// Add an explicit = sign where one is inferred
|
||||
if ( ! that.hasOperator(key))
|
||||
{
|
||||
fullClause = key + ' = ' + whereMap[key];
|
||||
}
|
||||
else if (whereMap[key] === key)
|
||||
{
|
||||
fullClause = key;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullClause = key + ' ' + whereMap[key];
|
||||
}
|
||||
|
||||
// Separate the clause into separate pieces
|
||||
var parts = that.parseJoin(fullClause);
|
||||
|
||||
// Filter explicit literals from lists of matches
|
||||
if (whereValues.indexOf(whereMap[key]) !== -1)
|
||||
{
|
||||
var value = whereMap[key];
|
||||
var identIndex = (helpers.isArray(parts.identifiers)) ? parts.identifiers.indexOf(value) : -1;
|
||||
var litIndex = (helpers.isArray(parts.literals)) ? parts.literals.indexOf(value) : -1;
|
||||
var combIndex = (helpers.isArray(parts.combined)) ? parts.combined.indexOf(value) : -1;
|
||||
var funcIndex = (helpers.isArray(parts.functions)) ? parts.functions.indexOf(value) : -1;
|
||||
var inOutputArray = outputValues.indexOf(value) !== -1;
|
||||
|
||||
// Remove the identifier in question,
|
||||
// and add to the output values array
|
||||
if (identIndex !== -1)
|
||||
{
|
||||
parts.identifiers.splice(identIndex, 1);
|
||||
|
||||
if ( ! inOutputArray)
|
||||
{
|
||||
outputValues.push(value);
|
||||
inOutputArray = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the value from the literals list
|
||||
// so it is not added twice
|
||||
if (litIndex !== -1)
|
||||
{
|
||||
parts.literals.splice(litIndex, 1);
|
||||
|
||||
if ( ! inOutputArray)
|
||||
{
|
||||
outputValues.push(value);
|
||||
inOutputArray = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the value from the combined list
|
||||
// and replace it with a placeholder
|
||||
if (combIndex !== -1)
|
||||
{
|
||||
// Make sure to skip functions when replacing values
|
||||
if (funcIndex === -1)
|
||||
{
|
||||
parts.combined[combIndex] = '?';
|
||||
|
||||
if ( ! inOutputArray)
|
||||
{
|
||||
outputValues.push(value);
|
||||
inOutputArray = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter false positive identifiers
|
||||
parts.identifiers = parts.identifiers.filter(function(item) {
|
||||
var isInCombinedMatches = parts.combined.indexOf(item) !== -1;
|
||||
var isNotInBlackList = identifierBlacklist.indexOf(item.toLowerCase()) === -1;
|
||||
|
||||
return isInCombinedMatches && isNotInBlackList;
|
||||
});
|
||||
|
||||
// Quote identifiers
|
||||
if (helpers.isArray(parts.identifiers))
|
||||
{
|
||||
parts.identifiers.forEach(function(ident) {
|
||||
var index = parts.combined.indexOf(ident);
|
||||
if (index !== -1)
|
||||
{
|
||||
parts.combined[index] = driver.quoteIdentifiers(ident);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Replace each literal with a placeholder in the map
|
||||
// and add the literal to the values,
|
||||
// This should only apply to literal values that are not
|
||||
// explicitly mapped to values, but have to be parsed from
|
||||
// a where condition,
|
||||
if (helpers.isArray(parts.literals))
|
||||
{
|
||||
parts.literals.forEach(function(lit) {
|
||||
var litIndex = parts.combined.indexOf(lit);
|
||||
|
||||
if (litIndex !== -1)
|
||||
{
|
||||
parts.combined[litIndex] = (helpers.isArray(parts.operators)) ? '?' : '= ?';
|
||||
outputValues.push(lit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
outputMap.push(parts.combined.join(' '));
|
||||
});
|
||||
|
||||
state.rawWhereValues = [];
|
||||
state.whereValues = state.whereValues.concat(outputValues);
|
||||
state.whereMap = outputMap;
|
||||
|
||||
return state;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = QueryParser;
|
||||
</pre>
|
||||
module.exports = QueryParser;</pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@ -184,7 +356,7 @@ module.exports = QueryParser;
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Mon Dec 1st 2014 using the <a
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
|
209
docs/state.js.html
Normal file
209
docs/state.js.html
Normal file
@ -0,0 +1,209 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>DocStrap Source: state.js</title>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="index.html">DocStrap</a>
|
||||
<ul class="nav">
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
|
||||
class="caret"></b></a>
|
||||
|
||||
<ul class="dropdown-menu ">
|
||||
|
||||
<li>
|
||||
<a href="module-adapter.html">adapter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-driver.html">driver</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-helpers.html">helpers</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-node-query.html">node-query</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-query-builder.html">query-builder</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-query-parser.html">query-parser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="module-State.html">State</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
|
||||
<div class="span12">
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
|
||||
<h1 class="page-title">Source: state.js</h1>
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre
|
||||
class="sunlight-highlight-javascript linenums">'use strict';
|
||||
|
||||
/** @module State */
|
||||
module.exports = function State() {
|
||||
return {
|
||||
// Arrays/Maps
|
||||
queryMap: [],
|
||||
values: [],
|
||||
whereValues: [],
|
||||
setArrayKeys: [],
|
||||
orderArray: [],
|
||||
groupArray: [],
|
||||
havingMap: [],
|
||||
whereMap: {},
|
||||
rawWhereValues: [],
|
||||
|
||||
// Partials
|
||||
selectString: '',
|
||||
fromString: '',
|
||||
setString: '',
|
||||
orderString: '',
|
||||
groupString: '',
|
||||
|
||||
// Other various values
|
||||
limit: null,
|
||||
offset: null
|
||||
};
|
||||
};
|
||||
// End of module State</pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<footer>
|
||||
|
||||
|
||||
<span class="copyright">
|
||||
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
|
||||
on Fri Jan 23rd 2015 using the <a
|
||||
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<br clear="both">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--<script src="scripts/sunlight.js"></script>-->
|
||||
<script src="scripts/docstrap.lib.js"></script>
|
||||
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||
<script src="scripts/toc.js"></script>
|
||||
|
||||
<script>
|
||||
$( function () {
|
||||
$( "[id*='$']" ).each( function () {
|
||||
var $this = $( this );
|
||||
|
||||
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
|
||||
} );
|
||||
|
||||
$( "#toc" ).toc( {
|
||||
anchorName : function ( i, heading, prefix ) {
|
||||
return $( heading ).attr( "id" ) || ( prefix + i );
|
||||
},
|
||||
selectors : "h1,h2,h3,h4",
|
||||
showAndHide : false,
|
||||
scrollTo : "100px"
|
||||
} );
|
||||
|
||||
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||
$( '.dropdown-toggle' ).dropdown();
|
||||
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
|
||||
|
||||
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
|
||||
var $this = $( this );
|
||||
|
||||
var example = $this.find( "code" );
|
||||
exampleText = example.html();
|
||||
var lang = /{@lang (.*?)}/.exec( exampleText );
|
||||
if ( lang && lang[1] ) {
|
||||
exampleText = exampleText.replace( lang[0], "" );
|
||||
example.html( exampleText );
|
||||
lang = lang[1];
|
||||
} else {
|
||||
lang = "javascript";
|
||||
}
|
||||
|
||||
if ( lang ) {
|
||||
|
||||
$this
|
||||
.addClass( "sunlight-highlight-" + lang )
|
||||
.addClass( "linenums" )
|
||||
.html( example.html() );
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
Sunlight.highlightAll( {
|
||||
lineNumbers : true,
|
||||
showMenu : true,
|
||||
enableDoclinks : true
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!--Navigation and Symbol Display-->
|
||||
|
||||
|
||||
|
||||
<!--Google Analytics-->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user