Comparing version 0.1.25 to 0.1.26
@@ -0,1 +1,5 @@ | ||
### v0.1.26 - 16 May 2015 | ||
- Add support for SELECT TOP construct for mssql dialect for limit (#41) | ||
### v0.1.25 - 22 Mar 2015 | ||
@@ -2,0 +6,0 @@ |
@@ -69,1 +69,3 @@ var util = require("util"); | ||
exports.defaultValuesStmt = "DEFAULT VALUES"; | ||
exports.limitAsTop = true; |
@@ -28,3 +28,8 @@ var Where = require("./Where"); | ||
query.push("DELETE FROM"); | ||
// limit as: SELECT TOP n (MSSQL only) | ||
if (Dialect.limitAsTop && sql.hasOwnProperty("limit")) { | ||
query.push("DELETE TOP " + sql.limit + " FROM"); | ||
} else { | ||
query.push("DELETE FROM"); | ||
} | ||
query.push(Dialect.escapeId(sql.table)); | ||
@@ -50,11 +55,13 @@ | ||
// limit | ||
if (sql.hasOwnProperty("limit")) { | ||
if (sql.hasOwnProperty("offset")) { | ||
query.push("LIMIT " + sql.limit + " OFFSET " + sql.offset); | ||
} else { | ||
query.push("LIMIT " + sql.limit); | ||
// limit for all Dialects but MSSQL | ||
if (!Dialect.limitAsTop) { | ||
if (sql.hasOwnProperty("limit")) { | ||
if (sql.hasOwnProperty("offset")) { | ||
query.push("LIMIT " + sql.limit + " OFFSET " + sql.offset); | ||
} else { | ||
query.push("LIMIT " + sql.limit); | ||
} | ||
} else if (sql.hasOwnProperty("offset")) { | ||
query.push("OFFSET " + sql.offset); | ||
} | ||
} else if (sql.hasOwnProperty("offset")) { | ||
query.push("OFFSET " + sql.offset); | ||
} | ||
@@ -61,0 +68,0 @@ |
@@ -213,2 +213,7 @@ var Helpers = require('./Helpers'); | ||
// limit as: SELECT TOP n (MSSQL only) | ||
if (Dialect.limitAsTop && sql.hasOwnProperty("limit")) { | ||
query.push("TOP " + sql.limit); | ||
} | ||
for (i = 0; i < sql.from.length; i++) { | ||
@@ -403,11 +408,13 @@ sql.from[i].a = "t" + (i + 1); | ||
// limit | ||
if (sql.hasOwnProperty("limit")) { | ||
if (sql.hasOwnProperty("offset")) { | ||
query.push("LIMIT " + sql.limit + " OFFSET " + sql.offset); | ||
} else { | ||
query.push("LIMIT " + sql.limit); | ||
// limit for all Dialects but MSSQL | ||
if (!Dialect.limitAsTop) { | ||
if (sql.hasOwnProperty("limit")) { | ||
if (sql.hasOwnProperty("offset")) { | ||
query.push("LIMIT " + sql.limit + " OFFSET " + sql.offset); | ||
} else { | ||
query.push("LIMIT " + sql.limit); | ||
} | ||
} else if (sql.hasOwnProperty("offset")) { | ||
query.push("OFFSET " + sql.offset); | ||
} | ||
} else if (sql.hasOwnProperty("offset")) { | ||
query.push("OFFSET " + sql.offset); | ||
} | ||
@@ -414,0 +421,0 @@ |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.1.25", | ||
"version": "0.1.26", | ||
"license": "MIT", | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -101,1 +101,7 @@ var common = require('../common'); | ||
); | ||
//Assert that mssql is configured to use the SELECT TOP as a contruct for limit | ||
assert.equal( | ||
dialect.limitAsTop, | ||
true | ||
); |
@@ -101,1 +101,7 @@ var common = require('../common'); | ||
); | ||
//For all dialects but mssql limitAsTop should be undefined or false | ||
assert.equal( | ||
dialect.limitAsTop || false, | ||
false | ||
); |
@@ -106,1 +106,7 @@ var common = require('../common'); | ||
); | ||
//For all dialects but mssql limitAsTop should be undefined or false | ||
assert.equal( | ||
dialect.limitAsTop || false, | ||
false | ||
); |
@@ -101,1 +101,7 @@ var common = require('../common'); | ||
); | ||
//For all dialects but mssql limitAsTop should be undefined or false | ||
assert.equal( | ||
dialect.limitAsTop || false, | ||
false | ||
); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
62936
2148
0