@oino-ts/db-mssql 0.1.2 → 0.2.0
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/types/OINODbMsSql.d.ts +86 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { OINODb, OINODbParams, OINODbDataSet, OINODbApi, OINODataCell } from "@oino-ts/db";
|
|
2
|
+
/**
|
|
3
|
+
* Implementation of MariaDb/MySql-database.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class OINODbMsSql extends OINODb {
|
|
7
|
+
private _pool;
|
|
8
|
+
/**
|
|
9
|
+
* Constructor of `OINODbMsSql`
|
|
10
|
+
* @param params database parameters
|
|
11
|
+
*/
|
|
12
|
+
constructor(params: OINODbParams);
|
|
13
|
+
private _query;
|
|
14
|
+
private _exec;
|
|
15
|
+
/**
|
|
16
|
+
* Print a table name using database specific SQL escaping.
|
|
17
|
+
*
|
|
18
|
+
* @param sqlTable name of the table
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
printSqlTablename(sqlTable: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Print a column name with correct SQL escaping.
|
|
24
|
+
*
|
|
25
|
+
* @param sqlColumn name of the column
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
printSqlColumnname(sqlColumn: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Print a single data value from serialization using the context of the native data
|
|
31
|
+
* type with the correct SQL escaping.
|
|
32
|
+
*
|
|
33
|
+
* @param cellValue data from sql results
|
|
34
|
+
* @param sqlType native type name for table column
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
printCellAsSqlValue(cellValue: OINODataCell, sqlType: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a single SQL result value for serialization using the context of the native data
|
|
40
|
+
* type.
|
|
41
|
+
*
|
|
42
|
+
* @param sqlValue data from serialization
|
|
43
|
+
* @param sqlType native type name for table column
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
parseSqlValueAsCell(sqlValue: OINODataCell, sqlType: string): OINODataCell;
|
|
47
|
+
/**
|
|
48
|
+
* Print SQL select statement with DB specific formatting.
|
|
49
|
+
*
|
|
50
|
+
* @param tableName - The name of the table to select from.
|
|
51
|
+
* @param columnNames - The columns to be selected.
|
|
52
|
+
* @param whereCondition - The WHERE clause to filter the results.
|
|
53
|
+
* @param orderCondition - The ORDER BY clause to sort the results.
|
|
54
|
+
* @param limitCondition - The LIMIT clause to limit the number of results.
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
printSqlSelect(tableName: string, columnNames: string, whereCondition: string, orderCondition: string, limitCondition: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Connect to database.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
connect(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Execute a select operation.
|
|
65
|
+
*
|
|
66
|
+
* @param sql SQL statement.
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
sqlSelect(sql: string): Promise<OINODbDataSet>;
|
|
70
|
+
/**
|
|
71
|
+
* Execute other sql operations.
|
|
72
|
+
*
|
|
73
|
+
* @param sql SQL statement.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
sqlExec(sql: string): Promise<OINODbDataSet>;
|
|
77
|
+
private _getSchemaSql;
|
|
78
|
+
/**
|
|
79
|
+
* Initialize a data model by getting the SQL schema and populating OINODbDataFields of
|
|
80
|
+
* the model.
|
|
81
|
+
*
|
|
82
|
+
* @param api api which data model to initialize.
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
initializeApiDatamodel(api: OINODbApi): Promise<void>;
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OINODbMsSql } from "./OINODbMsSql.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/db-mssql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.2.0",
|
|
26
26
|
"mssql": "^11.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|