Skip to content

Commit

Permalink
Fixed linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaumgartl committed Oct 6, 2014
1 parent e4dd624 commit 440e861
Show file tree
Hide file tree
Showing 38 changed files with 177 additions and 176 deletions.
2 changes: 1 addition & 1 deletion base/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function selectCol(dc, sels) {
for (i = 0; i < sels.length; i++) {
e = sels[i].expr;
rc = getRefColumns(e);
rp = getRefColPos(rc, columns)
rp = getRefColPos(rc, columns);

exprs.push(e);
refPos.push(rp);
Expand Down
2 changes: 1 addition & 1 deletion base/distinct.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
module.exports = function (dc){
dc.data = distinct(dc.data);
return dc;
}
};

function distinct(data){
var res = [];
Expand Down
8 changes: 4 additions & 4 deletions base/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function leftJoin(ta ,tb, on){
for (k = 0; k < acols[j].length; k++) {
tbCol = acols[j][k];
if (tbCol.table == ka[i].table && tbCol.column == ka[i].column) {
apos.push(j)
apos.push(j);
found = true;
break;
}
Expand All @@ -64,7 +64,7 @@ function leftJoin(ta ,tb, on){
for (k = 0; k < bcols[j].length; k++) {
tbCol = bcols[j][k];
if (tbCol.table == kb[i].table && tbCol.column == kb[i].column) {
bpos.push(j)
bpos.push(j);
found = true;
break;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ function innerJoin(ta ,tb, on){
for (k = 0; k < acols[j].length; k++) {
tbCol = acols[j][k];
if (tbCol.table == ka[i].table && tbCol.column == ka[i].column) {
apos.push(j)
apos.push(j);
found = true;
break;
}
Expand All @@ -195,7 +195,7 @@ function innerJoin(ta ,tb, on){
for (k = 0; k < bcols[j].length; k++) {
tbCol = bcols[j][k];
if (tbCol.table == kb[i].table && tbCol.column == kb[i].column) {
bpos.push(j)
bpos.push(j);
found = true;
break;
}
Expand Down
8 changes: 4 additions & 4 deletions base/mcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Cache.prototype.get = function(key) {
pb = pb.body
}
return pb;
}
};

Cache.prototype.set = function(key, value) {
//remove the last ono
Expand All @@ -42,12 +42,12 @@ Cache.prototype.set = function(key, value) {
this.map[key] = {
body : value,
pos : this.pos
}
};
this.stair[this.pos] = key;
return this.pos++;
}
};

Cache.prototype.top = function(n) {
n = n || this.pos;
return this.stair.slice(0, n);
}
};
6 changes: 3 additions & 3 deletions base/procedure.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ function regularOnExpr(on) {
var ons = {
left : [],
right: []
}
};
var rel;
for (var i = 0; i < rels.length; i++) {
rel = rels[i];
ons.left.push({
table : rel.left.table,
column: rel.left.column
})
});
ons.right.push({
table : rel.right.table,
column: rel.right.column
Expand Down Expand Up @@ -220,5 +220,5 @@ Task.prototype.run = function(cb) {
cb(null);
}
});
}
};

4 changes: 2 additions & 2 deletions base/topology.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function order(stmts) {
type : 'var',
name : '__return',
members : []
}
};
nr.right = s.stmt.expr;

stmts[i].stmt = nr;
Expand All @@ -53,7 +53,7 @@ function order(stmts) {
o = {
'var' : v,
'deps': deps
}
};
nodes.push(o);
}

Expand Down
2 changes: 1 addition & 1 deletion base/where.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Engine = require('../lib/engine');
var AstHelper = require('../lib/ast_helper');

var runExpr = Engine.run;
var fillExprOnRow = AstHelper.fillExprOnRow
var fillExprOnRow = AstHelper.fillExprOnRow;

module.exports = filter;

Expand Down
10 changes: 5 additions & 5 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var kvInfo = {
prefixMatch : true,
rangeQuery : true
}
}
};

var dbInfo = {
kv: {
Expand All @@ -39,7 +39,7 @@ var dbInfo = {
storageType : 'sql',
storageEngine : Mysql
}
}
};


function main() {
Expand All @@ -53,14 +53,14 @@ function main() {
"SELECT * FROM kv.user WHERE id LIKE '1%'",
"SELECT type, MAX(age), COUNT(id) FROM kv.user WHERE id BETWEEN '03' AND '10' GROUP BY type ORDER BY MAX(age) DESC",
"SELECT * from mysql.shop where shop_id > 5"
]
];

var concurrentJoinSQL = [
"$a := select * from kv.user where id BETWEEN '03' and '10'",
"$b := select * from mysql.shop where shop_id > 5",
"$c := select a.type , a.id ,b.name, b.title from $a INNER JOIN $b ON a.type = b.type WHERE a.id > '04'",
"return $c"
]
];

