Skip to content

Call actions for procedures and functions - #565

Merged
buzzia2001 merged 3 commits into
mainfrom
featGenerateSql
Aug 21, 2026
Merged

Call actions for procedures and functions#565
buzzia2001 merged 3 commits 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 fdff79a.

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.

@SanjulaGanepola SanjulaGanepola left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@buzzia2001 Couple minor comments and then please merge. Nice work

Comment thread src/views/schemaBrowser/statements.ts Outdated
Comment thread src/views/schemaBrowser/contributes.json Outdated
buzzia2001 and others added 2 commits August 21, 2026 10:11
Co-authored-by: Sanjula Ganepola <32170854+SanjulaGanepola@users.noreply.github.com>
Co-authored-by: Sanjula Ganepola <32170854+SanjulaGanepola@users.noreply.github.com>
@buzzia2001
buzzia2001 merged commit bab9e79 into main Aug 21, 2026
1 check passed
@sebjulliand
sebjulliand deleted the featGenerateSql branch August 21, 2026 08:14
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

3 participants