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

fix: multi raw SQL queries #973

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hana/lib/HANAService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ SELECT ${mixing} FROM JSON_TABLE(SRC.JSON, '$' COLUMNS(${extraction})) AS NEW LE
async dispatch(req) {
// Look for deployment batch dispatch and execute as single query
// When deployment is not executed in a batch it will fail to create views
if (Array.isArray(req.query) && !req.query.find(q => typeof q !== 'string')) {
if (Array.isArray(req.query) && !req.query.find(q => typeof q !== 'string' || this.hasResults(q))) {
req.query = `DO BEGIN ${req.query
.map(
q =>
Expand Down
6 changes: 6 additions & 0 deletions test/scenarios/bookshop/read.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ describe('Bookshop - Read', () => {
test('Plain sql', async () => {
const res = await cds.run('SELECT * FROM sap_capire_bookshop_Books')
expect(res.length).to.be.eq(5)
const [res1, res2] = await cds.run([
'SELECT * FROM sap_capire_bookshop_Books',
'SELECT * FROM sap_capire_bookshop_Books',
])
expect(res1.length).to.be.eq(5)
expect(res2.length).to.be.eq(5)
})

test('Plain sql with values', async () => {
Expand Down
Loading