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 = {
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; 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; 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 @@npm install ci-node-query
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')
-
node-query.js,
- line 15
+ line 17
@@ -358,7 +358,7 @@
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'
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 @@
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 @@
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;
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 @@
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 @@
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
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 @@
+ return instance;
+};
+
+module.exports = nodeQuery;
@@ -129,7 +145,7 @@ module.exports = nodeQuery.init;
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;
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;
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