sqlquerybuilder
Advanced tools
Comparing version 0.0.22 to 0.0.23
module.exports = function ordering(self) { | ||
self.orderBy = function orderBy(orderByInput, direction) { | ||
self.orderBy = function orderBy(orderByInput, direction, skipAlias) { | ||
var idx = self._selectAliases.indexOf(orderByInput); | ||
@@ -28,3 +28,3 @@ if (idx !== -1) { | ||
} | ||
} else { | ||
} else if(!skipAlias) { | ||
orderByInput = self._sqlObject.fromAlias + "." + orderByInput; | ||
@@ -31,0 +31,0 @@ } |
{ | ||
"name": "sqlquerybuilder", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "Highly opinionated Sql Server Query Writer, mostly for internal use.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
@@ -179,2 +179,8 @@ /** | ||
it('It should be able to use a function as a select parameter', function (done) { | ||
// var query = sqlBuilder().from('Items').selectJoin(q) | ||
done(); | ||
}); | ||
}); |
@@ -119,2 +119,7 @@ /** | ||
it('it is called with skip alias adding should not prefix table name', function (done) { | ||
(sqlBuilder().select({"c.Name": "Name", "at.Name": "CustomerType.Name"}).from("Customers c").join("AccountingProcessTypes at", "c.CustomerType_id", "at.Id").orderBy('SpecialName', 'ASC', true).build()) | ||
.should.equal("SELECT c.Name AS 'Name', at.Name AS 'CustomerType.Name' FROM Customers c JOIN AccountingProcessTypes at ON c.CustomerType_id = at.Id ORDER BY SpecialName ASC "); | ||
done(); | ||
}); | ||
}); |
177681
3783