Skip to content

Commit 77fe1dd

Browse files
Merge branch 'halcyon-tech:main' into feature/export-db2-api
2 parents 7b4639c + 1a26ef4 commit 77fe1dd

23 files changed

+1335
-292
lines changed

global.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
interface TableColumn {
32
COLUMN_NAME: string,
43
SYSTEM_COLUMN_NAME: string,
@@ -26,15 +25,6 @@ interface SQLParm {
2625
LONG_COMMENT?: string
2726
}
2827

29-
type StatementType = "statement"|"json"|"csv"|"cl"|"sql";
30-
31-
interface StatementInfo {
32-
content: string,
33-
type: StatementType,
34-
open?: boolean,
35-
history?: boolean
36-
}
37-
3828
interface BasicSQLObject {
3929
type: string;
4030
schema: string;

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-db2i",
33
"displayName": "Db2 for IBM i",
44
"description": "Db2 for IBM i tools in VS Code",
5-
"version": "0.4.0",
5+
"version": "0.4.1",
66
"preview": true,
77
"engines": {
88
"vscode": "^1.70.0"
@@ -572,6 +572,7 @@
572572
"csv": "^6.1.3",
573573
"node-fetch": "^3.3.1",
574574
"octokit": "^2.0.14",
575-
"sql-formatter": "^4.0.2"
575+
"sql-formatter": "^4.0.2",
576+
"lru-cache": "^6.0.0"
576577
}
577578
}

snippets/variables.code-snippets

Lines changed: 46 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,56 @@
11
// https://www.ibm.com/docs/en/i/7.4?topic=statement-special-registers-in-sql-statements
22
// https://www.ibm.com/docs/en/i/7.3?topic=reference-built-in-global-variables
33
{
4-
"client_host": {
5-
"prefix": "client_host",
6-
"body": "client_host",
7-
"description": "This global variable contains the host name of the current client, as returned by the system."
8-
},
9-
"client_ipaddr": {
10-
"prefix": "client_ipaddr",
11-
"body": "client_ipaddr",
12-
"description": "This global variable contains the IP address of the current client, as returned by the system."
13-
},
14-
"client_port": {
15-
"prefix": "client_port",
16-
"body": "client_port",
17-
"description": "This global variable contains the port number used by the current client to communicate with the server."
18-
},
194
"job_name": {
205
"prefix": "job_name",
216
"body": "job_name",
227
"description": "This global variable contains the name of the current job."
238
},
24-
"package_name": {
25-
"prefix": "package_name",
26-
"body": "package_name",
27-
"description": "This global variable contains the name of the package currently being used for a DRDA connection."
28-
},
29-
"package_schema": {
30-
"prefix": "package_schema",
31-
"body": "package_schema",
32-
"description": "This global variable contains the schema name of the package currently being used for a DRDA connection."
33-
},
34-
"package_version": {
35-
"prefix": "package_version",
36-
"body": "package_version",
37-
"description": "This global variable contains the version identifier of the package currently being used for a DRDA connection."
38-
},
399
"process_id": {
4010
"prefix": "process_id",
4111
"body": "process_id",
4212
"description": "This global variable contains the process ID of the current job."
4313
},
44-
"routine_schema": {
45-
"prefix": "routine_schema",
46-
"body": "routine_schema",
47-
"description": "This global variable contains the schema name of the currently executing routine."
48-
},
49-
"routine_specific_name": {
50-
"prefix": "routine_specific_name",
51-
"body": "routine_specific_name",
52-
"description": "This global variable contains the name of the currently executing routine."
53-
},
54-
"routine_type": {
55-
"prefix": "routine_type",
56-
"body": "routine_type",
57-
"description": "This global variable contains the type of the currently executing routine."
58-
},
5914
"server_mode_job_name": {
6015
"prefix": "server_mode_job_name",
6116
"body": "server_mode_job_name",
6217
"description": "This global variable contains the name of the job that established the SQL server mode connection."
6318
},
64-
"thread_id": {
65-
"prefix": "thread_id",
66-
"body": "thread_id",
67-
"description": "This global variable contains the thread ID of the current thread."
68-
},
69-
"current_client_acctng": {
70-
"prefix": "current_client_acctng",
71-
"body": "current_client_acctng",
72-
"description": "The accounting string for the client connection."
73-
},
74-
"current_client_applname": {
75-
"prefix": "current_client_applname",
76-
"body": "current_client_applname",
77-
"description": "The application name for the client connection."
78-
},
79-
"current_client_programid": {
80-
"prefix": "current_client_programid",
81-
"body": "current_client_programid",
82-
"description": "The program ID for the client connection."
83-
},
8419
"current_client_userid": {
8520
"prefix": "current_client_userid",
8621
"body": "current_client_userid",
8722
"description": "The client user ID for the client connection."
8823
},
89-
"current_client_wrkstnname": {
90-
"prefix": "current_client_wrkstnname",
91-
"body": "current_client_wrkstnname",
92-
"description": "The workstation name for the client connection."
93-
},
9424
"current_date": {
9525
"prefix": "current_date",
9626
"body": "current_date",
9727
"description": "The current date."
9828
},
99-
"current_debug_mode": {
100-
"prefix": "current_debug_mode",
101-
"body": "current_debug_mode",
102-
"description": "The debug mode to be used when creating or altering routines."
103-
},
104-
"current_decfloat_rounding_mode": {
105-
"prefix": "current_decfloat_rounding_mode",
106-
"body": "current_decfloat_rounding_mode",
107-
"description": "The rounding mode to be used when working with decimal floating point values."
108-
},
109-
"current_degree": {
110-
"prefix": "current_degree",
111-
"body": "current_degree",
112-
"description": "The number of tasks the database manager should run in parallel."
113-
},
114-
"current_implicit_xmlparse_option": {
115-
"prefix": "current_implicit_xmlparse_option",
116-
"body": "current_implicit_xmlparse_option",
117-
"description": "The whitespace handling options to be used for XML data when implicitly parsed without validation."
118-
},
119-
"current path": {
120-
"prefix": "current path",
121-
"body": "current path",
122-
"description": "The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements."
123-
},
12429
"current_path": {
12530
"prefix": "current_path",
12631
"body": "current_path",
12732
"description": "The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements."
12833
},
129-
"current function path": {
130-
"prefix": "current function path",
131-
"body": "current function path",
132-
"description": "The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements."
133-
},
134-
"current schema": {
135-
"prefix": "current schema",
136-
"body": "current schema",
137-
"description": "The schema name used to qualify unqualified database object references where applicable in dynamically prepared SQL statements."
138-
},
139-
"current server": {
140-
"prefix": "current server",
141-
"body": "current server",
142-
"description": "The name of the relational database currently being used."
143-
},
14434
"current_server": {
14535
"prefix": "current_server",
14636
"body": "current_server",
14737
"description": "The name of the relational database currently being used."
14838
},
149-
"current temporal system_time": {
150-
"prefix": "current temporal system_time",
151-
"body": "current temporal system_time",
152-
"description": "The timestamp to use when querying a system_period temporal table."
153-
},
154-
"current time": {
155-
"prefix": "current time",
156-
"body": "current time",
157-
"description": "The current time."
158-
},
15939
"current_time": {
16040
"prefix": "current_time",
16141
"body": "current_time",
16242
"description": "The current time."
16343
},
164-
"current timestamp": {
165-
"prefix": "current timestamp",
166-
"body": "current timestamp",
167-
"description": "The current date and time in timestamp format."
168-
},
16944
"current_timestamp": {
17045
"prefix": "current_timestamp",
17146
"body": "current_timestamp",
17247
"description": "The current date and time in timestamp format."
17348
},
174-
"current timezone": {
175-
"prefix": "current timezone",
176-
"body": "current timezone",
177-
"description": "A duration of time that links local time to Universal Time Coordinated (UTC) using the formula: `local time - CURRENT TIMEZONE = UTC`. It is taken from the system value QUTCOFFSET."
178-
},
17949
"current_timezone": {
18050
"prefix": "current_timezone",
18151
"body": "current_timezone",
18252
"description": "A duration of time that links local time to Universal Time Coordinated (UTC) using the formula: `local time - CURRENT TIMEZONE = UTC`. It is taken from the system value QUTCOFFSET."
18353
},
184-
"current user": {
185-
"prefix": "current user",
186-
"body": "current user",
187-
"description": "The primary authorization identifier of the job."
188-
},
18954
"current_user": {
19055
"prefix": "current_user",
19156
"body": "current_user",
@@ -206,4 +71,50 @@
20671
"body": "system_user",
20772
"description": "The authorization identifier (user profile) of the user connected to the database."
20873
},
74+
// "current path": {
75+
// "prefix": "current path",
76+
// "body": "current path",
77+
// "description": "The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements."
78+
// },
79+
// "current function path": {
80+
// "prefix": "current function path",
81+
// "body": "current function path",
82+
// "description": "The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements."
83+
// },
84+
// "current schema": {
85+
// "prefix": "current schema",
86+
// "body": "current schema",
87+
// "description": "The schema name used to qualify unqualified database object references where applicable in dynamically prepared SQL statements."
88+
// },
89+
// "current server": {
90+
// "prefix": "current server",
91+
// "body": "current server",
92+
// "description": "The name of the relational database currently being used."
93+
// },
94+
// "current temporal system_time": {
95+
// "prefix": "current temporal system_time",
96+
// "body": "current temporal system_time",
97+
// "description": "The timestamp to use when querying a system_period temporal table."
98+
// },
99+
// "current time": {
100+
// "prefix": "current time",
101+
// "body": "current time",
102+
// "description": "The current time."
103+
// },
104+
// "current timestamp": {
105+
// "prefix": "current timestamp",
106+
// "body": "current timestamp",
107+
// "description": "The current date and time in timestamp format."
108+
// },
109+
// "current timezone": {
110+
// "prefix": "current timezone",
111+
// "body": "current timezone",
112+
// "description": "A duration of time that links local time to Universal Time Coordinated (UTC) using the formula: `local time - CURRENT TIMEZONE = UTC`. It is taken from the system value QUTCOFFSET."
113+
// },
114+
// "current user": {
115+
// "prefix": "current user",
116+
// "body": "current user",
117+
// "description": "The primary authorization identifier of the job."
118+
// },
119+
209120
}

src/connection/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class SQLJobManager {
7070
}
7171

7272
closeJobByName(name: string) {
73-
const id = this.jobs.findIndex(info => info.name);
73+
const id = this.jobs.findIndex(info => info.name === name);
7474
return this.closeJob(id);
7575
}
7676

src/connection/query.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { changedCache} from "../language/providers/completionItemCache";
2+
import Document from "../language/sql/document";
13
import { SQLJob } from "./sqlJob";
24
import { CLCommandResult, JobLogEntry, QueryOptions, QueryResult, ServerResponse } from "./types";
35
export enum QueryState {
@@ -96,6 +98,7 @@ export class Query<T> {
9698
throw new Error(queryResult.error || `Failed to run query (unknown error)`);
9799
}
98100
this.correlationId = queryResult.id;
101+
99102
return queryResult;
100103
}
101104

src/connection/serverComponent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Config } from "../config";
77
import path from "path";
88
import { OutputChannel, commands, window } from "vscode";
99

10-
import { writeFile } from "fs/promises";
10+
import { writeFile, unlink } from "fs/promises";
1111
import os from "os";
1212

1313
const octokit = new Octokit();
@@ -135,6 +135,9 @@ export class ServerComponent {
135135

136136
await connection.uploadFiles([{local: tempFile, remote: remotePath}]);
137137

138+
// Clean up the temp file
139+
unlink(tempFile);
140+
138141
await Config.setServerComponentName(basename);
139142

140143
window.showInformationMessage(`Db2 for IBM i extension server component has been updated!`);

0 commit comments

Comments
 (0)