Skip to content

Generate RPG data structure from result metadata#368

Merged
worksofliam merged 14 commits intocodefori:mainfrom
janfh:feature/rpg-codegen
Apr 29, 2025
Merged

Generate RPG data structure from result metadata#368
worksofliam merged 14 commits intocodefori:mainfrom
janfh:feature/rpg-codegen

Conversation

@janfh
Copy link
Copy Markdown
Contributor

@janfh janfh commented Apr 11, 2025

Feature to generate RPG data structure from column metadata.

Added statement qualifier "rpg". E.g:

rpg: select cast('' as varchar(100)) as my_text, current_timestamp as my_timestamp, cast(1.0 as numeric(13, 2)) as my_val from sysibm.sysdummy1;

generates:

**free

// statement: select cast('' as varchar(100)) as my_text, current_timestamp as my_timestamp, cast(1.0 as numeric(13, 2)) as my_val from sysibm.sysdummy1

// Row data structure
dcl-ds row_t qualified template;
  my_text varchar(100);
  my_timestamp timestamp;
  my_val zoned(13 : 2);
end-ds;

@worksofliam worksofliam added this to the Fix day milestone Apr 11, 2025
Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

I left a comment about moving logic to another function.

I don't want the logic to generate the content in this function really. We should move it elsewhere so we can write test cases for it.

Please make this change and then lmk when to look again.

Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Left another review.

@janfh
Copy link
Copy Markdown
Contributor Author

janfh commented Apr 16, 2025

@worksofliam : Where do you want the tests? A new testsuite? Please continue to comment if you want me to change something else :) I will continue working on this tomorrow

@janfh janfh requested a review from worksofliam April 17, 2025 11:09
@worksofliam worksofliam modified the milestones: Fix day 1, Fix day 2 Apr 17, 2025
@worksofliam
Copy link
Copy Markdown
Member

@janfh For my own sake of mind, I have had to move this to fix day 2 (Wednesday 23rd) and this will be the first PR I look at then. I may get to it over the weekend if I find a moment. Thanks for your work here!

Also, let's chat on chat.ibmioss.org sometime.

@worksofliam worksofliam modified the milestones: Fix day 2, Fix day 1.5 Apr 28, 2025
@worksofliam
Copy link
Copy Markdown
Member

@janfh Is there any reason you aren't using this switch statement on line 409 to check the .qualifier instead of adding a new else if block?

switch (statementDetail.qualifier) {

@janfh
Copy link
Copy Markdown
Contributor Author

janfh commented Apr 28, 2025

@janfh Is there any reason you aren't using this switch statement on line 409 to check the .qualifier instead of adding a new else if block?

switch (statementDetail.qualifier) {

@worksofliam : I think it was to avoid changing that runSql on 405. But I can change this if you like. I guess there is no reason why we can't always use the runSqlVerbose?

@worksofliam
Copy link
Copy Markdown
Member

@janfh i guess runSqlVerbose can always be used, but i see your point. Leave it as it is for now!

Going to do some final tests in the morning on this one and it should be good to go.

@worksofliam
Copy link
Copy Markdown
Member

@janfh Last thing now is to fix the conflict and we should be good to go.

@janfh
Copy link
Copy Markdown
Contributor Author

janfh commented Apr 29, 2025

Done :)

@worksofliam worksofliam merged commit 47c72e8 into codefori:main Apr 29, 2025
1 check passed
@janfh janfh deleted the feature/rpg-codegen branch April 29, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants