From d6059b87d67a69f81f27eba6f3dc44a43f76b02e Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 3 Nov 2014 11:12:27 -0500 Subject: [PATCH] Update package.json and docs --- docs/adapter.js.html | 2 +- docs/driver.js.html | 2 +- docs/helpers.js.html | 2 +- docs/index.html | 9 +++++++-- docs/module-adapter.html | 2 +- docs/module-driver.html | 2 +- docs/module-helpers.html | 2 +- docs/module-node-query.html | 4 ++-- docs/module-query-builder.html | 2 +- docs/module-query-parser.html | 2 +- docs/modules.list.html | 2 +- docs/node-query.js.html | 22 +++++++++++++++++++--- docs/query-builder.js.html | 2 +- docs/query-parser.js.html | 2 +- package.json | 12 +++++++----- 15 files changed, 46 insertions(+), 23 deletions(-) diff --git a/docs/adapter.js.html b/docs/adapter.js.html index 8e1708a..a2502ff 100644 --- a/docs/adapter.js.html +++ b/docs/adapter.js.html @@ -110,7 +110,7 @@ module.exports = { Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/driver.js.html b/docs/driver.js.html index ccd48bc..d54d223 100644 --- a/docs/driver.js.html +++ b/docs/driver.js.html @@ -252,7 +252,7 @@ module.exports = d; Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/helpers.js.html b/docs/helpers.js.html index bec238b..049e737 100644 --- a/docs/helpers.js.html +++ b/docs/helpers.js.html @@ -168,7 +168,7 @@ module.exports = h; Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index 190f882..9617653 100644 --- a/docs/index.html +++ b/docs/index.html @@ -98,13 +98,18 @@
  • mysql
  • mysql2
  • pg
  • +
  • dblite
  • +
  • sqlite3
  • Installation

    npm install ci-node-query

    Basic use

    var nodeQuery = require('ci-node-query');
     
     var connection = ... // Database module connection 
     
     // Three arguments: database type, database connection, database connection library
    -var query = nodeQuery('mysql', connection, 'mysql2');
    +var query = nodeQuery.init('mysql', connection, 'mysql2');
    +
    +// You can also retrieve the instance later
    +query = nodeQuery.getQuery();
     
     query.select('foo')
         .from('bar')
    @@ -142,7 +147,7 @@ query.select('foo')
     					
     		
     		Documentation generated by JSDoc 3.3.0-alpha9
    -		on Fri Oct 31st 2014 using the DocStrap template.
     		
     				
    diff --git a/docs/module-adapter.html b/docs/module-adapter.html
    index eae7e25..f56da2d 100644
    --- a/docs/module-adapter.html
    +++ b/docs/module-adapter.html
    @@ -354,7 +354,7 @@
     					
     		
     		Documentation generated by JSDoc 3.3.0-alpha9
    -		on Fri Oct 31st 2014 using the DocStrap template.
     		
     				
    diff --git a/docs/module-driver.html b/docs/module-driver.html
    index 5caa99f..12aaeee 100644
    --- a/docs/module-driver.html
    +++ b/docs/module-driver.html
    @@ -170,7 +170,7 @@
     					
     		
     		Documentation generated by JSDoc 3.3.0-alpha9
    -		on Fri Oct 31st 2014 using the DocStrap template.
     		
     				
    diff --git a/docs/module-helpers.html b/docs/module-helpers.html
    index e3431db..1227287 100644
    --- a/docs/module-helpers.html
    +++ b/docs/module-helpers.html
    @@ -686,7 +686,7 @@ function name, eg isNumber

    Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/module-node-query.html b/docs/module-node-query.html index f57d395..974c509 100644 --- a/docs/module-node-query.html +++ b/docs/module-node-query.html @@ -224,7 +224,7 @@ @@ -358,7 +358,7 @@ Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/module-query-builder.html b/docs/module-query-builder.html index 50fd3d9..8959726 100644 --- a/docs/module-query-builder.html +++ b/docs/module-query-builder.html @@ -6007,7 +6007,7 @@ prefixed with 'OR NOT'

    Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/module-query-parser.html b/docs/module-query-parser.html index 170875d..d4b1af1 100644 --- a/docs/module-query-parser.html +++ b/docs/module-query-parser.html @@ -466,7 +466,7 @@ Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/modules.list.html b/docs/modules.list.html index ad2f29d..dc58435 100644 --- a/docs/modules.list.html +++ b/docs/modules.list.html @@ -158,7 +158,7 @@ Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/node-query.js.html b/docs/node-query.js.html index e2fae77..2abbd8b 100644 --- a/docs/node-query.js.html +++ b/docs/node-query.js.html @@ -78,6 +78,8 @@ /** @module node-query */ var nodeQuery = {}; +var instance = null; + /** * Create a query builder object * @@ -104,11 +106,25 @@ nodeQuery.init = function (driverType, connObject, connLib) { } }); - return qb(require(paths.driver), require(paths.adapter)(connObject)); + instance = qb(require(paths.driver), require(paths.adapter)(connObject)); + + return instance; }; +/** + * Return an existing query builder instance + * + * @return {queryBuilder} + */ +nodeQuery.getQuery = function () { + if ( ! instance) { + throw new Error("No Query Builder instance to return"); + } -module.exports = nodeQuery.init;
    + return instance; +}; + +module.exports = nodeQuery; @@ -129,7 +145,7 @@ module.exports = nodeQuery.init; Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/query-builder.js.html b/docs/query-builder.js.html index b88fb76..0dad13b 100644 --- a/docs/query-builder.js.html +++ b/docs/query-builder.js.html @@ -985,7 +985,7 @@ module.exports = QueryBuilder; Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/docs/query-parser.js.html b/docs/query-parser.js.html index c7ee391..04bd481 100644 --- a/docs/query-parser.js.html +++ b/docs/query-parser.js.html @@ -184,7 +184,7 @@ module.exports = QueryParser; Documentation generated by JSDoc 3.3.0-alpha9 - on Fri Oct 31st 2014 using the DocStrap template. diff --git a/package.json b/package.json index 86775bb..5ee4ff1 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ci-node-query", - "version": "0.2.0", + "version": "1.0.0", "description": "A query builder for node based on the one in CodeIgniter", "author": "Timothy J Warren ", "engines": { @@ -11,14 +11,15 @@ "url": "https://github.com/timw4mail/node-query.git" }, "keywords": [ - "codeigniter", - "mysql2", + "codeigniter", + "mysql2", "mysql", "query builder", "pg", "postgres", "sqlite", - "dblite" + "dblite", + "sqlite3" ], "bugs": { "url": "https://github.com/timw4mail/node-query/issues" @@ -45,7 +46,8 @@ "mysql2": "^0.12.5", "node-firebird": "^0.2.3", "nodeunit": "^0.9.0", - "pg": "^3.6.2" + "pg": "^3.6.2", + "sqlite3": "^3.0.2" }, "peerDependencies": { "mysql": "",