From 9306d4109cac673cf25838290bfdbde4bf5e9bd2 Mon Sep 17 00:00:00 2001 From: Andrea Buzzi <155985472+buzzia2001@users.noreply.github.com> Date: Sun, 28 Jun 2026 23:04:32 +0200 Subject: [PATCH] New core feature used to verify SQL object signatures --- src/connection/components/checkStatement.ts | 14 ++------------ src/connection/components/validateStatement.ts | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/connection/components/checkStatement.ts b/src/connection/components/checkStatement.ts index e3365757..1728ef45 100644 --- a/src/connection/components/checkStatement.ts +++ b/src/connection/components/checkStatement.ts @@ -7,7 +7,7 @@ export class CheckStatementComponent implements IBMiComponent { static ID = "CheckStatementComponent"; private static readonly VERSION = 1; static readonly FUNCTION_NAME = `CHKSTMNT${CheckStatementComponent.VERSION.toString().padStart(4, "0")}`; - private static readonly SIGNATURE = "7CDD7F08E0CE36EF271A81197C2D770CBBD3A3AA2E02D3217421995EA555A7F0"; + private static readonly SIGNATURE = "QSYS/QSQCHKS"; private static readonly VALID_STATEMENT_LENGTH = 32740; private static readonly TYPE = "PROCEDURE"; @@ -24,8 +24,7 @@ export class CheckStatementComponent implements IBMiComponent { } async getRemoteState(connection: IBMi, installDirectory: string): Promise { - const remoteSignature = await this.getSQLRoutineSignature( - connection, + const remoteSignature = await connection.getContent().getSQLRoutineSignature( this.getLibrary(connection), CheckStatementComponent.FUNCTION_NAME, CheckStatementComponent.TYPE, @@ -36,15 +35,6 @@ export class CheckStatementComponent implements IBMiComponent { }; } - /** - * Custom implementation that uses EXTERNAL_NAME instead of ROUTINEDEF - */ - private async getSQLRoutineSignature(connection: IBMi, library: string, name: string, type: "PROCEDURE" | "FUNCTION") { - return (await connection.runSQL( - /* sql */`select HASH_SHA256(EXTERNAL_NAME) SIGNATURE from qsys2.sysroutines where routine_type = '${type}' and rtnschema = '${library}' and RTNNAME = '${name}' fetch first row only` - )).pop()?.SIGNATURE as string; - } - async update(connection: IBMi, installDirectory: string): Promise { return connection.withTempDirectory(async tempDir => { const tempSourcePath = getVSCodeTools()?.ensureFullPath(posix.join(tempDir, `sqlchecker.sql`), connection?.getConfig()?.homeDirectory); diff --git a/src/connection/components/validateStatement.ts b/src/connection/components/validateStatement.ts index b9722a03..cc723a32 100644 --- a/src/connection/components/validateStatement.ts +++ b/src/connection/components/validateStatement.ts @@ -43,7 +43,7 @@ export interface SqlSyntaxError { export class ValidateStatementComponent implements IBMiComponent { static ID = "ValidateStatement"; private static readonly VERSION = 2; - private static readonly SIGNATURE = "6EBAA79B92569974227D1A9CCFBF78439DBA1E2EABBAB3CABFC8962C25BC6647"; + private static readonly SIGNATURE = "1937A5AE221BD126F8514798721DFC7F1259CAA9018443ABE38CCF735F48073C"; private static readonly FUNCTION_NAME = `VALIDATE_STATEMENT${ValidateStatementComponent.VERSION.toString().padStart(4, "0")}`; static async get(): Promise {