Skip to content

Commit

Permalink
fix: etag with stream_compat (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkozyura authored Apr 8, 2024
1 parent a67f05c commit b0a3a41
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion db-service/lib/SQLService.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@ class SQLService extends DatabaseService {
if (cds.env.features.stream_compat) {
if (query._streaming) {
this._changeToStreams(cqn.SELECT.columns, rows, true, true)
return rows.length ? { value: Object.values(rows[0])[0] } : undefined
if (!rows.length) return

const result = rows[0]
// stream is always on position 0. Further properties like etag are inserted later.
let [key, val] = Object.entries(result)[0]
result.value = val
delete result[key]

return result
}
} else {
this._changeToStreams(cqn.SELECT.columns, rows, query.SELECT.one, false)
Expand Down

0 comments on commit b0a3a41

Please sign in to comment.