2083 lines
86 KiB
HTML
2083 lines
86 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8' />
|
|
<title> | Documentation</title>
|
|
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Source+Code+Pro:400,500,700' rel='stylesheet' type='text/css'>
|
|
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
|
|
<link href='assets/style.css' type='text/css' rel='stylesheet' />
|
|
<link href='assets/github.css' type='text/css' rel='stylesheet' />
|
|
</head>
|
|
<body class='documentation'>
|
|
<div class='container'>
|
|
<div class='clearfix md-mxn2'>
|
|
<div class='fixed md-show fix-3 overflow-auto max-height-100'>
|
|
<div class='py1 px2'>
|
|
<h3 class='mb0 no-anchor'></h3>
|
|
<div class='mb1'><code></code></div>
|
|
<input
|
|
placeholder='Filter'
|
|
id='filter-input'
|
|
class='col12 block field'
|
|
type='text' />
|
|
<div id='toc'>
|
|
<a
|
|
href='#NodeQuery'
|
|
class='block bold'>
|
|
NodeQuery
|
|
</a>
|
|
<a
|
|
href='#NodeQuery.constructor'
|
|
class='regular block'>
|
|
#constructor
|
|
</a>
|
|
<a
|
|
href='#NodeQuery.getQuery'
|
|
class='regular block'>
|
|
#getQuery
|
|
</a>
|
|
<a
|
|
href='#NodeQuery.init'
|
|
class='regular block'>
|
|
#init
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder'
|
|
class='block bold'>
|
|
QueryBuilder
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.delete'
|
|
class='regular block'>
|
|
#delete
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.end'
|
|
class='regular block'>
|
|
#end
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.from'
|
|
class='regular block'>
|
|
#from
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.get'
|
|
class='regular block'>
|
|
#get
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.getCompiledDelete'
|
|
class='regular block'>
|
|
#getCompiledDelete
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.getCompiledInsert'
|
|
class='regular block'>
|
|
#getCompiledInsert
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.getCompiledSelect'
|
|
class='regular block'>
|
|
#getCompiledSelect
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.getCompiledUpdate'
|
|
class='regular block'>
|
|
#getCompiledUpdate
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.groupBy'
|
|
class='regular block'>
|
|
#groupBy
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.groupEnd'
|
|
class='regular block'>
|
|
#groupEnd
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.groupStart'
|
|
class='regular block'>
|
|
#groupStart
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.having'
|
|
class='regular block'>
|
|
#having
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.insert'
|
|
class='regular block'>
|
|
#insert
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.insertBatch'
|
|
class='regular block'>
|
|
#insertBatch
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.join'
|
|
class='regular block'>
|
|
#join
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.like'
|
|
class='regular block'>
|
|
#like
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.limit'
|
|
class='regular block'>
|
|
#limit
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.notLike'
|
|
class='regular block'>
|
|
#notLike
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orGroupStart'
|
|
class='regular block'>
|
|
#orGroupStart
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orHaving'
|
|
class='regular block'>
|
|
#orHaving
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orLike'
|
|
class='regular block'>
|
|
#orLike
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orNotGroupStart'
|
|
class='regular block'>
|
|
#orNotGroupStart
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orNotLike'
|
|
class='regular block'>
|
|
#orNotLike
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orWhere'
|
|
class='regular block'>
|
|
#orWhere
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orWhereIn'
|
|
class='regular block'>
|
|
#orWhereIn
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orWhereIsNotNull'
|
|
class='regular block'>
|
|
#orWhereIsNotNull
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orWhereIsNull'
|
|
class='regular block'>
|
|
#orWhereIsNull
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orWhereNotIn'
|
|
class='regular block'>
|
|
#orWhereNotIn
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.orderBy'
|
|
class='regular block'>
|
|
#orderBy
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.query'
|
|
class='regular block'>
|
|
#query
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.resetQuery'
|
|
class='regular block'>
|
|
#resetQuery
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.select'
|
|
class='regular block'>
|
|
#select
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.set'
|
|
class='regular block'>
|
|
#set
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.update'
|
|
class='regular block'>
|
|
#update
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.where'
|
|
class='regular block'>
|
|
#where
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.whereIn'
|
|
class='regular block'>
|
|
#whereIn
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.whereIsNotNull'
|
|
class='regular block'>
|
|
#whereIsNotNull
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.whereIsNull'
|
|
class='regular block'>
|
|
#whereIsNull
|
|
</a>
|
|
<a
|
|
href='#QueryBuilder.whereNotIn'
|
|
class='regular block'>
|
|
#whereNotIn
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='fix-margin-3'>
|
|
<div class='px2'>
|
|
<div class='py1'><section class='py2 clearfix'>
|
|
<h2 id='NodeQuery' class='mt0'>
|
|
NodeQuery<span class='gray'>(config)</span>
|
|
</h2>
|
|
<p>Class for connection management</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li> <strong>config</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Instance members</h4>
|
|
<div class='collapsible' id='NodeQuery.constructor'>
|
|
<a href='#NodeQuery.constructor'>
|
|
<code>
|
|
#constructor<span class='gray'>(config)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Constructor</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='NodeQuery.constructor' class='mt0'>
|
|
constructor<span class='gray'>(config)</span>
|
|
</h2>
|
|
<p>Constructor</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></code> <strong>config</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>connection paramaters</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='NodeQuery.getQuery'>
|
|
<a href='#NodeQuery.getQuery'>
|
|
<code>
|
|
#getQuery<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Return an existing query builder instance</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='NodeQuery.getQuery' class='mt0'>
|
|
getQuery<span class='gray'></span>
|
|
</h2>
|
|
<p>Return an existing query builder instance</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='NodeQuery.init'>
|
|
<a href='#NodeQuery.init'>
|
|
<code>
|
|
#init<span class='gray'>(driverType, connObject, [connLib])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Create a query builder object</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='NodeQuery.init' class='mt0'>
|
|
init<span class='gray'>(driverType, connObject, [connLib])</span>
|
|
</h2>
|
|
<p>Create a query builder object</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>driverType</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the database type, eg. mysql or pg</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>connObject</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>A connection object from the database library
|
|
you are connecting with</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>connLib</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the db connection library you are
|
|
using, eg. mysql or mysql2. Optional if the same as driverType</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div><div class='py1'><section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder' class='mt0'>
|
|
QueryBuilder<span class='gray'>(Driver, Adapter)</span>
|
|
</h2>
|
|
<p>Main object that builds SQL queries.</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code>Driver</code> <strong>Driver</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The syntax driver for the database</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>Adapter</code> <strong>Adapter</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The database module adapter for running queries</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Instance members</h4>
|
|
<div class='collapsible' id='QueryBuilder.delete'>
|
|
<a href='#QueryBuilder.delete'>
|
|
<code>
|
|
#delete<span class='gray'>(table, [where], [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Run the generated delete query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.delete' class='mt0'>
|
|
delete<span class='gray'>(table, [where], [callback])</span>
|
|
</h2>
|
|
<p>Run the generated delete query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to insert into</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>]</code> <strong>where</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Where clause for delete statement</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Callback for handling response from the database</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>If no callback is passed, a promise is returned</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.end'>
|
|
<a href='#QueryBuilder.end'>
|
|
<code>
|
|
#end<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Closes the database connection for the current adapter</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.end' class='mt0'>
|
|
end<span class='gray'></span>
|
|
</h2>
|
|
<p>Closes the database connection for the current adapter</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code>void</code></code>
|
|
|
|
<div class='force-inline'>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.from'>
|
|
<a href='#QueryBuilder.from'>
|
|
<code>
|
|
#from<span class='gray'>(tableName)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Specify the database table to select from</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.from' class='mt0'>
|
|
from<span class='gray'>(tableName)</span>
|
|
</h2>
|
|
<p>Specify the database table to select from</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>tableName</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to use for the current query</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
<h4>Examples</h4>
|
|
<pre class='overflow-auto'>query.from(<span class="hljs-string">'tableName'</span>);</pre><pre class='overflow-auto'>query.from(<span class="hljs-string">'tableName t'</span>); <span class="hljs-comment">// Select the table with an alias</span></pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.get'>
|
|
<a href='#QueryBuilder.get'>
|
|
<code>
|
|
#get<span class='gray'>([table], [limit], [offset], [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Get the results of the compiled query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.get' class='mt0'>
|
|
get<span class='gray'>([table], [limit], [offset], [callback])</span>
|
|
</h2>
|
|
<p>Get the results of the compiled query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to select from</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>limit</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>A limit for the query</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>offset</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>An offset for the query</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>A callback for receiving the result</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>If no callback is passed, a promise is returned</p>
|
|
|
|
</div>
|
|
<h4>Examples</h4>
|
|
<pre class='overflow-auto'>query.get(<span class="hljs-string">'table_name'</span>).then(promiseCallback); <span class="hljs-comment">// Get all the rows in the table</span></pre><pre class='overflow-auto'>query.get(<span class="hljs-string">'table_name'</span>, <span class="hljs-number">5</span>, callback); <span class="hljs-comment">// Get 5 rows from the table</span></pre><pre class='overflow-auto'>query.get(callback); <span class="hljs-comment">// Get the results of a query generated with other methods</span></pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.getCompiledDelete'>
|
|
<a href='#QueryBuilder.getCompiledDelete'>
|
|
<code>
|
|
#getCompiledDelete<span class='gray'>(table, [reset])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Return generated delete query SQL</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.getCompiledDelete' class='mt0'>
|
|
getCompiledDelete<span class='gray'>(table, [reset])</span>
|
|
</h2>
|
|
<p>Return generated delete query SQL</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the name of the table to delete from</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>]</code> <strong>reset</strong>
|
|
(default <code>true</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Whether to reset the query builder so another query can be built</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The compiled sql statement</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.getCompiledInsert'>
|
|
<a href='#QueryBuilder.getCompiledInsert'>
|
|
<code>
|
|
#getCompiledInsert<span class='gray'>(table, [reset])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Return generated insert query SQL</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.getCompiledInsert' class='mt0'>
|
|
getCompiledInsert<span class='gray'>(table, [reset])</span>
|
|
</h2>
|
|
<p>Return generated insert query SQL</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the name of the table to insert into</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>]</code> <strong>reset</strong>
|
|
(default <code>true</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Whether to reset the query builder so another query can be built</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The compiled sql statement</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.getCompiledSelect'>
|
|
<a href='#QueryBuilder.getCompiledSelect'>
|
|
<code>
|
|
#getCompiledSelect<span class='gray'>([table], [reset])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Return generated select query SQL</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.getCompiledSelect' class='mt0'>
|
|
getCompiledSelect<span class='gray'>([table], [reset])</span>
|
|
</h2>
|
|
<p>Return generated select query SQL</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the name of the table to retrieve from</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>]</code> <strong>reset</strong>
|
|
(default <code>true</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Whether to reset the query builder so another query can be built</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The compiled sql statement</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.getCompiledUpdate'>
|
|
<a href='#QueryBuilder.getCompiledUpdate'>
|
|
<code>
|
|
#getCompiledUpdate<span class='gray'>(table, [reset])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Return generated update query SQL</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.getCompiledUpdate' class='mt0'>
|
|
getCompiledUpdate<span class='gray'>(table, [reset])</span>
|
|
</h2>
|
|
<p>Return generated update query SQL</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the name of the table to update</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>]</code> <strong>reset</strong>
|
|
(default <code>true</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Whether to reset the query builder so another query can be built</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The compiled sql statement</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.groupBy'>
|
|
<a href='#QueryBuilder.groupBy'>
|
|
<code>
|
|
#groupBy<span class='gray'>(field)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Group the results by the selected field(s)</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.groupBy' class='mt0'>
|
|
groupBy<span class='gray'>(field)</span>
|
|
</h2>
|
|
<p>Group the results by the selected field(s)</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field to group by</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.groupEnd'>
|
|
<a href='#QueryBuilder.groupEnd'>
|
|
<code>
|
|
#groupEnd<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Ends a logical grouping started with one of the groupStart methods</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.groupEnd' class='mt0'>
|
|
groupEnd<span class='gray'></span>
|
|
</h2>
|
|
<p>Ends a logical grouping started with one of the groupStart methods</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.groupStart'>
|
|
<a href='#QueryBuilder.groupStart'>
|
|
<code>
|
|
#groupStart<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Adds an open paren to the current query for logical grouping</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.groupStart' class='mt0'>
|
|
groupStart<span class='gray'></span>
|
|
</h2>
|
|
<p>Adds an open paren to the current query for logical grouping</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.having'>
|
|
<a href='#QueryBuilder.having'>
|
|
<code>
|
|
#having<span class='gray'>(key, [val])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add a 'having' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.having' class='mt0'>
|
|
having<span class='gray'>(key, [val])</span>
|
|
</h2>
|
|
<p>Add a 'having' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field and the comparision operator, or an object</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare if the value of key is a string</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.insert'>
|
|
<a href='#QueryBuilder.insert'>
|
|
<code>
|
|
#insert<span class='gray'>(table, [data], [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Run the generated insert query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.insert' class='mt0'>
|
|
insert<span class='gray'>(table, [data], [callback])</span>
|
|
</h2>
|
|
<p>Run the generated insert query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to insert into</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>]</code> <strong>data</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Data to insert, if not already added with the 'set' method</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Callback for handling response from the database</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>If no callback is passed, a promise is returned</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.insertBatch'>
|
|
<a href='#QueryBuilder.insertBatch'>
|
|
<code>
|
|
#insertBatch<span class='gray'>(table, data, [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Insert multiple sets of rows at a time</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.insertBatch' class='mt0'>
|
|
insertBatch<span class='gray'>(table, data, [callback])</span>
|
|
</h2>
|
|
<p>Insert multiple sets of rows at a time</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to insert into</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>data</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The array of objects containing data rows to insert</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Callback for handling database response</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>If no callback is passed, a promise is returned</p>
|
|
|
|
</div>
|
|
<h4>Examples</h4>
|
|
<pre class='overflow-auto'>query.insertBatch(<span class="hljs-string">'foo'</span>,[{id:<span class="hljs-number">1</span>,val:<span class="hljs-string">'bar'</span>},{id:<span class="hljs-number">2</span>,val:<span class="hljs-string">'baz'</span>}], callbackFunction);</pre><pre class='overflow-auto'>query.insertBatch(<span class="hljs-string">'foo'</span>,[{id:<span class="hljs-number">1</span>,val:<span class="hljs-string">'bar'</span>},{id:<span class="hljs-number">2</span>,val:<span class="hljs-string">'baz'</span>}])
|
|
.then(promiseCallback);</pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.join'>
|
|
<a href='#QueryBuilder.join'>
|
|
<code>
|
|
#join<span class='gray'>(table, cond, [type])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add a join clause to the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.join' class='mt0'>
|
|
join<span class='gray'>(table, cond, [type])</span>
|
|
</h2>
|
|
<p>Add a join clause to the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table you are joining</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>cond</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The join condition.</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>type</strong>
|
|
(default <code>'inner'</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The type of join, which defaults to inner</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.like'>
|
|
<a href='#QueryBuilder.like'>
|
|
<code>
|
|
#like<span class='gray'>(field, val, [pos])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add a 'like/ and like' clause to the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.like' class='mt0'>
|
|
like<span class='gray'>(field, val, [pos])</span>
|
|
</h2>
|
|
<p>Add a 'like/ and like' clause to the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>pos</strong>
|
|
(default <code>both</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The placement of the wildcard character(s): before, after, or both</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.limit'>
|
|
<a href='#QueryBuilder.limit'>
|
|
<code>
|
|
#limit<span class='gray'>(limit, [offset])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Put a limit on the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.limit' class='mt0'>
|
|
limit<span class='gray'>(limit, [offset])</span>
|
|
</h2>
|
|
<p>Put a limit on the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code> <strong>limit</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The maximum number of rows to fetch</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>offset</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The row number to start from</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.notLike'>
|
|
<a href='#QueryBuilder.notLike'>
|
|
<code>
|
|
#notLike<span class='gray'>(field, val, [pos])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add a 'not like/ and not like' clause to the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.notLike' class='mt0'>
|
|
notLike<span class='gray'>(field, val, [pos])</span>
|
|
</h2>
|
|
<p>Add a 'not like/ and not like' clause to the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>pos</strong>
|
|
(default <code>both</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The placement of the wildcard character(s): before, after, or both</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orGroupStart'>
|
|
<a href='#QueryBuilder.orGroupStart'>
|
|
<code>
|
|
#orGroupStart<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Adds an open paren to the current query for logical grouping,
|
|
prefixed with 'OR'</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orGroupStart' class='mt0'>
|
|
orGroupStart<span class='gray'></span>
|
|
</h2>
|
|
<p>Adds an open paren to the current query for logical grouping,
|
|
prefixed with 'OR'</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orHaving'>
|
|
<a href='#QueryBuilder.orHaving'>
|
|
<code>
|
|
#orHaving<span class='gray'>(key, [val])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add an 'or having' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orHaving' class='mt0'>
|
|
orHaving<span class='gray'>(key, [val])</span>
|
|
</h2>
|
|
<p>Add an 'or having' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field and the comparision operator, or an object</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare if the value of key is a string</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orLike'>
|
|
<a href='#QueryBuilder.orLike'>
|
|
<code>
|
|
#orLike<span class='gray'>(field, val, [pos])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add an 'or like' clause to the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orLike' class='mt0'>
|
|
orLike<span class='gray'>(field, val, [pos])</span>
|
|
</h2>
|
|
<p>Add an 'or like' clause to the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>pos</strong>
|
|
(default <code>both</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The placement of the wildcard character(s): before, after, or both</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orNotGroupStart'>
|
|
<a href='#QueryBuilder.orNotGroupStart'>
|
|
<code>
|
|
#orNotGroupStart<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Adds an open paren to the current query for logical grouping,
|
|
prefixed with 'OR NOT'</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orNotGroupStart' class='mt0'>
|
|
orNotGroupStart<span class='gray'></span>
|
|
</h2>
|
|
<p>Adds an open paren to the current query for logical grouping,
|
|
prefixed with 'OR NOT'</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orNotLike'>
|
|
<a href='#QueryBuilder.orNotLike'>
|
|
<code>
|
|
#orNotLike<span class='gray'>(field, val, [pos])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Add an 'or not like' clause to the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orNotLike' class='mt0'>
|
|
orNotLike<span class='gray'>(field, val, [pos])</span>
|
|
</h2>
|
|
<p>Add an 'or not like' clause to the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare to</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>pos</strong>
|
|
(default <code>both</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The placement of the wildcard character(s): before, after, or both</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orWhere'>
|
|
<a href='#QueryBuilder.orWhere'>
|
|
<code>
|
|
#orWhere<span class='gray'>(key, [val])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'or where' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orWhere' class='mt0'>
|
|
orWhere<span class='gray'>(key, [val])</span>
|
|
</h2>
|
|
<p>Set a 'or where' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field and the comparision operator, or an object</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare if the value of key is a string</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orWhereIn'>
|
|
<a href='#QueryBuilder.orWhereIn'>
|
|
<code>
|
|
#orWhereIn<span class='gray'>(key, values)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'or where in' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orWhereIn' class='mt0'>
|
|
orWhereIn<span class='gray'>(key, values)</span>
|
|
</h2>
|
|
<p>Set a 'or where in' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the field to search</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>values</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the array of items to search in</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orWhereIsNotNull'>
|
|
<a href='#QueryBuilder.orWhereIsNotNull'>
|
|
<code>
|
|
#orWhereIsNotNull<span class='gray'>(field)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Field is not null prefixed with 'OR'</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orWhereIsNotNull' class='mt0'>
|
|
orWhereIsNotNull<span class='gray'>(field)</span>
|
|
</h2>
|
|
<p>Field is not null prefixed with 'OR'</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orWhereIsNull'>
|
|
<a href='#QueryBuilder.orWhereIsNull'>
|
|
<code>
|
|
#orWhereIsNull<span class='gray'>(field)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Field is null prefixed with 'OR'</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orWhereIsNull' class='mt0'>
|
|
orWhereIsNull<span class='gray'>(field)</span>
|
|
</h2>
|
|
<p>Field is null prefixed with 'OR'</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orWhereNotIn'>
|
|
<a href='#QueryBuilder.orWhereNotIn'>
|
|
<code>
|
|
#orWhereNotIn<span class='gray'>(key, values)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'or where not in' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orWhereNotIn' class='mt0'>
|
|
orWhereNotIn<span class='gray'>(key, values)</span>
|
|
</h2>
|
|
<p>Set a 'or where not in' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the field to search</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>values</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the array of items to search in</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.orderBy'>
|
|
<a href='#QueryBuilder.orderBy'>
|
|
<code>
|
|
#orderBy<span class='gray'>(field, [type])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Order the results by the selected field(s)</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.orderBy' class='mt0'>
|
|
orderBy<span class='gray'>(field, [type])</span>
|
|
</h2>
|
|
<p>Order the results by the selected field(s)</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The field(s) to order by</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>type</strong>
|
|
(default <code>'ASC'</code>)
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The order direction, ASC or DESC</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.query'>
|
|
<a href='#QueryBuilder.query'>
|
|
<code>
|
|
#query<span class='gray'>(sql, [params], [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Manually make an sql query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.query' class='mt0'>
|
|
query<span class='gray'>(sql, [params], [callback])</span>
|
|
</h2>
|
|
<p>Manually make an sql query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code> <strong>sql</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The sql to execute</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">array</a></code>]</code> <strong>params</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The query parameters</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Optional callback</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Returns a promise if no callback is supplied</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.resetQuery'>
|
|
<a href='#QueryBuilder.resetQuery'>
|
|
<code>
|
|
#resetQuery<span class='gray'></span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Reset the object state for a new query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.resetQuery' class='mt0'>
|
|
resetQuery<span class='gray'></span>
|
|
</h2>
|
|
<p>Reset the object state for a new query</p>
|
|
|
|
<h4>Returns</h4>
|
|
<code><code>void</code></code>
|
|
|
|
<div class='force-inline'>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.select'>
|
|
<a href='#QueryBuilder.select'>
|
|
<code>
|
|
#select<span class='gray'>(fields)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Specify rows to select in the query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.select' class='mt0'>
|
|
select<span class='gray'>(fields)</span>
|
|
</h2>
|
|
<p>Specify rows to select in the query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>fields</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The fields to select from the current table</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
<h4>Examples</h4>
|
|
<pre class='overflow-auto'>query.select(<span class="hljs-string">'foo, bar'</span>); <span class="hljs-comment">// Select multiple fields with a string</span></pre><pre class='overflow-auto'>query.select([<span class="hljs-string">'foo'</span>, <span class="hljs-string">'bar'</span>]); <span class="hljs-comment">// Select multiple fileds with an array</span></pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.set'>
|
|
<a href='#QueryBuilder.set'>
|
|
<code>
|
|
#set<span class='gray'>(key, [val])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set values for insertion or updating</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.set' class='mt0'>
|
|
set<span class='gray'>(key, [val])</span>
|
|
</h2>
|
|
<p>Set values for insertion or updating</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The key or object to use</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value if using a scalar key</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
<h4>Examples</h4>
|
|
<pre class='overflow-auto'>query.set(<span class="hljs-string">'foo'</span>, <span class="hljs-string">'bar'</span>); <span class="hljs-comment">// Set a key, value pair</span></pre><pre class='overflow-auto'>query.set({foo:<span class="hljs-string">'bar'</span>}); <span class="hljs-comment">// Set with an object</span></pre>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.update'>
|
|
<a href='#QueryBuilder.update'>
|
|
<code>
|
|
#update<span class='gray'>(table, [data], [callback])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Run the generated update query</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.update' class='mt0'>
|
|
update<span class='gray'>(table, [data], [callback])</span>
|
|
</h2>
|
|
<p>Run the generated update query</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>table</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The table to insert into</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>]</code> <strong>data</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Data to insert, if not already added with the 'set' method</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>]</code> <strong>callback</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>Callback for handling response from the database</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code>void</code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>If no callback is passed, a promise is returned</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.where'>
|
|
<a href='#QueryBuilder.where'>
|
|
<code>
|
|
#where<span class='gray'>(key, [val])</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'where' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.where' class='mt0'>
|
|
where<span class='gray'>(key, [val])</span>
|
|
</h2>
|
|
<p>Set a 'where' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field and the comparision operator, or an object</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>]</code> <strong>val</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The value to compare if the value of key is a string</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.whereIn'>
|
|
<a href='#QueryBuilder.whereIn'>
|
|
<code>
|
|
#whereIn<span class='gray'>(key, values)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'where in' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.whereIn' class='mt0'>
|
|
whereIn<span class='gray'>(key, values)</span>
|
|
</h2>
|
|
<p>Set a 'where in' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the field to search</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>values</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the array of items to search in</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.whereIsNotNull'>
|
|
<a href='#QueryBuilder.whereIsNotNull'>
|
|
<code>
|
|
#whereIsNotNull<span class='gray'>(field)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Specify that a field IS NOT NULL</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.whereIsNotNull' class='mt0'>
|
|
whereIsNotNull<span class='gray'>(field)</span>
|
|
</h2>
|
|
<p>Specify that a field IS NOT NULL</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name so the field that is not to be null</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.whereIsNull'>
|
|
<a href='#QueryBuilder.whereIsNull'>
|
|
<code>
|
|
#whereIsNull<span class='gray'>(field)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Select a field that is Null</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.whereIsNull' class='mt0'>
|
|
whereIsNull<span class='gray'>(field)</span>
|
|
</h2>
|
|
<p>Select a field that is Null</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>field</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The name of the field that has a NULL value</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div class='collapsible' id='QueryBuilder.whereNotIn'>
|
|
<a href='#QueryBuilder.whereNotIn'>
|
|
<code>
|
|
#whereNotIn<span class='gray'>(key, values)</span>
|
|
</code>
|
|
<div class='force-inline'>
|
|
<p>Set a 'where not in' clause</p>
|
|
|
|
</div>
|
|
</a>
|
|
<div class='collapser border px2'>
|
|
<section class='py2 clearfix'>
|
|
<h2 id='QueryBuilder.whereNotIn' class='mt0'>
|
|
whereNotIn<span class='gray'>(key, values)</span>
|
|
</h2>
|
|
<p>Set a 'where not in' clause</p>
|
|
|
|
<h4>Parameters</h4>
|
|
<ul class='suppress-p-margin'>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>key</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the field to search</p>
|
|
|
|
</div>
|
|
</li>
|
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>values</strong>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>the array of items to search in</p>
|
|
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<h4>Returns</h4>
|
|
<code><code><a href="#QueryBuilder">QueryBuilder</a></code></code>
|
|
:
|
|
<div class='force-inline'>
|
|
<p>The Query Builder object, for chaining</p>
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src='assets/anchor.js'></script>
|
|
<script src='assets/site.js'></script>
|
|
</body>
|
|
</html>
|