Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support HANA stored procedures #542

Merged
merged 14 commits into from
Mar 26, 2024
Merged

feat: support HANA stored procedures #542

merged 14 commits into from
Mar 26, 2024

Conversation

vkozyura
Copy link
Contributor

No description provided.

await createProcedures()
})

describe('with dynatrace', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't have dynatrace

@@ -0,0 +1,5 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This file should not exist. The test/cds.js file has to add the @cap-js/hana credentials.

CREATE PROCEDURE "procTest0" ( OUT TEST_1 TABLE ( TEST_1_COL_1 NVARCHAR(32) ), OUT TEST_2 NVARCHAR(32) ) AS
BEGIN TEST_1 = SELECT '1' AS TEST_1_COL_1 FROM DUMMY; TEST_2 = '2'; END`)
} catch (e) {
if (e.message.match(/cannot use duplicate name of function or procedure/)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the error code as this is uniformly send from HANA directly.


async function createProcedures() {
try {
await cds.run(`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just put all the procedures into an array and loop over them.

await cds.run(INSERT.into('SAP_CAPIRE_TESTENTITY').columns(['ID', 'title']).rows([3, '3']))
await cds.run(INSERT.into('SAP_CAPIRE_TESTENTITY').columns(['ID', 'title']).rows([4, '4']))
} catch (e) {
// ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Better notice when the data does not actually exist instead of having all tests fail with strange expectations.

expect(res).toEqual(exp)
res = await cds.run(`CALL PROC_TEST_4(?,?,?,?)`, [0, 2])
expect(res).toEqual(exp)
// REVISIT order of OUT parameters does not match positions in stored procedure
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this matter ?

hana/lib/drivers/base.js Outdated Show resolved Hide resolved
vkozyura and others added 4 commits March 25, 2024 11:57
@vkozyura vkozyura enabled auto-merge (squash) March 26, 2024 09:41
@vkozyura vkozyura merged commit 52a00a0 into main Mar 26, 2024
4 of 6 checks passed
@vkozyura vkozyura deleted the feat-stored-proc branch March 26, 2024 09:43
@cap-bots cap-bots mentioned this pull request Mar 26, 2024
johannes-vogel added a commit that referenced this pull request Apr 12, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>db-service: 1.8.0</summary>

##
[1.8.0](db-service-v1.7.0...db-service-v1.8.0)
(2024-04-12)


### Added

* Odata built-in query functions
([#558](#558))
([6e63367](6e63367))
* support HANA stored procedures
([#542](#542))
([52a00a0](52a00a0))


### Fixed

* **`expand`:** Only accept on structures, assocs or table aliases
([#551](#551))
([3248512](3248512))
* **`order by`:** for localized sorting, prepend table alias
([#546](#546))
([a273a92](a273a92))
* etag with stream_compat
([#562](#562))
([b0a3a41](b0a3a41))
* exclude `cds.LargeBinary` from wildcard expansion
([#577](#577))
([6661d63](6661d63))
* Reduce insert queries for deep update
([#568](#568))
([55e5114](55e5114))
* Reduced count query complexity when possible
([#553](#553))
([3331f02](3331f02))
</details>

<details><summary>postgres: 1.7.0</summary>

##
[1.7.0](postgres-v1.6.0...postgres-v1.7.0)
(2024-04-12)


### Added

* Odata built-in query functions
([#558](#558))
([6e63367](6e63367))
</details>

<details><summary>hana: 0.2.0</summary>

##
[0.2.0](hana-v0.1.0...hana-v0.2.0)
(2024-04-12)


### Added

* Odata built-in query functions
([#558](#558))
([6e63367](6e63367))
* support HANA stored procedures
([#542](#542))
([52a00a0](52a00a0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com>
@cap-bots cap-bots mentioned this pull request Jul 18, 2024
This was referenced Jan 28, 2025
@cap-bots cap-bots mentioned this pull request Jan 28, 2025
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.

4 participants