mssql
Advanced tools
Comparing version 7.2.0 to 7.2.1
@@ -0,1 +1,5 @@ | ||
v7.2.1 (2021-08-19) | ||
------------------- | ||
[fix] Fix issue with bulk insert of dates ((#1298)[https://github.com/tediousjs/node-mssql/pull/1298]) | ||
v7.2.0 (2021-07-29) | ||
@@ -2,0 +6,0 @@ ------------------- |
@@ -149,3 +149,7 @@ 'use strict' | ||
table._makeBulk() | ||
try { | ||
table._makeBulk() | ||
} catch (e) { | ||
return callback(new RequestError(e, 'EREQUEST')) | ||
} | ||
@@ -152,0 +156,0 @@ if (!table.name) { |
@@ -216,3 +216,7 @@ 'use strict' | ||
table._makeBulk() | ||
try { | ||
table._makeBulk() | ||
} catch (e) { | ||
return callback(new RequestError(e, 'EREQUEST')) | ||
} | ||
@@ -219,0 +223,0 @@ if (!table.name) { |
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "7.2.0", | ||
"version": "7.2.1", | ||
"main": "index.js", | ||
@@ -31,9 +31,9 @@ "repository": "github:tediousjs/node-mssql", | ||
"@tediousjs/connection-string": "^0.3.0", | ||
"debug": "^4", | ||
"debug": "^4.3.2", | ||
"rfdc": "^1.3.0", | ||
"tarn": "^3.0.1", | ||
"tedious": "^11.0.7" | ||
"tedious": "^11.4.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^8.3.2", | ||
"mocha": "^8.4.0", | ||
"standard": "^16.0.3" | ||
@@ -40,0 +40,0 @@ }, |
28
test.js
@@ -9,5 +9,2 @@ 'use strict' | ||
stream: false, | ||
authentication: { | ||
type: 'test', | ||
}, | ||
options: { | ||
@@ -32,17 +29,16 @@ trustServerCertificate: true, | ||
const table = new mssql.Table('Sandbox.dbo.BulkTest') | ||
table.create = true | ||
table.columns.add('ABigInt', mssql.BigInt); | ||
table.rows.add(1.2) | ||
try { | ||
const temp = new mssql.Table('#mytemptable'); | ||
temp.create = true; | ||
temp.columns.add('ts', mssql.DateTime()); | ||
const transaction = new mssql.Transaction(pool); | ||
await transaction.begin(); | ||
temp.rows.push(['obviously_bad_data']); // obviously bad data | ||
try { | ||
const request = new mssql.Request(transaction) | ||
await request.bulk(table) | ||
await transaction.commit(); | ||
} catch (error) { | ||
console.error(error) | ||
await transaction.rollback(); | ||
const request = pool.request(); | ||
await request.bulk(temp); /////// <<<<< Error occurs here | ||
const { recordset } = await request.query(`SELECT * FROM #mytemptable`); | ||
console.log(recordset); | ||
} catch (e) { | ||
console.error(e); | ||
} finally { | ||
@@ -49,0 +45,0 @@ await pool.close(); |
259102
5032
Updateddebug@^4.3.2
Updatedtedious@^11.4.0