@sqb/oracle 4.22.0 → 4.23.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/constants.d.ts +54 -0
- package/constants.js +55 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/ora-adapter.d.ts +6 -1
- package/ora-connection.d.ts +0 -27
- package/ora-connection.js +24 -54
- package/package.json +4 -4
package/constants.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const dataTypeNames: {
|
|
2
|
+
DB_TYPE_BFILE: string;
|
|
3
|
+
DB_TYPE_BINARY_DOUBLE: string;
|
|
4
|
+
DB_TYPE_BINARY_FLOAT: string;
|
|
5
|
+
DB_TYPE_BINARY_INTEGER: string;
|
|
6
|
+
DB_TYPE_BLOB: string;
|
|
7
|
+
DB_TYPE_BOOLEAN: string;
|
|
8
|
+
DB_TYPE_CHAR: string;
|
|
9
|
+
DB_TYPE_CLOB: string;
|
|
10
|
+
DB_TYPE_CURSOR: string;
|
|
11
|
+
DB_TYPE_DATE: string;
|
|
12
|
+
DB_TYPE_INTERVAL_DS: string;
|
|
13
|
+
DB_TYPE_INTERVAL_YM: string;
|
|
14
|
+
DB_TYPE_LONG: string;
|
|
15
|
+
DB_TYPE_LONG_RAW: string;
|
|
16
|
+
DB_TYPE_NCHAR: string;
|
|
17
|
+
DB_TYPE_NCLOB: string;
|
|
18
|
+
DB_TYPE_NUMBER: string;
|
|
19
|
+
DB_TYPE_NVARCHAR: string;
|
|
20
|
+
DB_TYPE_OBJECT: string;
|
|
21
|
+
DB_TYPE_RAW: string;
|
|
22
|
+
DB_TYPE_ROWID: string;
|
|
23
|
+
DB_TYPE_TIMESTAMP: string;
|
|
24
|
+
DB_TYPE_TIMESTAMP_LTZ: string;
|
|
25
|
+
DB_TYPE_TIMESTAMP_TZ: string;
|
|
26
|
+
DB_TYPE_VARCHAR: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const fetchTypeMap: {
|
|
29
|
+
DB_TYPE_BFILE: string;
|
|
30
|
+
DB_TYPE_BINARY_DOUBLE: string;
|
|
31
|
+
DB_TYPE_BINARY_FLOAT: string;
|
|
32
|
+
DB_TYPE_BINARY_INTEGER: string;
|
|
33
|
+
DB_TYPE_BLOB: string;
|
|
34
|
+
DB_TYPE_BOOLEAN: string;
|
|
35
|
+
DB_TYPE_CHAR: string;
|
|
36
|
+
DB_TYPE_CLOB: string;
|
|
37
|
+
DB_TYPE_CURSOR: string;
|
|
38
|
+
DB_TYPE_DATE: string;
|
|
39
|
+
DB_TYPE_INTERVAL_DS: string;
|
|
40
|
+
DB_TYPE_INTERVAL_YM: string;
|
|
41
|
+
DB_TYPE_LONG: string;
|
|
42
|
+
DB_TYPE_LONG_RAW: string;
|
|
43
|
+
DB_TYPE_NCHAR: string;
|
|
44
|
+
DB_TYPE_NCLOB: string;
|
|
45
|
+
DB_TYPE_NUMBER: string;
|
|
46
|
+
DB_TYPE_NVARCHAR: string;
|
|
47
|
+
DB_TYPE_OBJECT: string;
|
|
48
|
+
DB_TYPE_RAW: string;
|
|
49
|
+
DB_TYPE_ROWID: string;
|
|
50
|
+
DB_TYPE_TIMESTAMP: string;
|
|
51
|
+
DB_TYPE_TIMESTAMP_LTZ: string;
|
|
52
|
+
DB_TYPE_TIMESTAMP_TZ: string;
|
|
53
|
+
DB_TYPE_VARCHAR: string;
|
|
54
|
+
};
|
package/constants.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import oracledb from 'oracledb';
|
|
2
|
+
export const dataTypeNames = {
|
|
3
|
+
[oracledb.DB_TYPE_BFILE.name]: 'BFILE',
|
|
4
|
+
[oracledb.DB_TYPE_BINARY_DOUBLE.name]: 'BINARY_DOUBLE',
|
|
5
|
+
[oracledb.DB_TYPE_BINARY_FLOAT.name]: 'BINARY_FLOAT',
|
|
6
|
+
[oracledb.DB_TYPE_BINARY_INTEGER.name]: 'BINARY_INTEGER',
|
|
7
|
+
[oracledb.DB_TYPE_BLOB.name]: 'BLOB',
|
|
8
|
+
[oracledb.DB_TYPE_BOOLEAN.name]: 'BOOLEAN',
|
|
9
|
+
[oracledb.DB_TYPE_CHAR.name]: 'CHAR',
|
|
10
|
+
[oracledb.DB_TYPE_CLOB.name]: 'CLOB',
|
|
11
|
+
[oracledb.DB_TYPE_CURSOR.name]: 'CURSOR',
|
|
12
|
+
[oracledb.DB_TYPE_DATE.name]: 'DATE',
|
|
13
|
+
[oracledb.DB_TYPE_INTERVAL_DS.name]: 'INTERVAL_DS',
|
|
14
|
+
[oracledb.DB_TYPE_INTERVAL_YM.name]: 'INTERVAL_YM',
|
|
15
|
+
[oracledb.DB_TYPE_LONG.name]: 'LONG',
|
|
16
|
+
[oracledb.DB_TYPE_LONG_RAW.name]: 'LONG_RAW',
|
|
17
|
+
[oracledb.DB_TYPE_NCHAR.name]: 'NCHAR',
|
|
18
|
+
[oracledb.DB_TYPE_NCLOB.name]: 'NCLOB',
|
|
19
|
+
[oracledb.DB_TYPE_NUMBER.name]: 'NUMBER',
|
|
20
|
+
[oracledb.DB_TYPE_NVARCHAR.name]: 'NVARCHAR',
|
|
21
|
+
[oracledb.DB_TYPE_OBJECT.name]: 'OBJECT',
|
|
22
|
+
[oracledb.DB_TYPE_RAW.name]: 'RAW',
|
|
23
|
+
[oracledb.DB_TYPE_ROWID.name]: 'ROWID',
|
|
24
|
+
[oracledb.DB_TYPE_TIMESTAMP.name]: 'TIMESTAMP',
|
|
25
|
+
[oracledb.DB_TYPE_TIMESTAMP_LTZ.name]: 'TIMESTAMP_LTZ',
|
|
26
|
+
[oracledb.DB_TYPE_TIMESTAMP_TZ.name]: 'TIMESTAMP_TZ',
|
|
27
|
+
[oracledb.DB_TYPE_VARCHAR.name]: 'VARCHAR',
|
|
28
|
+
};
|
|
29
|
+
export const fetchTypeMap = {
|
|
30
|
+
[oracledb.DB_TYPE_BFILE.name]: 'object',
|
|
31
|
+
[oracledb.DB_TYPE_BINARY_DOUBLE.name]: 'number',
|
|
32
|
+
[oracledb.DB_TYPE_BINARY_FLOAT.name]: 'number',
|
|
33
|
+
[oracledb.DB_TYPE_BINARY_INTEGER.name]: 'number',
|
|
34
|
+
[oracledb.DB_TYPE_BLOB.name]: 'object',
|
|
35
|
+
[oracledb.DB_TYPE_BOOLEAN.name]: 'boolean',
|
|
36
|
+
[oracledb.DB_TYPE_CHAR.name]: 'string',
|
|
37
|
+
[oracledb.DB_TYPE_CLOB.name]: 'object',
|
|
38
|
+
[oracledb.DB_TYPE_CURSOR.name]: 'object',
|
|
39
|
+
[oracledb.DB_TYPE_DATE.name]: 'Date',
|
|
40
|
+
[oracledb.DB_TYPE_INTERVAL_DS.name]: 'string',
|
|
41
|
+
[oracledb.DB_TYPE_INTERVAL_YM.name]: 'string',
|
|
42
|
+
[oracledb.DB_TYPE_LONG.name]: 'number',
|
|
43
|
+
[oracledb.DB_TYPE_LONG_RAW.name]: 'Buffer',
|
|
44
|
+
[oracledb.DB_TYPE_NCHAR.name]: 'string',
|
|
45
|
+
[oracledb.DB_TYPE_NCLOB.name]: 'object',
|
|
46
|
+
[oracledb.DB_TYPE_NUMBER.name]: 'number',
|
|
47
|
+
[oracledb.DB_TYPE_NVARCHAR.name]: 'string',
|
|
48
|
+
[oracledb.DB_TYPE_OBJECT.name]: 'object',
|
|
49
|
+
[oracledb.DB_TYPE_RAW.name]: 'Buffer',
|
|
50
|
+
[oracledb.DB_TYPE_ROWID.name]: 'number',
|
|
51
|
+
[oracledb.DB_TYPE_TIMESTAMP.name]: 'Date',
|
|
52
|
+
[oracledb.DB_TYPE_TIMESTAMP_LTZ.name]: 'Date',
|
|
53
|
+
[oracledb.DB_TYPE_TIMESTAMP_TZ.name]: 'Date',
|
|
54
|
+
[oracledb.DB_TYPE_VARCHAR.name]: 'string',
|
|
55
|
+
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import '@sqb/oracle-dialect';
|
|
2
2
|
import { AdapterRegistry } from '@sqb/connect';
|
|
3
3
|
import { OraAdapter } from './ora-adapter.js';
|
|
4
|
+
export * from './constants.js';
|
|
5
|
+
export * from './ora-adapter.js';
|
|
6
|
+
export * from './ora-connection.js';
|
|
4
7
|
AdapterRegistry.register(new OraAdapter());
|
package/ora-adapter.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import '@sqb/oracle-dialect';
|
|
2
2
|
import type { Adapter, ClientConfiguration } from '@sqb/connect';
|
|
3
|
+
export interface OraClientConfiguration extends ClientConfiguration {
|
|
4
|
+
driverOptions?: {
|
|
5
|
+
direct?: boolean;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
3
8
|
export declare class OraAdapter implements Adapter {
|
|
4
9
|
driver: string;
|
|
5
10
|
dialect: string;
|
|
@@ -7,5 +12,5 @@ export declare class OraAdapter implements Adapter {
|
|
|
7
12
|
cursor: boolean;
|
|
8
13
|
schema: boolean;
|
|
9
14
|
};
|
|
10
|
-
connect(config:
|
|
15
|
+
connect(config: OraClientConfiguration): Promise<Adapter.Connection>;
|
|
11
16
|
}
|
package/ora-connection.d.ts
CHANGED
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import type { Adapter, QueryRequest } from '@sqb/connect';
|
|
2
2
|
import oracledb from 'oracledb';
|
|
3
|
-
export declare const dataTypeNames: {
|
|
4
|
-
DB_TYPE_BFILE: string;
|
|
5
|
-
DB_TYPE_BINARY_DOUBLE: string;
|
|
6
|
-
DB_TYPE_BINARY_FLOAT: string;
|
|
7
|
-
DB_TYPE_BINARY_INTEGER: string;
|
|
8
|
-
DB_TYPE_BLOB: string;
|
|
9
|
-
DB_TYPE_BOOLEAN: string;
|
|
10
|
-
DB_TYPE_CHAR: string;
|
|
11
|
-
DB_TYPE_CLOB: string;
|
|
12
|
-
DB_TYPE_CURSOR: string;
|
|
13
|
-
DB_TYPE_DATE: string;
|
|
14
|
-
DB_TYPE_INTERVAL_DS: string;
|
|
15
|
-
DB_TYPE_INTERVAL_YM: string;
|
|
16
|
-
DB_TYPE_LONG: string;
|
|
17
|
-
DB_TYPE_LONG_RAW: string;
|
|
18
|
-
DB_TYPE_NCHAR: string;
|
|
19
|
-
DB_TYPE_NCLOB: string;
|
|
20
|
-
DB_TYPE_NUMBER: string;
|
|
21
|
-
DB_TYPE_NVARCHAR: string;
|
|
22
|
-
DB_TYPE_OBJECT: string;
|
|
23
|
-
DB_TYPE_RAW: string;
|
|
24
|
-
DB_TYPE_ROWID: string;
|
|
25
|
-
DB_TYPE_TIMESTAMP: string;
|
|
26
|
-
DB_TYPE_TIMESTAMP_LTZ: string;
|
|
27
|
-
DB_TYPE_TIMESTAMP_TZ: string;
|
|
28
|
-
DB_TYPE_VARCHAR: string;
|
|
29
|
-
};
|
|
30
3
|
export declare class OraConnection implements Adapter.Connection {
|
|
31
4
|
sessionId: string;
|
|
32
5
|
private intlcon?;
|
package/ora-connection.js
CHANGED
|
@@ -1,60 +1,7 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
2
|
import oracledb from 'oracledb';
|
|
3
|
+
import { fetchTypeMap } from './constants.js';
|
|
3
4
|
import { OraCursor } from './ora-cursor.js';
|
|
4
|
-
export const dataTypeNames = {
|
|
5
|
-
[oracledb.DB_TYPE_BFILE.name]: 'BFILE',
|
|
6
|
-
[oracledb.DB_TYPE_BINARY_DOUBLE.name]: 'BINARY_DOUBLE',
|
|
7
|
-
[oracledb.DB_TYPE_BINARY_FLOAT.name]: 'BINARY_FLOAT',
|
|
8
|
-
[oracledb.DB_TYPE_BINARY_INTEGER.name]: 'BINARY_INTEGER',
|
|
9
|
-
[oracledb.DB_TYPE_BLOB.name]: 'BLOB',
|
|
10
|
-
[oracledb.DB_TYPE_BOOLEAN.name]: 'BOOLEAN',
|
|
11
|
-
[oracledb.DB_TYPE_CHAR.name]: 'CHAR',
|
|
12
|
-
[oracledb.DB_TYPE_CLOB.name]: 'CLOB',
|
|
13
|
-
[oracledb.DB_TYPE_CURSOR.name]: 'CURSOR',
|
|
14
|
-
[oracledb.DB_TYPE_DATE.name]: 'DATE',
|
|
15
|
-
[oracledb.DB_TYPE_INTERVAL_DS.name]: 'INTERVAL_DS',
|
|
16
|
-
[oracledb.DB_TYPE_INTERVAL_YM.name]: 'INTERVAL_YM',
|
|
17
|
-
[oracledb.DB_TYPE_LONG.name]: 'LONG',
|
|
18
|
-
[oracledb.DB_TYPE_LONG_RAW.name]: 'LONG_RAW',
|
|
19
|
-
[oracledb.DB_TYPE_NCHAR.name]: 'NCHAR',
|
|
20
|
-
[oracledb.DB_TYPE_NCLOB.name]: 'NCLOB',
|
|
21
|
-
[oracledb.DB_TYPE_NUMBER.name]: 'NUMBER',
|
|
22
|
-
[oracledb.DB_TYPE_NVARCHAR.name]: 'NVARCHAR',
|
|
23
|
-
[oracledb.DB_TYPE_OBJECT.name]: 'OBJECT',
|
|
24
|
-
[oracledb.DB_TYPE_RAW.name]: 'RAW',
|
|
25
|
-
[oracledb.DB_TYPE_ROWID.name]: 'ROWID',
|
|
26
|
-
[oracledb.DB_TYPE_TIMESTAMP.name]: 'TIMESTAMP',
|
|
27
|
-
[oracledb.DB_TYPE_TIMESTAMP_LTZ.name]: 'TIMESTAMP_LTZ',
|
|
28
|
-
[oracledb.DB_TYPE_TIMESTAMP_TZ.name]: 'TIMESTAMP_TZ',
|
|
29
|
-
[oracledb.DB_TYPE_VARCHAR.name]: 'VARCHAR',
|
|
30
|
-
};
|
|
31
|
-
const fetchTypeMap = {
|
|
32
|
-
[oracledb.DB_TYPE_BFILE.name]: 'object',
|
|
33
|
-
[oracledb.DB_TYPE_BINARY_DOUBLE.name]: 'number',
|
|
34
|
-
[oracledb.DB_TYPE_BINARY_FLOAT.name]: 'number',
|
|
35
|
-
[oracledb.DB_TYPE_BINARY_INTEGER.name]: 'number',
|
|
36
|
-
[oracledb.DB_TYPE_BLOB.name]: 'object',
|
|
37
|
-
[oracledb.DB_TYPE_BOOLEAN.name]: 'boolean',
|
|
38
|
-
[oracledb.DB_TYPE_CHAR.name]: 'string',
|
|
39
|
-
[oracledb.DB_TYPE_CLOB.name]: 'object',
|
|
40
|
-
[oracledb.DB_TYPE_CURSOR.name]: 'object',
|
|
41
|
-
[oracledb.DB_TYPE_DATE.name]: 'Date',
|
|
42
|
-
[oracledb.DB_TYPE_INTERVAL_DS.name]: 'string',
|
|
43
|
-
[oracledb.DB_TYPE_INTERVAL_YM.name]: 'string',
|
|
44
|
-
[oracledb.DB_TYPE_LONG.name]: 'number',
|
|
45
|
-
[oracledb.DB_TYPE_LONG_RAW.name]: 'Buffer',
|
|
46
|
-
[oracledb.DB_TYPE_NCHAR.name]: 'string',
|
|
47
|
-
[oracledb.DB_TYPE_NCLOB.name]: 'object',
|
|
48
|
-
[oracledb.DB_TYPE_NUMBER.name]: 'number',
|
|
49
|
-
[oracledb.DB_TYPE_NVARCHAR.name]: 'string',
|
|
50
|
-
[oracledb.DB_TYPE_OBJECT.name]: 'object',
|
|
51
|
-
[oracledb.DB_TYPE_RAW.name]: 'Buffer',
|
|
52
|
-
[oracledb.DB_TYPE_ROWID.name]: 'number',
|
|
53
|
-
[oracledb.DB_TYPE_TIMESTAMP.name]: 'Date',
|
|
54
|
-
[oracledb.DB_TYPE_TIMESTAMP_LTZ.name]: 'Date',
|
|
55
|
-
[oracledb.DB_TYPE_TIMESTAMP_TZ.name]: 'Date',
|
|
56
|
-
[oracledb.DB_TYPE_VARCHAR.name]: 'string',
|
|
57
|
-
};
|
|
58
5
|
export class OraConnection {
|
|
59
6
|
sessionId;
|
|
60
7
|
intlcon;
|
|
@@ -124,6 +71,29 @@ export class OraConnection {
|
|
|
124
71
|
else
|
|
125
72
|
oraOptions.maxRows = request.fetchRows;
|
|
126
73
|
const out = {};
|
|
74
|
+
const params = request.params;
|
|
75
|
+
const wrapDate = (v) => {
|
|
76
|
+
if (v instanceof Date)
|
|
77
|
+
return {
|
|
78
|
+
type: oracledb.DB_TYPE_DATE,
|
|
79
|
+
dir: oracledb.BIND_IN,
|
|
80
|
+
value: v,
|
|
81
|
+
};
|
|
82
|
+
if (v.value instanceof Date)
|
|
83
|
+
v.type = oracledb.DB_TYPE_DATE;
|
|
84
|
+
return v;
|
|
85
|
+
};
|
|
86
|
+
if (params && typeof params === 'object') {
|
|
87
|
+
if (Array.isArray(params)) {
|
|
88
|
+
params.forEach((v, i) => {
|
|
89
|
+
params[i] = wrapDate(v);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
Object.keys(params).forEach(k => {
|
|
94
|
+
params[k] = wrapDate(params[k]);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
127
97
|
this.intlcon.action = request.action || '';
|
|
128
98
|
let response = await this.intlcon.execute(request.sql, request.params || [], oraOptions);
|
|
129
99
|
if (response.rowsAffected)
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/oracle",
|
|
3
3
|
"description": "SQB serialization extension for Oracle database",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.23.1",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"tslib": "^2.8.1"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@sqb/builder": "^4.
|
|
12
|
-
"@sqb/connect": "^4.
|
|
13
|
-
"@sqb/oracle-dialect": "^4.
|
|
11
|
+
"@sqb/builder": "^4.23.1",
|
|
12
|
+
"@sqb/connect": "^4.23.1",
|
|
13
|
+
"@sqb/oracle-dialect": "^4.23.1",
|
|
14
14
|
"oracledb": ">= 6.4.0"
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|