@profoundlogic/ras-native 1.0.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/README.md +3 -0
- package/bin/os400_ppc64/ras-native.node +0 -0
- package/index.d.ts +110 -0
- package/index.js +4 -0
- package/package.json +10 -0
package/README.md
ADDED
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
declare module "@ProfoundLogic/ras-native" {
|
|
2
|
+
|
|
3
|
+
export type ConnectionOptions = {
|
|
4
|
+
auto_commit?: boolean;
|
|
5
|
+
commit?: "none" | "nc" | "chg" | "ur" | "cs" | "all" | "rs" | "rr";
|
|
6
|
+
date_format?: "iso" | "usa" | "eur" | "jis" | "mdy" | "dmy" | "ymd" | "jul" | "job";
|
|
7
|
+
date_separator?: "/" | "-" | "." | "," | " " | "job";
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
decimal_separator?: "." | "," | "job";
|
|
10
|
+
force_translate?: boolean;
|
|
11
|
+
max_buffer?: number;
|
|
12
|
+
naming?: "sql" | "sys";
|
|
13
|
+
rows?: number;
|
|
14
|
+
sort_sequence?: "hex" | "job" | "jobrun";
|
|
15
|
+
time_format?: "iso" | "usa" | "eur" | "jis" | "hms";
|
|
16
|
+
time_separator?: ":" | "." | "," | " " | "job";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class Connection {
|
|
20
|
+
constructor(options?: ConnectionOptions);
|
|
21
|
+
user: string | null;
|
|
22
|
+
rdb: string | null;
|
|
23
|
+
connect(rdb: string): Promise<void>;
|
|
24
|
+
connect(user: string, password: string, rdb?: string): Promise<void>;
|
|
25
|
+
disconnect(): Promise<void>;
|
|
26
|
+
query(sql: string): Query;
|
|
27
|
+
query(sql: string, options: QueryOptions): Query;
|
|
28
|
+
query(sql: string, params: QueryParams): Query;
|
|
29
|
+
query(sql: string, params: QueryParams, options: QueryOptions): Query;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type QueryOutputParam = {
|
|
33
|
+
input?: QueryParam;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type QueryParam = string | number | bigint | Buffer | null | QueryOutputParam;
|
|
37
|
+
|
|
38
|
+
export type QueryParams = QueryParam[];
|
|
39
|
+
|
|
40
|
+
export type QueryOptions = {
|
|
41
|
+
close?: boolean;
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
force_translate?: boolean;
|
|
44
|
+
max_buffer?: number;
|
|
45
|
+
rows?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type QueryState = "not_executed" | "executing" | "executed" | "complete";
|
|
49
|
+
|
|
50
|
+
export type ResultColumnMetadata = {
|
|
51
|
+
name: string;
|
|
52
|
+
type: number;
|
|
53
|
+
length: number;
|
|
54
|
+
precision: number;
|
|
55
|
+
scale: number;
|
|
56
|
+
ccsid: number;
|
|
57
|
+
nullable: boolean;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ResultColumn = string | number | bigint | Buffer | null;
|
|
61
|
+
export type ResultRow = Record<string, ResultColumn>;
|
|
62
|
+
|
|
63
|
+
export type OutputParam = ResultColumn;
|
|
64
|
+
export type OutputParams = Record<string, OutputParam>;
|
|
65
|
+
|
|
66
|
+
export type OutputParamMetadata = {
|
|
67
|
+
name: string;
|
|
68
|
+
type: number;
|
|
69
|
+
ccsid: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type QueryResult = {
|
|
73
|
+
state: QueryState;
|
|
74
|
+
affectedRows?: number;
|
|
75
|
+
sqlcode: number;
|
|
76
|
+
sqlstate: string;
|
|
77
|
+
message?: string;
|
|
78
|
+
outputParams?: OutputParams;
|
|
79
|
+
outputParamMetadata?: OutputParamMetadata[];
|
|
80
|
+
columns?: ResultColumnMetadata[];
|
|
81
|
+
results?: ResultRow[];
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type QueryFetchResult = {
|
|
85
|
+
state: QueryState;
|
|
86
|
+
sqlcode: number;
|
|
87
|
+
sqlstate: string;
|
|
88
|
+
message?: string;
|
|
89
|
+
outputParams?: OutputParams;
|
|
90
|
+
outputParamMetadata?: OutputParamMetadata[];
|
|
91
|
+
columns: ResultColumnMetadata[];
|
|
92
|
+
results: ResultRow[];
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export class Query {
|
|
96
|
+
private constructor();
|
|
97
|
+
get sql(): string;
|
|
98
|
+
get state(): QueryState;
|
|
99
|
+
execute(): Promise<QueryResult>;
|
|
100
|
+
fetch(): Promise<QueryFetchResult>;
|
|
101
|
+
close(): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface SQLError extends Error {
|
|
105
|
+
name: "SQLError";
|
|
106
|
+
sqlcode: number;
|
|
107
|
+
sqlstate: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
package/index.js
ADDED
package/package.json
ADDED