More style fixes

This commit is contained in:
Timothy Warren 2015-12-08 10:40:52 -05:00
parent dd4d7e2db0
commit c3bb687321
4 changed files with 9 additions and 19 deletions

View File

@ -95,9 +95,9 @@ module.exports = class QueryBuilder {
like = `${field} ${like} ?`; like = `${field} ${like} ?`;
if (pos == 'before') { if (pos === 'before') {
val = `%${val}`; val = `%${val}`;
} else if (pos == 'after') { } else if (pos === 'after') {
val = `${val}%`; val = `${val}%`;
} else { } else {
val = `%${val}%`; val = `%${val}%`;
@ -261,12 +261,6 @@ module.exports = class QueryBuilder {
vals = this.state.values.concat(this.state.whereValues); vals = this.state.values.concat(this.state.whereValues);
} }
//console.log(this.state);
//console.log(sql);
//console.log(vals);
//console.log(callback);
//console.log('------------------------');
// Reset the state so another query can be built // Reset the state so another query can be built
this._resetState(); this._resetState();

View File

@ -35,12 +35,10 @@ module.exports = (function() {
/** /**
* SQL to insert a group of rows * SQL to insert a group of rows
* *
* @param {String} table - The table to insert to
* @param {Array} [data] - The array of object containing data to insert
* @return {void} * @return {void}
* @throws {Error} * @throws {Error}
*/ */
driver.insertBatch = function(table, data) { driver.insertBatch = function() {
throw new Error('Not Implemented'); throw new Error('Not Implemented');
}; };

View File

@ -7,8 +7,7 @@
*/ */
module.exports = (function() { module.exports = (function() {
delete require.cache[require.resolve('../Driver')]; delete require.cache[require.resolve('../Driver')];
let driver = require('../Driver'), let driver = require('../Driver');
helpers = require('../helpers');
// Sqlite doesn't have a truncate command // Sqlite doesn't have a truncate command
driver.hasTruncate = false; driver.hasTruncate = false;
@ -29,10 +28,7 @@ module.exports = (function() {
vals = [], vals = [],
cols = [], cols = [],
fields = [], fields = [],
first = data.shift(), first = data.shift();
params = [],
paramString = '',
paramList = [];
data.forEach(obj => { data.forEach(obj => {
let row = []; let row = [];
@ -47,7 +43,7 @@ module.exports = (function() {
// Get the field names from the keys of the first // Get the field names from the keys of the first
// object to be inserted // object to be inserted
fields = Object.keys(first); fields = Object.keys(first);
Object.keys(first).forEach(key => { fields.forEach(key => {
cols.push(`'${driver._quote(first[key])}' AS ${driver.quoteIdentifiers(key)}`); cols.push(`'${driver._quote(first[key])}' AS ${driver.quoteIdentifiers(key)}`);
}); });

View File

@ -53,7 +53,9 @@ let helpers = {
let output = []; let output = [];
// Empty case // Empty case
if (arr.length === 0) return output; if (arr.length === 0) {
return output;
}
arr.forEach(obj => { arr.forEach(obj => {
if (! helpers.isUndefined(obj[key])) { if (! helpers.isUndefined(obj[key])) {