Skip to content

feat: add wsSQL2 service and related functionality - #4648

Open
GordonSmith wants to merge 1 commit into
hpcc-systems:mainfrom
GordonSmith:WsSQL2
Open

GordonSmith wants to merge 1 commit into
hpcc-systems:mainfrom
GordonSmith:WsSQL2

Conversation

@GordonSmith

@GordonSmith GordonSmith commented Oct 21, 2026 •

Copy link
Copy Markdown
Member
  • Introduced wsSQL2 service with methods for executing queries, fetching result sets, and handling logical file metadata.
  • Added SQL2Service class extending Service to manage SQL operations.
  • Implemented SplitQuery functionality to handle multi-statement SQL scripts.
  • Created comprehensive tests for SQLConnection and wsSQL2 service to ensure correct behavior and error handling.
  • Updated index files to export new wsSQL2 service and related types.

Checklist:

  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit message includes a "fixes" reference if appropriate.
    • The commit is signed.
  • The change has been fully tested:
    • I have viewed all related gallery items
    • I have viewed all related dermatology items
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised new issues to address them separately

Testing:

- Introduced wsSQL2 service with methods for executing queries, fetching result sets, and handling logical file metadata.
- Added SQL2Service class extending Service to manage SQL operations.
- Implemented SplitQuery functionality to handle multi-statement SQL scripts.
- Created comprehensive tests for SQLConnection and wsSQL2 service to ensure correct behavior and error handling.
- Updated index files to export new wsSQL2 service and related types.
@GordonSmith
GordonSmith requested a review from jeclrsg October 21, 2026 10:35

@jeclrsg jeclrsg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@GordonSmith Only a few things that jumped out at me. And GH had a flagged some of the tests about that ver_ being 0.00 instead of 1.00.

if (typeof response.Rows !== "string") {
throw new Error("WsSQL2 response is missing Rows");
}
const rows: unknown = JSON.parse(response.Rows);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible for Rows to ever be invalid JSON? If so, might be good to have some context instead of just the default exception, like you did with these others.

const response = await this.service.SplitQuery({ SqlText: sql });
checkExceptions(response);
const statements = response.Statements?.Statement;
if (statements === undefined && response.Statements === undefined) return [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be something like:

const statements = response.Statements?.Statement ?? [];
if (statements.length === 0) return [];

Currently, if Statements were an empty object (is that possible?), this would skip the early return and throw.

Comment thread packages/comms/tests/wsSQL2.spec.ts

This branch has not been deployed

No deployments
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