@oino-ts/db-mssql 0.10.0 → 0.10.2

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/README.md CHANGED
@@ -22,7 +22,7 @@ import { OINODbBunSqlite } from "@oino-ts/db-bunsqlite"
22
22
  ```
23
23
 
24
24
  ### Register database and logger
25
- Register your database implementation and logger (see [`OINOConsoleLog`](https://pragmatta.github.io/oino-ts/classes/types_src.OINOConsoleLog.html) how to implement your own)
25
+ Register your database implementation and logger (see [`OINOConsoleLog`](https://pragmatta.github.io/oino-ts/classes/common_src.OINOConsoleLog.html) how to implement your own)
26
26
 
27
27
  ```
28
28
  OINOLog.setLogger(new OINOConsoleLog())
@@ -103,7 +103,7 @@ Currently supported databases:
103
103
  To support tables with multipart primary keys OINO generates a composite key `_OINOID_` that is included in the result and can be used as the REST ID. For example in the example above table `OrderDetails` has two primary keys `OrderID` and `ProductID` making the `_OINOID_` of form `11077:99`.
104
104
 
105
105
  ## Power Of SQL
106
- Since OINO is just generating SQL, WHERE-conditions can be defined with [`OINOSqlFilter`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlFilter.html), order with [`OINOSqlOrder`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlOrder.html) and limits/paging with [`OINOSqlLimit`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlLimit.html) that are passed as HTTP request parameters. No more API development where you make unique API endpoints for each filter that fetch all data with original API and filter in backend code. Every API can be filtered when and as needed without unnessecary data tranfer and utilizing SQL indexing when available.
106
+ Since OINO is just generating SQL, WHERE-conditions can be defined with [`OINODbSqlFilter`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlFilter.html), order with [`OINODbSqlOrder`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlOrder.html), limits/paging with [`OINODbSqlLimit`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlLimit.html) and aggregation with [`OINODbSqlAggregate`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlAggregate.html) that are passed as HTTP request parameters. No more API development where you make unique API endpoints for each filter that fetch all data with original API and filter in backend code. Every API can be filtered when and as needed without unnessecary data tranfer and utilizing SQL indexing when available.
107
107
 
108
108
  ## Swagger Support
109
109
  Swagger is great as long as the definitions are updated and with OINO you can automatically get a Swagger definition including a data model schema.
@@ -256,7 +256,7 @@ class OINODbMsSql extends db_1.OINODb {
256
256
  if ((limitCondition != "") && (limit_parts.length == 2)) {
257
257
  if (orderCondition == "") {
258
258
  db_1.OINOLog.error("@oino-ts/db-mssql", "OINODbMsSql", "printSqlSelect", "LIMIT without ORDER BY is not supported in MS SQL Server");
259
- throw new Error(db_1.OINO_ERROR_PREFIX + "LIMIT without ORDER BY is not supported in MS SQL Server");
259
+ throw new Error(db_1.OINO_ERROR_PREFIX + ": LIMIT without ORDER BY is not supported in MS SQL Server");
260
260
  }
261
261
  else {
262
262
  result += " OFFSET " + limit_parts[1] + " ROWS FETCH NEXT " + limit_parts[0] + " ROWS ONLY";
@@ -280,7 +280,7 @@ class OINODbMsSql extends db_1.OINODb {
280
280
  catch (e) {
281
281
  // ... error checks
282
282
  result.setError(500, "Exception connecting to database: " + e.message, "OINODbMsSql.connect");
283
- db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "Exception", { message: e.message, stack: e.stack });
283
+ db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "exception in connect", { message: e.message, stack: e.stack });
284
284
  }
285
285
  return Promise.resolve(result);
286
286
  }
@@ -314,7 +314,7 @@ class OINODbMsSql extends db_1.OINODb {
314
314
  }
315
315
  catch (e) {
316
316
  result.setError(500, "Exception in validating connection: " + e.message, "OINODbMsSql.validate");
317
- db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "Exception", { message: e.message, stack: e.stack });
317
+ db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "exception in validate", { message: e.message, stack: e.stack });
318
318
  }
319
319
  db_1.OINOBenchmark.endMetric("OINODb", "validate");
320
320
  return result;
@@ -332,7 +332,7 @@ class OINODbMsSql extends db_1.OINODb {
332
332
  result = await this._query(sql);
333
333
  }
334
334
  catch (e) {
335
- db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "SQL select exception", { message: e.message, stack: e.stack });
335
+ db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "exception in SQL select", { message: e.message, stack: e.stack });
336
336
  result = new OINOMsSqlData(db_1.OINODB_EMPTY_ROWS, [db_1.OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message]);
337
337
  }
338
338
  db_1.OINOBenchmark.endMetric("OINODb", "sqlSelect");
@@ -351,7 +351,7 @@ class OINODbMsSql extends db_1.OINODb {
351
351
  result = await this._exec(sql);
352
352
  }