var sequentialJoinSQL = [
"$a := select * from kv.user where id BETWEEN '03' and '10'",
Expand All @@ -70,7 +70,7 @@ function main() {
"$b := select * from mysql.shop where type in $a.type",
"$c := select a.type , a.id ,b.name, b.title from $a INNER JOIN $b ON a.type = b.type WHERE a.id > '04'",
"return [$b, $c]"
]
];

printSeperator();

Expand Down
8 changes: 4 additions & 4 deletions demo/kv.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
singleQuery : singleQuery,
rangeQuery : rangeQuery,
likeQuery : likeQuery
}
};

function singleQuery(k) {
var rows = data;
Expand All @@ -37,7 +37,7 @@ function singleQuery(k) {
var ret = {
columns : columns,
data : []
}
};
for (var i = 0; i < rows.length; i++) {
row = rows[i];
if (row[0] == k) {
Expand All @@ -55,7 +55,7 @@ function rangeQuery(beg, end) {
var ret = {
columns : columns,
data : []
}
};
for (var i = 0; i < rows.length; i++) {
row = rows[i];
if (row[0] >= beg && row[0] < end) {
Expand All @@ -74,7 +74,7 @@ function likeQuery(str) {
var ret = {
columns : columns,
data : []
}
};
for (var i = 0; i < rows.length; i++) {
row = rows[i];
if (row[0].indexOf(str) == 0) {
Expand Down
6 changes: 3 additions & 3 deletions demo/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Author :windyrobin <[email protected]>

var nQuery = require('../index')
var nQuery = require('../index');

var Adapter = nQuery.Adapter;
var Context = nQuery.Context;
Expand All @@ -16,11 +16,11 @@ var dbInfo = {};

exports.setDBInfo = function(info) {
dbInfo = info;
}
};

exports.setKVInfo = function(info) {
kvInfo = info;
}
};

exports.load = load;

Expand Down
4 changes: 2 additions & 2 deletions demo/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var dc = {
['onesa', 'd', 8, 'summer', 320],
['miller', 'd', 9, 'summer', 320]
]
}
};

exports.query = function(str, cb) {
var dc;
Expand All @@ -36,7 +36,7 @@ exports.query = function(str, cb) {
return;
}
cb(null, dc);
}
};

var doSelectFilter = Executor.doSelectFilter;

Expand Down
20 changes: 10 additions & 10 deletions lib/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var escapeMap = {
'\r' : '\\r',
'\t' : '\\t',
'\x1a': '\\Z', /**< EOF */
'\\' : '\\\\',
'\\' : '\\\\'
// '%' : '\\%',
// '_' : '\_'
};
Expand Down Expand Up @@ -111,7 +111,7 @@ function binaryToSQL(e) {

function aggrToSQL(e) {
var args = e.args;
var expr = args.expr
var expr = args.expr;
var str = exprToSQL(args.expr);
var name = e.name;
if (name == 'COUNT') {
Expand Down Expand Up @@ -185,11 +185,11 @@ function exprToSQL(e) {

function js2nSQLExpr(val) {
var type = typeof val;
var obj = {}
var obj = {};
switch (type) {
case 'string':
case 'number':
obj.type = type
obj.type = type;
obj.value = val;
break;
case 'boolean':
Expand All @@ -212,7 +212,7 @@ function js2nSQLExpr(val) {
obj.type = 'object';
obj.value = val;
}
break
break;
default:
obj.type = 'unknown';
}
Expand All @@ -231,7 +231,7 @@ function unionToSQL(s, options) {
res.push(str);
while (s._next) {
str = selectToSQL(s._next, options);
res.push('UNION')
res.push('UNION');
res.push(str);
s = s._next;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ function updateToSQL(stmt, options) {
res.push(cs.join(', '));

if (stmt.where && stmt.where != '') {
str = 'WHERE '
str = 'WHERE ';
str += exprToSQL(stmt.where);
res.push(str);
}
Expand All @@ -381,15 +381,15 @@ function replace_insertToSQL(stmt, options) {
options = options || {};
var res = [];
res.push(stmt.type.toUpperCase());
res.push('INTO')
res.push('INTO');
if (options.keep_db === false) {
res.push(stmt.table);
} else {
res.push(stmt.db + '.' + stmt.table);
}

res.push('(' + stmt.columns.join(', ') + ')');
res.push('VALUES')
res.push('VALUES');

var i, ele, str;
var cs = [];
Expand Down Expand Up @@ -428,4 +428,4 @@ exports.toSQL = function (stmt, options) {
throw new Error('ERROR TYPE :' + stmt.type + ', NOT SUPPORTED');
}
return res;
}
};
Loading

0 comments on commit 440e861

Please sign in to comment.