Skip to content

Commit

Permalink
feat: support for SELECT.hint (#1004)
Browse files Browse the repository at this point in the history
part of `cdsnode/issues/2186`

---------

Co-authored-by: Johannes Vogel <[email protected]>
  • Loading branch information
schwma and johannes-vogel authored Feb 12, 2025
1 parent a6ddb9d commit 2c6a763
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db-service/lib/cql-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const HANAFunctions = {
* @param {string} x session variable name or SQL expression
* @returns {string}
*/
session_context: x => `session_context('${x.val}')`,
session_context: x => `session_context('${x.val}')`,

// Time functions
current_date: p => (p ? `current_date(${p})` : 'current_date'),
Expand Down
4 changes: 3 additions & 1 deletion hana/lib/HANAService.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ class HANAService extends SQLService {
const isSimple = temporary.length + blobs.length + withclause.length === 0

// REVISIT: add prepare options when param:true is used
const sqlScript = isLockQuery || isSimple ? sql : this.wrapTemporary(temporary, withclause, blobs)
let sqlScript = isLockQuery || isSimple ? sql : this.wrapTemporary(temporary, withclause, blobs)
const { hints } = query.SELECT
if (hints) sqlScript += ` WITH HINT (${hints.join(',')})`
let rows
if (values?.length || blobs.length > 0) {
const ps = await this.prepare(sqlScript, blobs.length)
Expand Down

0 comments on commit 2c6a763

Please sign in to comment.