Comparing version 7.0.0-alpha.2 to 7.0.0-alpha.3
v7.0.0 (2020-??-??) | ||
------------------- | ||
[change] Updated to latest Tedious 8 | ||
[change] Updated to latest Tedious 9 | ||
[change] Piped streams no longer have errors forwarded on to them ([1028](https://github.com/tediousjs/node-mssql/pull/1028)) | ||
@@ -5,0 +5,0 @@ [change] tedious config option `trustServerCertificate` defaults to `false` if not supplied ([1030](https://github.com/tediousjs/node-mssql/pull/1030)) |
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "7.0.0-alpha.2", | ||
"version": "7.0.0-alpha.3", | ||
"main": "index.js", | ||
@@ -32,7 +32,7 @@ "repository": "github:tediousjs/node-mssql", | ||
"tarn": "^1.1.5", | ||
"tedious": "^8.3.0" | ||
"tedious": "^9" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^6.2.2", | ||
"standard": "^14" | ||
"standard": "^14.3.4" | ||
}, | ||
@@ -39,0 +39,0 @@ "engines": { |
@@ -97,2 +97,3 @@ # node-mssql | ||
* [Table-Valued Parameter](#table-valued-parameter-tvp) | ||
* [Response Schema](#response-schema) | ||
* [Affected Rows](#affected-rows) | ||
@@ -1510,2 +1511,27 @@ * [JSON support](#json-support) | ||
## Response Schema | ||
An object returned from a `sucessful` basic query would look like the following. | ||
```javascript | ||
{ | ||
recordsets: [ | ||
[ | ||
{ | ||
COL1: "some content", | ||
COL2: "some more content" | ||
} | ||
] | ||
], | ||
recordset: [ | ||
{ | ||
COL1: "some content", | ||
COL2: "some more content" | ||
} | ||
], | ||
output: {}, | ||
rowsAffected: [1] | ||
} | ||
``` | ||
## Affected Rows | ||
@@ -1512,0 +1538,0 @@ |
77
test.js
@@ -1,2 +0,1 @@ | ||
'use strict' | ||
@@ -8,8 +7,13 @@ | ||
password: 'P@ssw0rd', | ||
database: 'master', | ||
database: 'StockDB', | ||
stream: false, | ||
options: { | ||
trustServerCertificate: true, | ||
enableArithAbort: true, | ||
encrypt: true | ||
}, | ||
pool: { | ||
max: 1, | ||
min: 0, | ||
}, | ||
port: 1433, | ||
@@ -20,31 +24,46 @@ user: 'sa', | ||
const client = new mssql.ConnectionPool(sqlConfig); | ||
const client = new mssql.ConnectionPool(sqlConfig) | ||
let runInterval = null | ||
async function run() { | ||
try { | ||
await client.connect(); | ||
await client.request().query(` | ||
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='test_table' AND xtype='U') | ||
BEGIN | ||
CREATE TABLE [dbo].[test_table]( | ||
[userId] [uniqueidentifier] NOT NULL | ||
) | ||
END | ||
`); | ||
const result = await client.request().input('userId', mssql.UniqueIdentifier(), 'invalid-identifier').query( | ||
'INSERT INTO [dbo].[test_table] ([userId]) VALUES (@userId)' | ||
); | ||
console.log(result); | ||
} catch (e) { | ||
// error should be caught here | ||
console.log('Error'); | ||
console.log(e); | ||
} | ||
console.log('done'); | ||
process.exit(); | ||
async function run () { | ||
const pool = await client.connect() | ||
const request = pool.request() | ||
console.time('query') | ||
const clientId = 12 | ||
const startDate = '2018-01-01' | ||
const endDate = '2020-06-18' | ||
await request.input('clientId', mssql.Int, clientId) | ||
.input('startDate', mssql.DateTime, new Date(startDate)) | ||
.input('endDate', mssql.DateTime, new Date(endDate)) | ||
.query(`SELECT v.Id as VehicleId, | ||
n.Name as Make, | ||
m.Name as Model, | ||
v.Variant as Variant, | ||
v.Registration as Registration, | ||
v.Price As Price, | ||
v.OfferPrice as OfferPrice, | ||
v.OfferDisplay as OfferDisplay, | ||
d.Name as DealershipName, | ||
v.StockDate as StockDate, | ||
v.PurchaseStandIn as SIV, | ||
s.Name as PurchaseSource, | ||
DATEDIFF(day, StockDate, GETDATE()) as DaysInStock, | ||
v.SoldDate as SoldDate, | ||
v.SoldPrice as SoldPrice, | ||
s1.Name as SoldSource | ||
FROM UsedVehicles v | ||
JOIN Models m on m.Id = v.ModelId | ||
JOIN Makes n ON n.Id = m.MakeId | ||
JOIN Dealerships d on d.Id = v.DealershipId | ||
LEFT JOIN UsedPriceSources s on s.Id = v.PurchasePriceSourceId | ||
LEFT JOIN UsedPriceSources s1 on s1.Id = v.SoldPriceSourceId | ||
WHERE v.Status = 3 | ||
AND v.ClientId = @clientId | ||
AND v.SoldDate between @startDate AND @endDate | ||
ORDER BY SoldDate ASC`) | ||
console.timeEnd('query') | ||
// console.log(result) | ||
return client.close() | ||
} | ||
run(); | ||
run() |
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
231727
4612
1864
+ Added@azure/ms-rest-azure-env@2.0.0(transitive)
+ Added@azure/ms-rest-js@2.7.0(transitive)
+ Added@azure/ms-rest-nodeauth@3.1.1(transitive)
+ Added@js-joda/core@3.2.0(transitive)
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedabort-controller@3.0.0(transitive)
+ Addedadal-node@0.2.4(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtedious@9.2.3(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedxml2js@0.5.0(transitive)
- Removed@azure/ms-rest-azure-env@1.1.2(transitive)
- Removed@azure/ms-rest-js@1.11.2(transitive)
- Removed@azure/ms-rest-nodeauth@2.0.2(transitive)
- Removed@js-joda/core@2.0.0(transitive)
- Removedasync@3.2.6(transitive)
- Removediconv-lite@0.5.2(transitive)
- Removedtedious@8.3.1(transitive)
- Removedxml2js@0.4.23(transitive)
Updatedtedious@^9