node-query/docs/index.html

4160 lines
107 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
2014-10-20 16:56:45 -04:00
<head>
<meta charset='utf-8' />
<title> | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<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'>
2016-07-20 16:33:09 -04:00
<div class='max-width-4 mx-auto'>
<div class='clearfix md-mxn2'>
2016-07-20 16:33:09 -04:00
<div class='fixed xs-hide 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'
2016-07-20 16:33:09 -04:00
class='col12 block input'
type='text' />
<div id='toc'>
2016-07-20 16:33:09 -04:00
<ul class='list-reset h5 py1-ul'>
<li><a
href='#limit'
class="">
limit
</a>
2016-07-20 16:33:09 -04:00
</li>
<li><a
href='#quotetable'
class="">
quoteTable
</a>
2016-07-20 16:33:09 -04:00
</li>
<li><a
href='#quoteidentifiers'
class="">
quoteIdentifiers
</a>
2016-07-20 16:33:09 -04:00
</li>
<li><a
href='#truncate'
class="">
truncate
</a>
2016-07-20 16:33:09 -04:00
</li>
<li><a
href='#insertbatch'
class="">
insertBatch
</a>
2016-07-20 16:33:09 -04:00
</li>
<li><a
href='#nodequery'
class=" toggle-sibling">
NodeQuery
<span class='icon'></span>
</a>
2016-07-20 16:33:09 -04:00
<div class='toggle-target display-none'>
<ul class='list-reset py1-ul pl1'>
<li class='h5'><span>Instance members</span></li>
<li><a
href='#NodeQuery#constructor'
class='regular pre-open'>
#constructor
</a></li>
<li><a
href='#NodeQuery#getQuery'
class='regular pre-open'>
#getQuery
</a></li>
</ul>
</div>
</li>
<li><a
href='#querybuilder'
class=" toggle-sibling">
QueryBuilder
<span class='icon'></span>
</a>
2016-07-20 16:33:09 -04:00
<div class='toggle-target display-none'>
<ul class='list-reset py1-ul pl1'>
<li class='h5'><span>Instance members</span></li>
<li><a
href='#QueryBuilder#query'
class='regular pre-open'>
#query
</a></li>
<li><a
href='#QueryBuilder#resetQuery'
class='regular pre-open'>
#resetQuery
</a></li>
<li><a
href='#QueryBuilder#truncate'
class='regular pre-open'>
#truncate
</a></li>
<li><a
href='#QueryBuilder#end'
class='regular pre-open'>
#end
</a></li>
<li><a
href='#QueryBuilder#select'
class='regular pre-open'>
#select
</a></li>
<li><a
href='#QueryBuilder#from'
class='regular pre-open'>
#from
</a></li>
<li><a
href='#QueryBuilder#like'
class='regular pre-open'>
#like
</a></li>
<li><a
href='#QueryBuilder#notLike'
class='regular pre-open'>
#notLike
</a></li>
<li><a
href='#QueryBuilder#orLike'
class='regular pre-open'>
#orLike
</a></li>
<li><a
href='#QueryBuilder#orNotLike'
class='regular pre-open'>
#orNotLike
</a></li>
<li><a
href='#QueryBuilder#having'
class='regular pre-open'>
#having
</a></li>
<li><a
href='#QueryBuilder#orHaving'
class='regular pre-open'>
#orHaving
</a></li>
<li><a
href='#QueryBuilder#where'
class='regular pre-open'>
#where
</a></li>
<li><a
href='#QueryBuilder#orWhere'
class='regular pre-open'>
#orWhere
</a></li>
<li><a
href='#QueryBuilder#whereIsNull'
class='regular pre-open'>
#whereIsNull
</a></li>
<li><a
href='#QueryBuilder#whereIsNotNull'
class='regular pre-open'>
#whereIsNotNull
</a></li>
<li><a
href='#QueryBuilder#orWhereIsNull'
class='regular pre-open'>
#orWhereIsNull
</a></li>
<li><a
href='#QueryBuilder#orWhereIsNotNull'
class='regular pre-open'>
#orWhereIsNotNull
</a></li>
<li><a
href='#QueryBuilder#whereIn'
class='regular pre-open'>
#whereIn
</a></li>
<li><a
href='#QueryBuilder#orWhereIn'
class='regular pre-open'>
#orWhereIn
</a></li>
<li><a
href='#QueryBuilder#whereNotIn'
class='regular pre-open'>
#whereNotIn
</a></li>
<li><a
href='#QueryBuilder#orWhereNotIn'
class='regular pre-open'>
#orWhereNotIn
</a></li>
<li><a
href='#QueryBuilder#set'
class='regular pre-open'>
#set
</a></li>
<li><a
href='#QueryBuilder#join'
class='regular pre-open'>
#join
</a></li>
<li><a
href='#QueryBuilder#groupBy'
class='regular pre-open'>
#groupBy
</a></li>
<li><a
href='#QueryBuilder#orderBy'
class='regular pre-open'>
#orderBy
</a></li>
<li><a
href='#QueryBuilder#limit'
class='regular pre-open'>
#limit
</a></li>
<li><a
href='#QueryBuilder#groupStart'
class='regular pre-open'>
#groupStart
</a></li>
<li><a
href='#QueryBuilder#orGroupStart'
class='regular pre-open'>
#orGroupStart
</a></li>
<li><a
href='#QueryBuilder#orNotGroupStart'
class='regular pre-open'>
#orNotGroupStart
</a></li>
<li><a
href='#QueryBuilder#groupEnd'
class='regular pre-open'>
#groupEnd
</a></li>
<li><a
href='#QueryBuilder#get'
class='regular pre-open'>
#get
</a></li>
<li><a
href='#QueryBuilder#insert'
class='regular pre-open'>
#insert
</a></li>
<li><a
href='#QueryBuilder#insertBatch'
class='regular pre-open'>
#insertBatch
</a></li>
<li><a
href='#QueryBuilder#update'
class='regular pre-open'>
#update
</a></li>
<li><a
href='#QueryBuilder#delete'
class='regular pre-open'>
#delete
</a></li>
<li><a
href='#QueryBuilder#getCompiledSelect'
class='regular pre-open'>
#getCompiledSelect
</a></li>
<li><a
href='#QueryBuilder#getCompiledInsert'
class='regular pre-open'>
#getCompiledInsert
</a></li>
<li><a
href='#QueryBuilder#getCompiledUpdate'
class='regular pre-open'>
#getCompiledUpdate
</a></li>
<li><a
href='#QueryBuilder#getCompiledDelete'
class='regular pre-open'>
#getCompiledDelete
</a></li>
</ul>
</div>
</li>
<li><a
href='#result'
class=" toggle-sibling">
Result
<span class='icon'></span>
</a>
2016-07-20 16:33:09 -04:00
<div class='toggle-target display-none'>
<ul class='list-reset py1-ul pl1'>
<li class='h5'><span>Instance members</span></li>
<li><a
href='#Result#rowCount'
class='regular pre-open'>
#rowCount
</a></li>
<li><a
href='#Result#columnCount'
class='regular pre-open'>
#columnCount
</a></li>
</ul>
</div>
</li>
</ul>
</div>
<div class='mt1 h6 quiet'>
<a href='http://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
</div>
</div>
</div>
<div class='fix-margin-3'>
2016-07-20 16:33:09 -04:00
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='limit'>
limit
</h3>
</div>
<p>Set the limit clause</p>
<div class='pre p1 fill-light mt0'>limit(sql: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, limit: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>, offset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>sql</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> SQL statement to modify
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>limit</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)</code> Maximum number of rows to fetch
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>offset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>])</code> Number of rows to skip
2014-10-20 16:56:45 -04:00
</div>
2016-07-20 16:33:09 -04:00
</div>
2016-07-20 16:33:09 -04:00
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
Modified SQL statement
</section>
2016-07-20 16:33:09 -04:00
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='quotetable'>
quoteTable
</h3>
</div>
<p>Quote database table name, and set prefix</p>
<div class='pre p1 fill-light mt0'>quoteTable(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> Table name to quote
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
Quoted table name
</section>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='quoteidentifiers'>
quoteIdentifiers
</h3>
</div>
<p>Use the driver&#x27;s escape character to quote identifiers</p>
<div class='pre p1 fill-light mt0'>quoteIdentifiers(str: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)): (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>str</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>))</code> String or array of strings to quote identifiers
</div>
2016-07-20 16:33:09 -04:00
</div>
2016-07-20 16:33:09 -04:00
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code>:
Quoted identifier(s)
</section>
2016-07-20 16:33:09 -04:00
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='truncate'>
truncate
</h3>
</div>
<p>Generate SQL to truncate the passed table</p>
<div class='pre p1 fill-light mt0'>truncate(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> Table to truncate
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
Truncation SQL
</section>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='insertbatch'>
insertBatch
</h3>
</div>
<p>Generate SQL to insert a group of rows</p>
<div class='pre p1 fill-light mt0'>insertBatch(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, data: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to insert to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>data</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>])</code> The array of object containing data to insert
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
Query and data to insert
</section>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='nodequery'>
NodeQuery
</h3>
</div>
<p>Class for connection management</p>
<div class='pre p1 fill-light mt0'>new NodeQuery(config: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>config</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</code> connection parameters
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Instance Members</div>
<div class="clearfix">
<div class='border-bottom' id='NodeQuery#constructor'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>constructor(config)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Constructor</p>
<div class='pre p1 fill-light mt0'>constructor(config: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>config</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</code> connection parameters
</div>
2016-07-20 16:33:09 -04:00
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'><span class="hljs-keyword">let</span> nodeQuery = <span class="hljs-built_in">require</span>(<span class="hljs-string">'ci-node-query'</span>)({
driver: <span class="hljs-string">'mysql'</span>,
connection: {
host: <span class="hljs-string">'localhost'</span>,
user: <span class="hljs-string">'root'</span>,
password: <span class="hljs-string">''</span>,
database: <span class="hljs-string">'mysql'</span>
}
});</pre>
<pre class='p1 overflow-auto round fill-light'><span class="hljs-keyword">let</span> nodeQuery = <span class="hljs-built_in">require</span>(<span class="hljs-string">'ci-node-query'</span>)({
driver: <span class="hljs-string">'sqlite'</span>,
connection: <span class="hljs-string">':memory:'</span>
});</pre>
</section>
</div>
</div>
<div class='border-bottom' id='NodeQuery#getQuery'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>getQuery()</span>
</div>
2016-07-20 16:33:09 -04:00
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Return an existing query builder instance</p>
<div class='pre p1 fill-light mt0'>getQuery(): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object
</section>
2016-07-20 16:33:09 -04:00
</div>
</div>
</div>
2016-07-20 16:33:09 -04:00
</section>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='querybuilder'>
QueryBuilder
</h3>
</div>
<p>Main object that builds SQL queries.</p>
<div class='pre p1 fill-light mt0'>new QueryBuilder(Driver: Driver, Adapter: Adapter)</div>
<p>
Extends
QueryBuilderBase
</p>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>Driver</span> <code class='quiet'>(Driver)</code> The syntax driver for the database
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>Adapter</span> <code class='quiet'>(Adapter)</code> The database module adapter for running queries
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Instance Members</div>
<div class="clearfix">
<div class='border-bottom' id='QueryBuilder#query'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>query(sql, [params], [callback])</span>
</div>
2016-07-20 16:33:09 -04:00
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Run an arbitrary sql query. Run as a prepared statement.</p>
<div class='pre p1 fill-light mt0'>query(sql: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, params: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">array</a>], callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>sql</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code> The sql to execute
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>params</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">array</a>])</code> The query parameters
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">function</a>])</code> Optional callback
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
Returns a promise if no callback is supplied
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#resetQuery'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>resetQuery()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Reset the object state for a new query</p>
<div class='pre p1 fill-light mt0'>resetQuery(): void</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>void</code>:
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#truncate'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>truncate(table, [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Empties the selected database table</p>
<div class='pre p1 fill-light mt0'>truncate(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code> the name of the table to truncate
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">function</a>])</code> Optional callback
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
Returns a promise if no callback is supplied
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#end'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>end()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Closes the database connection for the current adapter</p>
<div class='pre p1 fill-light mt0'>end(): void</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>void</code>:
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#select'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>select(fields)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Specify rows to select in the query</p>
<div class='pre p1 fill-light mt0'>select(fields: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>fields</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>))</code> The fields to select from the current table
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'>query.select(<span class="hljs-string">'foo, bar'</span>); <span class="hljs-comment">// Select multiple fields with a string</span></pre>
<pre class='p1 overflow-auto round fill-light'>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='border-bottom' id='QueryBuilder#from'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>from(tableName)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Specify the database table to select from</p>
<div class='pre p1 fill-light mt0'>from(tableName: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>tableName</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to use for the current query
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'>query.from(<span class="hljs-string">'tableName'</span>);</pre>
<pre class='p1 overflow-auto round fill-light'>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='border-bottom' id='QueryBuilder#like'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>like(field, val, [pos])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add a &#x27;like/ and like&#x27; clause to the query</p>
<div class='pre p1 fill-light mt0'>like(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, val: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, pos: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The value to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>pos</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>both</code>)
)</code> The placement of the wildcard character(s): before, after, or both
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#notLike'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>notLike(field, val, [pos])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add a &#x27;not like/ and not like&#x27; clause to the query</p>
<div class='pre p1 fill-light mt0'>notLike(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, val: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, pos: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The value to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>pos</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>both</code>)
)</code> The placement of the wildcard character(s): before, after, or both
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orLike'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orLike(field, val, [pos])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add an &#x27;or like&#x27; clause to the query</p>
<div class='pre p1 fill-light mt0'>orLike(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, val: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, pos: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The value to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>pos</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>both</code>)
)</code> The placement of the wildcard character(s): before, after, or both
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orNotLike'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orNotLike(field, val, [pos])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add an &#x27;or not like&#x27; clause to the query</p>
<div class='pre p1 fill-light mt0'>orNotLike(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, val: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, pos: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The value to compare to
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>pos</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>both</code>)
)</code> The placement of the wildcard character(s): before, after, or both
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#having'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>having(key, [val])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add a &#x27;having&#x27; clause</p>
<div class='pre p1 fill-light mt0'>having(key: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>), val: [(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>))</code> The name of the field and the comparision operator, or an object
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>([(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)])</code> The value to compare if the value of key is a string
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orHaving'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orHaving(key, [val])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add an &#x27;or having&#x27; clause</p>
<div class='pre p1 fill-light mt0'>orHaving(key: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>), val: [(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>))</code> The name of the field and the comparision operator, or an object
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>([(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)])</code> The value to compare if the value of key is a string
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#where'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>where(key, [val])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;where&#x27; clause</p>
<div class='pre p1 fill-light mt0'>where(key: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>), val: [(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>))</code> The name of the field and the comparision operator, or an object
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>([(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)])</code> The value to compare if the value of key is a string
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orWhere'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orWhere(key, [val])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;or where&#x27; clause</p>
<div class='pre p1 fill-light mt0'>orWhere(key: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>), val: [(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>))</code> The name of the field and the comparision operator, or an object
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>([(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)])</code> The value to compare if the value of key is a string
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#whereIsNull'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>whereIsNull(field)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Select a field that is Null</p>
<div class='pre p1 fill-light mt0'>whereIsNull(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field that has a NULL value
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#whereIsNotNull'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>whereIsNotNull(field)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Specify that a field IS NOT NULL</p>
<div class='pre p1 fill-light mt0'>whereIsNotNull(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name so the field that is not to be null
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orWhereIsNull'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orWhereIsNull(field)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Field is null prefixed with &#x27;OR&#x27;</p>
<div class='pre p1 fill-light mt0'>orWhereIsNull(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orWhereIsNotNull'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orWhereIsNotNull(field)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Field is not null prefixed with &#x27;OR&#x27;</p>
<div class='pre p1 fill-light mt0'>orWhereIsNotNull(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The name of the field
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#whereIn'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>whereIn(key, values)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;where in&#x27; clause</p>
<div class='pre p1 fill-light mt0'>whereIn(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, values: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the field to search
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>values</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the array of items to search in
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orWhereIn'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orWhereIn(key, values)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;or where in&#x27; clause</p>
<div class='pre p1 fill-light mt0'>orWhereIn(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, values: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the field to search
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>values</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the array of items to search in
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#whereNotIn'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>whereNotIn(key, values)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;where not in&#x27; clause</p>
<div class='pre p1 fill-light mt0'>whereNotIn(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, values: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the field to search
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>values</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the array of items to search in
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orWhereNotIn'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orWhereNotIn(key, values)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set a &#x27;or where not in&#x27; clause</p>
<div class='pre p1 fill-light mt0'>orWhereNotIn(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, values: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the field to search
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>values</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the array of items to search in
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#set'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>set(key, [val])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Set values for insertion or updating</p>
<div class='pre p1 fill-light mt0'>set(key: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>), val: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>key</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>))</code> The key or object to use
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>val</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>])</code> The value if using a scalar key
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'>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='p1 overflow-auto round fill-light'>query.set({foo:<span class="hljs-string">'bar'</span>}); <span class="hljs-comment">// Set with an object</span></pre>
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#join'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>join(table, cond, [type])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Add a join clause to the query</p>
<div class='pre p1 fill-light mt0'>join(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, cond: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, type: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table you are joining
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>cond</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The join condition.
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>type</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>&#39;inner&#39;</code>)
)</code> The type of join, which defaults to inner
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#groupBy'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>groupBy(field)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Group the results by the selected field(s)</p>
<div class='pre p1 fill-light mt0'>groupBy(field: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>((<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>))</code> The name of the field to group by
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orderBy'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orderBy(field, [type])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Order the results by the selected field(s)</p>
<div class='pre p1 fill-light mt0'>orderBy(field: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, type: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>field</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The field(s) to order by
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>type</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>]
(default <code>&#39;ASC&#39;</code>)
)</code> The order direction, ASC or DESC
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#limit'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>limit(limit, [offset])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Put a limit on the query</p>
<div class='pre p1 fill-light mt0'>limit(limit: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>, offset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>]): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>limit</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>)</code> The maximum number of rows to fetch
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>offset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>])</code> The row number to start from
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#groupStart'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>groupStart()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Adds an open paren to the current query for logical grouping</p>
<div class='pre p1 fill-light mt0'>groupStart(): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orGroupStart'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orGroupStart()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Adds an open paren to the current query for logical grouping,
prefixed with &#x27;OR&#x27;</p>
<div class='pre p1 fill-light mt0'>orGroupStart(): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#orNotGroupStart'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>orNotGroupStart()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Adds an open paren to the current query for logical grouping,
prefixed with &#x27;OR NOT&#x27;</p>
<div class='pre p1 fill-light mt0'>orNotGroupStart(): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#groupEnd'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>groupEnd()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Ends a logical grouping started with one of the groupStart methods</p>
<div class='pre p1 fill-light mt0'>groupEnd(): <a href="#querybuilder">QueryBuilder</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#querybuilder">QueryBuilder</a></code>:
The Query Builder object, for chaining
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#get'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>get([table], [limit], [offset], [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Get the results of the compiled query</p>
<div class='pre p1 fill-light mt0'>get(table: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>], limit: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>], offset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>], callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>])</code> The table to select from
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>limit</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>])</code> A limit for the query
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>offset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a>])</code> An offset for the query
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>])</code> A callback for receiving the result
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
If no callback is passed, a promise is returned
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'>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='p1 overflow-auto round fill-light'>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='p1 overflow-auto round fill-light'>query.get(callback); <span class="hljs-comment">// Get the results of a query generated with other methods</span></pre>
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#insert'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>insert(table, [data], [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Run the generated insert query</p>
<div class='pre p1 fill-light mt0'>insert(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, data: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>], callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to insert into
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>data</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>])</code> Data to insert, if not already added with the &#x27;set&#x27; method
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>])</code> Callback for handling response from the database
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
If no callback is passed, a promise is returned
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#insertBatch'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>insertBatch(table, data, [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Insert multiple sets of rows at a time</p>
<div class='pre p1 fill-light mt0'>insertBatch(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, data: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>, callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to insert into
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>data</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> The array of objects containing data rows to insert
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>])</code> Callback for handling database response
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
If no callback is passed, a promise is returned
<div class='py1 quiet mt1 prose-big'>Example</div>
<pre class='p1 overflow-auto round fill-light'>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='p1 overflow-auto round fill-light'>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='border-bottom' id='QueryBuilder#update'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>update(table, [data], [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Run the generated update query</p>
<div class='pre p1 fill-light mt0'>update(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, data: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>], callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to insert into
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>data</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>])</code> Data to insert, if not already added with the &#x27;set&#x27; method
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>])</code> Callback for handling response from the database
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
If no callback is passed, a promise is returned
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#delete'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>delete(table, [where], [callback])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Run the generated delete query</p>
<div class='pre p1 fill-light mt0'>delete(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, where: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>], callback: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>]): (void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> The table to insert into
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>where</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>])</code> Where clause for delete statement
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function">Function</a>])</code> Callback for handling response from the database
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code>(void | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>)</code>:
If no callback is passed, a promise is returned
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#getCompiledSelect'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>getCompiledSelect([table], [reset])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Return generated select query SQL</p>
<div class='pre p1 fill-light mt0'>getCompiledSelect(table: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>], reset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>])</code> the name of the table to retrieve from
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>reset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]
(default <code>true</code>)
)</code> Whether to reset the query builder so another query can be built
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
The compiled sql statement
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#getCompiledInsert'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>getCompiledInsert(table, [reset])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Return generated insert query SQL</p>
<div class='pre p1 fill-light mt0'>getCompiledInsert(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, reset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the name of the table to insert into
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>reset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]
(default <code>true</code>)
)</code> Whether to reset the query builder so another query can be built
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
The compiled sql statement
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#getCompiledUpdate'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>getCompiledUpdate(table, [reset])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Return generated update query SQL</p>
<div class='pre p1 fill-light mt0'>getCompiledUpdate(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, reset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the name of the table to update
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>reset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]
(default <code>true</code>)
)</code> Whether to reset the query builder so another query can be built
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
The compiled sql statement
</section>
</div>
</div>
<div class='border-bottom' id='QueryBuilder#getCompiledDelete'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>getCompiledDelete(table, [reset])</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Return generated delete query SQL</p>
<div class='pre p1 fill-light mt0'>getCompiledDelete(table: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, reset: [<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>table</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code> the name of the table to delete from
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>reset</span> <code class='quiet'>([<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>]
(default <code>true</code>)
)</code> Whether to reset the query builder so another query can be built
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>:
The compiled sql statement
</section>
</div>
</div>
</div>
</section>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='result'>
Result
</h3>
</div>
<p>Query result object</p>
<div class='pre p1 fill-light mt0'>new Result(rows: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>, columns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>rows</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the data rows of the result
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>columns</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>)</code> the column names in the result
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Instance Members</div>
<div class="clearfix">
<div class='border-bottom' id='Result#rowCount'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>rowCount()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Get the number of rows returned by the query</p>
<div class='pre p1 fill-light mt0'>rowCount(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>:
the number of rows in the result
</section>
</div>
</div>
<div class='border-bottom' id='Result#columnCount'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>columnCount()</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
<section class='p2 mb2 clearfix bg-white minishadow'>
<p>Get the number of columns returned by the query</p>
<div class='pre p1 fill-light mt0'>columnCount(): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></code>:
the number of columns in the result
</section>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<script src='assets/anchor.js'></script>
<script src='assets/site.js'></script>
2014-10-20 16:56:45 -04:00
</body>
</html>