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

sqlquerybuilder

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlquerybuilder - npm Package Compare versions

Comparing version 0.0.31 to 0.0.32

2

lib/where.js

@@ -192,3 +192,3 @@ module.exports = function where(self) {

whereString += pars[1].toUpperCase() === "NULL" ? " IS " : " = ";
if(isNaN(pars[1] && pars[1].toUpperCase() !== 'NULL')){
if(isNaN(pars[1]) && pars[1].toUpperCase() !== "NULL"){
whereString += "'";

@@ -195,0 +195,0 @@ whereString += pars[1] + "'" + ")";

{
"name": "sqlquerybuilder",
"version": "0.0.31",
"version": "0.0.32",
"description": "Highly opinionated Sql Server Query Writer, mostly for internal use.",

@@ -5,0 +5,0 @@ "main": "./lib/index",

@@ -652,2 +652,42 @@ /**

});
it('Should give the propery query for a view with guid and single equals', function (done) {
var reqquery ={ filters: 'IsActive=true&&TerritoryId=A1139D28-CE9E-4EF9-A595-A31401026A65',
sidx: 'Created',
sord: 'desc',
RenderFormat: 'paged',
page: '1',
pagePercent: 'Infinity',
total: '0',
rows: '100',
totalPages: '0' };
var query = sqlBuilder()
.from('MaintenanceAssignmentView')
.select({
'Status': null,
'Description': 'Description',
'CreatorFirstName': 'CreatorFirstName',
'TerritoryId': 'TerritoryId',
'ServiceTicketId': 'ServiceTicketId',
'ServiceTicketNumber': 'ServiceTicketNumber',
'YardId': 'YardId',
'Yard': 'Yard',
'Equipment': 'Equipment',
'JobInstructions': 'JobInstructions',
'Categories': 'Categories',
'Created': 'Created',
'Id': 'Id',
"(CreatorFirstName + ' ' + CreatorLastName)": 'CreatorName',
"(CASE WHEN Status = 'Rejected' Then 1 else 1 END)": 'IsRejected'
})
.where({Status: 'Complete'})
.processListRequest(reqquery)
.build();
query.should
.equal("WITH SelectedItems AS (SELECT Status, Description AS 'Description', CreatorFirstName AS 'CreatorFirstName', TerritoryId AS 'TerritoryId', ServiceTicketId AS 'ServiceTicketId', ServiceTicketNumber AS 'ServiceTicketNumber', YardId AS 'YardId', Yard AS 'Yard', Equipment AS 'Equipment', JobInstructions AS 'JobInstructions', Categories AS 'Categories', Created AS 'Created', Id AS 'Id', (CreatorFirstName + ' ' + CreatorLastName) AS 'CreatorName', (CASE WHEN Status = 'Rejected' Then 1 else 1 END) AS 'IsRejected', ROW_NUMBER() OVER (ORDER BY Created DESC) AS Position FROM MaintenanceAssignmentView WHERE MaintenanceAssignmentView.Status = 'Complete' AND MaintenanceAssignmentView.IsActive = 1 AND (TerritoryId = 'A1139D28-CE9E-4EF9-A595-A31401026A65')) SELECT *, (Select MAX(Position) From SelectedItems) as 'TotalRows' FROM SelectedItems WHERE Position > 0 AND Position <= 100 ")
done();
});
});
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