@oino-ts/db-mssql 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/OINODbMsSql.js +10 -3
- package/dist/esm/OINODbMsSql.js +10 -3
- package/package.json +2 -2
- package/src/OINODbMsSql.ts +12 -3
package/dist/cjs/OINODbMsSql.js
CHANGED
|
@@ -91,6 +91,13 @@ class OINOMsSqlData extends db_1.OINODbDataSet {
|
|
|
91
91
|
return db_1.OINODB_EMPTY_ROW;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets all rows of data.
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
async getAllRows() {
|
|
99
|
+
return this._rows; // at the moment theres no result streaming, so we can just return the rows
|
|
100
|
+
}
|
|
94
101
|
}
|
|
95
102
|
/**
|
|
96
103
|
* Implementation of MariaDb/MySql-database.
|
|
@@ -153,7 +160,7 @@ class OINODbMsSql extends db_1.OINODb {
|
|
|
153
160
|
try {
|
|
154
161
|
const sql_res = await this._pool.request().query(sql);
|
|
155
162
|
// console.log("OINODbMsSql._exec result", sql_res);
|
|
156
|
-
return Promise.resolve(new OINOMsSqlData(
|
|
163
|
+
return Promise.resolve(new OINOMsSqlData(db_1.OINODB_EMPTY_ROWS));
|
|
157
164
|
}
|
|
158
165
|
catch (err) {
|
|
159
166
|
db_1.OINOLog.error("OINODbMsSql._exec exception", { err: err });
|
|
@@ -360,7 +367,7 @@ class OINODbMsSql extends db_1.OINODb {
|
|
|
360
367
|
result = await this._query(sql);
|
|
361
368
|
}
|
|
362
369
|
catch (e) {
|
|
363
|
-
result = new OINOMsSqlData(
|
|
370
|
+
result = new OINOMsSqlData(db_1.OINODB_EMPTY_ROWS, [db_1.OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message]);
|
|
364
371
|
}
|
|
365
372
|
db_1.OINOBenchmark.end("OINODb", "sqlSelect");
|
|
366
373
|
return result;
|
|
@@ -378,7 +385,7 @@ class OINODbMsSql extends db_1.OINODb {
|
|
|
378
385
|
result = await this._exec(sql);
|
|
379
386
|
}
|
|
380
387
|
catch (e) {
|
|
381
|
-
result = new OINOMsSqlData(
|
|
388
|
+
result = new OINOMsSqlData(db_1.OINODB_EMPTY_ROWS, [db_1.OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"]);
|
|
382
389
|
}
|
|
383
390
|
db_1.OINOBenchmark.end("OINODb", "sqlExec");
|
|
384
391
|
return result;
|
package/dist/esm/OINODbMsSql.js
CHANGED
|
@@ -88,6 +88,13 @@ class OINOMsSqlData extends OINODbDataSet {
|
|
|
88
88
|
return OINODB_EMPTY_ROW;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets all rows of data.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
async getAllRows() {
|
|
96
|
+
return this._rows; // at the moment theres no result streaming, so we can just return the rows
|
|
97
|
+
}
|
|
91
98
|
}
|
|
92
99
|
/**
|
|
93
100
|
* Implementation of MariaDb/MySql-database.
|
|
@@ -150,7 +157,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
150
157
|
try {
|
|
151
158
|
const sql_res = await this._pool.request().query(sql);
|
|
152
159
|
// console.log("OINODbMsSql._exec result", sql_res);
|
|
153
|
-
return Promise.resolve(new OINOMsSqlData(
|
|
160
|
+
return Promise.resolve(new OINOMsSqlData(OINODB_EMPTY_ROWS));
|
|
154
161
|
}
|
|
155
162
|
catch (err) {
|
|
156
163
|
OINOLog.error("OINODbMsSql._exec exception", { err: err });
|
|
@@ -357,7 +364,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
357
364
|
result = await this._query(sql);
|
|
358
365
|
}
|
|
359
366
|
catch (e) {
|
|
360
|
-
result = new OINOMsSqlData(
|
|
367
|
+
result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message]);
|
|
361
368
|
}
|
|
362
369
|
OINOBenchmark.end("OINODb", "sqlSelect");
|
|
363
370
|
return result;
|
|
@@ -375,7 +382,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
375
382
|
result = await this._exec(sql);
|
|
376
383
|
}
|
|
377
384
|
catch (e) {
|
|
378
|
-
result = new OINOMsSqlData(
|
|
385
|
+
result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"]);
|
|
379
386
|
}
|
|
380
387
|
OINOBenchmark.end("OINODb", "sqlExec");
|
|
381
388
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/db-mssql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "OINO TS package for using Microsoft Sql databases.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"module": "./dist/esm/index.js",
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@oino-ts/db": "0.
|
|
25
|
+
"@oino-ts/db": "0.7.1",
|
|
26
26
|
"mssql": "^11.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
package/src/OINODbMsSql.ts
CHANGED
|
@@ -95,6 +95,15 @@ class OINOMsSqlData extends OINODbDataSet {
|
|
|
95
95
|
return OINODB_EMPTY_ROW
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Gets all rows of data.
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
async getAllRows(): Promise<OINODataRow[]> {
|
|
104
|
+
return this._rows // at the moment theres no result streaming, so we can just return the rows
|
|
105
|
+
}
|
|
106
|
+
|
|
98
107
|
}
|
|
99
108
|
|
|
100
109
|
/**
|
|
@@ -164,7 +173,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
164
173
|
try {
|
|
165
174
|
const sql_res = await this._pool.request().query(sql);
|
|
166
175
|
// console.log("OINODbMsSql._exec result", sql_res);
|
|
167
|
-
return Promise.resolve(new OINOMsSqlData(
|
|
176
|
+
return Promise.resolve(new OINOMsSqlData(OINODB_EMPTY_ROWS))
|
|
168
177
|
|
|
169
178
|
} catch (err) {
|
|
170
179
|
OINOLog.error("OINODbMsSql._exec exception", {err:err})
|
|
@@ -377,7 +386,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
377
386
|
result = await this._query(sql)
|
|
378
387
|
|
|
379
388
|
} catch (e:any) {
|
|
380
|
-
result = new OINOMsSqlData(
|
|
389
|
+
result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message])
|
|
381
390
|
}
|
|
382
391
|
OINOBenchmark.end("OINODb", "sqlSelect")
|
|
383
392
|
return result
|
|
@@ -396,7 +405,7 @@ export class OINODbMsSql extends OINODb {
|
|
|
396
405
|
result = await this._exec(sql)
|
|
397
406
|
|
|
398
407
|
} catch (e:any) {
|
|
399
|
-
result = new OINOMsSqlData(
|
|
408
|
+
result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"])
|
|
400
409
|
}
|
|
401
410
|
OINOBenchmark.end("OINODb", "sqlExec")
|
|
402
411
|
return result
|