Update docs

This commit is contained in:
Timothy Warren 2014-10-30 11:10:47 -04:00
parent e4c62ef3e7
commit 9c1d7e09b3
5 changed files with 42 additions and 38 deletions

View File

@ -39,4 +39,5 @@ A node query builder for various SQL databases, based on CodeIgniter's query bui
* Generated documentation is in the docs/ folder * Generated documentation is in the docs/ folder
* `tests/query-builder-base.js` contains a lot of usage examples * `tests/query-builder-base.js` contains a lot of usage examples
* The `tests/adapters` folder contains examples of how to set up a connection for the appropriate database library * The `tests/adapters` folder contains examples of how to set up a connection for the appropriate database library
* The documentation generated for the latest dev build is also [Available](https://github.timshomepage.net/node-query/docs/)

View File

@ -119,6 +119,7 @@ query.select('foo')
<li>Generated documentation is in the docs/ folder </li> <li>Generated documentation is in the docs/ folder </li>
<li><code>tests/query-builder-base.js</code> contains a lot of usage examples</li> <li><code>tests/query-builder-base.js</code> contains a lot of usage examples</li>
<li>The <code>tests/adapters</code> folder contains examples of how to set up a connection for the appropriate database library</li> <li>The <code>tests/adapters</code> folder contains examples of how to set up a connection for the appropriate database library</li>
<li>The documentation generated for the latest dev build is also <a href="https://github.timshomepage.net/node-query/docs/">Available</a></li>
</ul></article> </ul></article>
</section> </section>

View File

@ -383,7 +383,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-821">line 821</a> <a href="query-builder.js.html#sunlight-1-line-823">line 823</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -519,7 +519,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-402">line 402</a> <a href="query-builder.js.html#sunlight-1-line-404">line 404</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -764,7 +764,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-744">line 744</a> <a href="query-builder.js.html#sunlight-1-line-746">line 746</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -955,7 +955,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-883">line 883</a> <a href="query-builder.js.html#sunlight-1-line-885">line 885</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1154,7 +1154,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-861">line 861</a> <a href="query-builder.js.html#sunlight-1-line-863">line 863</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1355,7 +1355,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-844">line 844</a> <a href="query-builder.js.html#sunlight-1-line-846">line 846</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1546,7 +1546,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-872">line 872</a> <a href="query-builder.js.html#sunlight-1-line-874">line 874</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1641,7 +1641,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-349">line 349</a> <a href="query-builder.js.html#sunlight-1-line-351">line 351</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1788,7 +1788,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-626">line 626</a> <a href="query-builder.js.html#sunlight-1-line-628">line 628</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1875,7 +1875,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-725">line 725</a> <a href="query-builder.js.html#sunlight-1-line-727">line 727</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1962,7 +1962,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-689">line 689</a> <a href="query-builder.js.html#sunlight-1-line-691">line 691</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2147,7 +2147,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-475">line 475</a> <a href="query-builder.js.html#sunlight-1-line-477">line 477</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2357,7 +2357,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-767">line 767</a> <a href="query-builder.js.html#sunlight-1-line-769">line 769</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2539,7 +2539,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-787">line 787</a> <a href="query-builder.js.html#sunlight-1-line-789">line 789</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2577,7 +2577,7 @@
<h5>Example</h5> <h5>Example</h5>
<pre class="sunlight-highlight-javascript">query.insertBatch(&#x27;foo&#x27;,[{id:1,val:&#x27;bar&#x27;},{id:2,val:&#x27;baz&#x27;}], callbackFunction);S</pre> <pre class="sunlight-highlight-javascript">query.insertBatch(&#x27;foo&#x27;,[{id:1,val:&#x27;bar&#x27;},{id:2,val:&#x27;baz&#x27;}], callbackFunction);</pre>
@ -2771,7 +2771,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-601">line 601</a> <a href="query-builder.js.html#sunlight-1-line-603">line 603</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2997,7 +2997,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-424">line 424</a> <a href="query-builder.js.html#sunlight-1-line-426">line 426</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3176,7 +3176,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-677">line 677</a> <a href="query-builder.js.html#sunlight-1-line-679">line 679</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3402,7 +3402,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-437">line 437</a> <a href="query-builder.js.html#sunlight-1-line-439">line 439</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3593,7 +3593,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-649">line 649</a> <a href="query-builder.js.html#sunlight-1-line-651">line 651</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3681,7 +3681,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-702">line 702</a> <a href="query-builder.js.html#sunlight-1-line-704">line 704</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3866,7 +3866,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-489">line 489</a> <a href="query-builder.js.html#sunlight-1-line-491">line 491</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4092,7 +4092,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-450">line 450</a> <a href="query-builder.js.html#sunlight-1-line-452">line 452</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4180,7 +4180,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-714">line 714</a> <a href="query-builder.js.html#sunlight-1-line-716">line 716</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4406,7 +4406,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-463">line 463</a> <a href="query-builder.js.html#sunlight-1-line-465">line 465</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4591,7 +4591,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-515">line 515</a> <a href="query-builder.js.html#sunlight-1-line-517">line 517</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4750,7 +4750,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-539">line 539</a> <a href="query-builder.js.html#sunlight-1-line-541">line 541</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4909,7 +4909,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-563">line 563</a> <a href="query-builder.js.html#sunlight-1-line-565">line 565</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5048,7 +5048,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-368">line 368</a> <a href="query-builder.js.html#sunlight-1-line-370">line 370</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5230,7 +5230,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-575">line 575</a> <a href="query-builder.js.html#sunlight-1-line-577">line 577</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5440,7 +5440,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-803">line 803</a> <a href="query-builder.js.html#sunlight-1-line-805">line 805</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5625,7 +5625,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-503">line 503</a> <a href="query-builder.js.html#sunlight-1-line-505">line 505</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5784,7 +5784,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-527">line 527</a> <a href="query-builder.js.html#sunlight-1-line-529">line 529</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5943,7 +5943,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-551">line 551</a> <a href="query-builder.js.html#sunlight-1-line-553">line 553</a>
</li> </li>
</ul> </ul>
</dd> </dd>

View File

@ -262,7 +262,7 @@ var QueryBuilder = function(driver, adapter) {
_p.mixedSet('whereMap', 'both', args.key, args.val); _p.mixedSet('whereMap', 'both', args.key, args.val);
_p.mixedSet('whereValues', 'value', args.key, args.val); _p.mixedSet('whereValues', 'value', args.key, args.val);
}, },
where: function(key, val, conj) { where: function(key, val, defaultConj) {
// Normalize key and value and insert into state.whereMap // Normalize key and value and insert into state.whereMap
_p.whereMixedSet(key, val); _p.whereMixedSet(key, val);
@ -280,7 +280,8 @@ var QueryBuilder = function(driver, adapter) {
lastItem = state.queryMap[state.queryMap.length - 1]; lastItem = state.queryMap[state.queryMap.length - 1];
// Determine the correct conjunction // Determine the correct conjunction
if (state.queryMap.length &lt; 1 || firstItem.conjunction.contains('JOIN')) var conj = defaultConj;
if (state.queryMap.length === 0 || firstItem.conjunction.contains('JOIN'))
{ {
conj = " WHERE "; conj = " WHERE ";
} }
@ -355,6 +356,7 @@ var QueryBuilder = function(driver, adapter) {
vals = state.values.concat(state.whereValues); vals = state.values.concat(state.whereValues);
} }
//console.log(state.queryMap);
//console.log(sql); //console.log(sql);
//console.log(vals); //console.log(vals);
//console.log('------------------------'); //console.log('------------------------');
@ -856,7 +858,7 @@ var QueryBuilder = function(driver, adapter) {
* @param {String} table - The table to insert into * @param {String} table - The table to insert into
* @param {Array} data - The array of objects containing data rows to insert * @param {Array} data - The array of objects containing data rows to insert
* @param {Function} callback - Callback for handling database response * @param {Function} callback - Callback for handling database response
* @example query.insertBatch('foo',[{id:1,val:'bar'},{id:2,val:'baz'}], callbackFunction);S * @example query.insertBatch('foo',[{id:1,val:'bar'},{id:2,val:'baz'}], callbackFunction);
* @return void * @return void
*/ */
this.insertBatch = function(/* table, data, callback */) { this.insertBatch = function(/* table, data, callback */) {

View File

@ -1,6 +1,6 @@
{ {
"name": "ci-node-query", "name": "ci-node-query",
"version": "0.1.0", "version": "0.1.1",
"description": "A query builder for node based on the one in CodeIgniter", "description": "A query builder for node based on the one in CodeIgniter",
"author": "Timothy J Warren <tim@timshomepage.net>", "author": "Timothy J Warren <tim@timshomepage.net>",
"engines": { "engines": {