Skip to content

Call actions for procedures and functions - #565

Open
buzzia2001 wants to merge 1 commit into
mainfrom
featGenerateSql
Open

Call actions for procedures and functions#565
buzzia2001 wants to merge 1 commit into
mainfrom
featGenerateSql

Conversation

@buzzia2001

Copy link
Copy Markdown
Member

Changes

This PR enables the generation of CALL or SELECT statements for procedures and functions (table and scalar).

How to test this PR

From the SCHEMA BROWSER, select a procedure or a function (scalar or table), the “Generate Call Statement” option will appear. Click it. A new tab will open with the SQL code for querying or calling the function/procedure.
image

Procedure:
image

Scalar function:
image

Table function:
image

@forstie @ryan-moeller21 could you test it?

Checklist

  • have tested my change
  • have created one or more test cases
  • updated relevant documentation
  • Remove any/all console.logs I added
  • have added myself to the contributors' list in CONTRIBUTING.md

Closes #221

@buzzia2001 buzzia2001 self-assigned this Aug 3, 2026
@buzzia2001 buzzia2001 added the enhancement New feature or request label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

👋 A new build is available for this PR based on dce4cf0.

Comment thread src/database/callable.ts
Comment on lines +50 to +53
switch (result[0]?.FUNCTION_TYPE?.trim()) {
case `S`: return `SCALAR`;
case `C`: return `COLUMN`;
case `T`: return `TABLE`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QSYS2.SYSFUNCS will return a blank if the entry corresponds to a procedure. Will this ever be run against a procedure, and should it handle that procedure nicely?

I see that the call to getFunctionType only occurs if object.type === function`` returns true, but I'm not familiar with the SQLObject class.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ryan-moeller21,
getFunctionType is called only when object type is function:

image

If the function receives a different value, it returns null, which then becomes SCALAR as the default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schemas - Generate an SQL statement for routines

2 participants