Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sql-query

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-query - npm Package Compare versions

Comparing version 0.1.25 to 0.1.26

4

Changelog.md

@@ -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;

25

lib/Remove.js

@@ -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
);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc