Make third init argument optional in some cases

This commit is contained in:
Timothy Warren 2014-12-01 14:08:10 -05:00
parent bc959b4952
commit da085f9e14
5 changed files with 6 additions and 5 deletions

View File

@ -11,10 +11,12 @@ var NodeQuery = function() {
* @alias module:node-query * @alias module:node-query
* @param {String} drivername - The name of the database type, eg. mysql or pg * @param {String} drivername - The name of the database type, eg. mysql or pg
* @param {Object} connObject - A connection object from the database library you are connecting with * @param {Object} connObject - A connection object from the database library you are connecting with
* @param {String} connLib - The name of the db connection library you are using, eg. mysql or mysql2 * @param {String} [connLib] - The name of the db connection library you are using, eg. mysql or mysql2. Optional if the same as drivername
* @return {queryBuilder} * @return {queryBuilder}
*/ */
this.init = function (driverType, connObject, connLib) { this.init = function (driverType, connObject, connLib) {
connLib = connLib || driverType;
var fs = require('fs'), var fs = require('fs'),
qb = require('./query-builder'); qb = require('./query-builder');

View File

@ -230,7 +230,6 @@ var QueryBuilder = function(driver, adapter) {
}); });
}, },
whereNull: function(field, stmt, conj) { whereNull: function(field, stmt, conj) {
conj = conj || 'AND';
field = driver.quoteIdentifiers(field); field = driver.quoteIdentifiers(field);
var item = field + ' ' + stmt; var item = field + ' ' + stmt;

View File

@ -1,6 +1,6 @@
{ {
"name": "ci-node-query", "name": "ci-node-query",
"version": "1.2.0", "version": "1.2.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": {

View File

@ -17,7 +17,7 @@ var connection = mysql.createConnection(config.conn);
// Set up the query builder object // Set up the query builder object
var nodeQuery = require('../../lib/node-query'); var nodeQuery = require('../../lib/node-query');
var qb = nodeQuery.init('mysql', connection, adapterName); var qb = nodeQuery.init('mysql', connection);
// Set up the test base // Set up the test base
testBase._setUp(qb, function(test, err, rows) { testBase._setUp(qb, function(test, err, rows) {

View File

@ -22,7 +22,7 @@ connection.connect(function(err) {
// Set up the query builder object // Set up the query builder object
var nodeQuery = require('../../lib/node-query'); var nodeQuery = require('../../lib/node-query');
var qb = nodeQuery.init('pg', connection, adapterName); var qb = nodeQuery.init('pg', connection);
// Set up the test base // Set up the test base