Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/connection/components/checkStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -24,8 +24,7 @@ export class CheckStatementComponent implements IBMiComponent {
}

async getRemoteState(connection: IBMi, installDirectory: string): Promise<SecureComponentState> {
const remoteSignature = await this.getSQLRoutineSignature(
connection,
const remoteSignature = await connection.getContent().getSQLRoutineSignature(
this.getLibrary(connection),
CheckStatementComponent.FUNCTION_NAME,
CheckStatementComponent.TYPE,
Expand All @@ -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<SecureComponentState> {
return connection.withTempDirectory(async tempDir => {
const tempSourcePath = getVSCodeTools()?.ensureFullPath(posix.join(tempDir, `sqlchecker.sql`), connection?.getConfig()?.homeDirectory);
Expand Down
2 changes: 1 addition & 1 deletion src/connection/components/validateStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValidateStatementComponent | undefined> {
Expand Down
Loading