353
353
  catch (e) {
354
- db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "SQL exec exception", { message: e.message, stack: e.stack });
354
+ db_1.OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "exception in SQL exec", { message: e.message, stack: e.stack });
355
355
  result = new OINOMsSqlData(db_1.OINODB_EMPTY_ROWS, [db_1.OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"]);
356
356
  }
357
357
  db_1.OINOBenchmark.endMetric("OINODb", "sqlExec");
@@ -253,7 +253,7 @@ export class OINODbMsSql extends OINODb {
253
253
  if ((limitCondition != "") && (limit_parts.length == 2)) {
254
254
  if (orderCondition == "") {
255
255
  OINOLog.error("@oino-ts/db-mssql", "OINODbMsSql", "printSqlSelect", "LIMIT without ORDER BY is not supported in MS SQL Server");
256
- throw new Error(OINO_ERROR_PREFIX + "LIMIT without ORDER BY is not supported in MS SQL Server");
256
+ throw new Error(OINO_ERROR_PREFIX + ": LIMIT without ORDER BY is not supported in MS SQL Server");
257
257
  }
258
258
  else {
259
259
  result += " OFFSET " + limit_parts[1] + " ROWS FETCH NEXT " + limit_parts[0] + " ROWS ONLY";
@@ -277,7 +277,7 @@ export class OINODbMsSql extends OINODb {
277
277
  catch (e) {
278
278
  // ... error checks
279
279
  result.setError(500, "Exception connecting to database: " + e.message, "OINODbMsSql.connect");
280
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "Exception", { message: e.message, stack: e.stack });
280
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "exception in connect", { message: e.message, stack: e.stack });
281
281
  }
282
282
  return Promise.resolve(result);
283
283
  }
@@ -311,7 +311,7 @@ export class OINODbMsSql extends OINODb {
311
311
  }
312
312
  catch (e) {
313
313
  result.setError(500, "Exception in validating connection: " + e.message, "OINODbMsSql.validate");
314
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "Exception", { message: e.message, stack: e.stack });
314
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "exception in validate", { message: e.message, stack: e.stack });
315
315
  }
316
316
  OINOBenchmark.endMetric("OINODb", "validate");
317
317
  return result;
@@ -329,7 +329,7 @@ export class OINODbMsSql extends OINODb {
329
329
  result = await this._query(sql);
330
330
  }
331
331
  catch (e) {
332
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "SQL select exception", { message: e.message, stack: e.stack });
332
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "exception in SQL select", { message: e.message, stack: e.stack });
333
333
  result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message]);
334
334
  }
335
335
  OINOBenchmark.endMetric("OINODb", "sqlSelect");
@@ -348,7 +348,7 @@ export class OINODbMsSql extends OINODb {
348
348
  result = await this._exec(sql);
349
349
  }
350
350
  catch (e) {
351
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "SQL exec exception", { message: e.message, stack: e.stack });
351
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "exception in SQL exec", { message: e.message, stack: e.stack });
352
352
  result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"]);
353
353
  }
354
354
  OINOBenchmark.endMetric("OINODb", "sqlExec");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/db-mssql",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
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.10.0",
25
+ "@oino-ts/db": "0.10.2",
26
26
  "mssql": "^11.0.1"
27
27
  },
28
28
  "devDependencies": {
@@ -275,7 +275,7 @@ export class OINODbMsSql extends OINODb {
275
275
  if ((limitCondition != "") && (limit_parts.length == 2)) {
276
276
  if (orderCondition == "") {
277
277
  OINOLog.error("@oino-ts/db-mssql", "OINODbMsSql", "printSqlSelect", "LIMIT without ORDER BY is not supported in MS SQL Server")
278
- throw new Error(OINO_ERROR_PREFIX + "LIMIT without ORDER BY is not supported in MS SQL Server")
278
+ throw new Error(OINO_ERROR_PREFIX + ": LIMIT without ORDER BY is not supported in MS SQL Server")
279
279
  } else {
280
280
  result += " OFFSET " + limit_parts[1] + " ROWS FETCH NEXT " + limit_parts[0] + " ROWS ONLY"
281
281
  }
@@ -299,7 +299,7 @@ export class OINODbMsSql extends OINODb {
299
299
  } catch (e:any) {
300
300
  // ... error checks
301
301
  result.setError(500, "Exception connecting to database: " + e.message, "OINODbMsSql.connect")
302
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "Exception", {message:e.message, stack:e.stack})
302
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "connect", "exception in connect", {message:e.message, stack:e.stack})
303
303
  }
304
304
  return Promise.resolve(result)
305
305
  }
@@ -333,7 +333,7 @@ export class OINODbMsSql extends OINODb {
333
333
  }
334
334
  } catch (e:any) {
335
335
  result.setError(500, "Exception in validating connection: " + e.message, "OINODbMsSql.validate")
336
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "Exception", {message:e.message, stack:e.stack})
336
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "validate", "exception in validate", {message:e.message, stack:e.stack})
337
337
  }
338
338
  OINOBenchmark.endMetric("OINODb", "validate")
339
339
  return result
@@ -352,7 +352,7 @@ export class OINODbMsSql extends OINODb {
352
352
  result = await this._query(sql)
353
353
 
354
354
  } catch (e:any) {
355
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "SQL select exception", {message:e.message, stack:e.stack})
355
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlSelect", "exception in SQL select", {message:e.message, stack:e.stack})
356
356
  result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlSelect): OINODbMsSql.sqlSelect exception in _db.query: " + e.message])
357
357
  }
358
358
  OINOBenchmark.endMetric("OINODb", "sqlSelect")
@@ -372,7 +372,7 @@ export class OINODbMsSql extends OINODb {
372
372
  result = await this._exec(sql)
373
373
 
374
374
  } catch (e:any) {
375
- OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "SQL exec exception", {message:e.message, stack:e.stack})
375
+ OINOLog.exception("@oino-ts/db-mssql", "OINODbMsSql", "sqlExec", "exception in SQL exec", {message:e.message, stack:e.stack})
376
376
  result = new OINOMsSqlData(OINODB_EMPTY_ROWS, [OINO_ERROR_PREFIX + " (sqlExec): exception in _db.exec [" + e.message + "]"])
377
377
  }
378
378
  OINOBenchmark.endMetric("OINODb", "sqlExec")