Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-deps
Browse files Browse the repository at this point in the history
johannes-vogel authored Jan 17, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents f20155f + cde7514 commit c1ac228
Showing 9 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions db-service/lib/cqn2sql.js
Original file line number Diff line number Diff line change
@@ -197,6 +197,7 @@ class CQN2SQLRenderer {
Association: () => false,
Composition: () => false,
array: () => 'NCLOB',
Map: () => 'NCLOB',
// HANA types
'cds.hana.TINYINT': () => 'TINYINT',
'cds.hana.REAL': () => 'REAL',
2 changes: 1 addition & 1 deletion db-service/lib/cqn4sql.js
Original file line number Diff line number Diff line change
@@ -1286,7 +1286,7 @@ function cqn4sql(originalQuery, model) {
}
}
return flatColumns
} else if (element.elements) {
} else if (element.elements && element.type !== 'cds.Map') {
const flatRefs = []
Object.values(element.elements).forEach(e => {
const alias = columnAlias ? `${columnAlias}_${e.name}` : null
1 change: 1 addition & 0 deletions hana/lib/HANAService.js
Original file line number Diff line number Diff line change
@@ -1160,6 +1160,7 @@ SELECT ${mixing} FROM JSON_TABLE(SRC.JSON, '$' COLUMNS(${extraction})) AS NEW LE
LargeBinary: () => `NVARCHAR(2147483647)`,
Binary: () => `NVARCHAR(2147483647)`,
array: () => `NVARCHAR(2147483647) FORMAT JSON`,
Map: () => `NVARCHAR(2147483647) FORMAT JSON`,
Vector: () => `NVARCHAR(2147483647)`,
Decimal: () => `DECIMAL`,

2 changes: 2 additions & 0 deletions postgres/lib/PostgresService.js
Original file line number Diff line number Diff line change
@@ -512,6 +512,7 @@ GROUP BY k
Time: () => 'TIME',
DateTime: () => 'TIMESTAMP',
Timestamp: () => 'TIMESTAMP',
Map: () => 'JSONB',

// HANA Types
'cds.hana.CLOB': () => 'BYTEA',
@@ -542,6 +543,7 @@ GROUP BY k
DecimalFloat: (e, t) => e[0] === '$' ? e : `CAST(${e} as decimal${t.precision && t.scale ? `(${t.precision},${t.scale})` : ''})`,
Binary: e => e[0] === '$' ? e : `DECODE(${e},'base64')`,
LargeBinary: e => e[0] === '$' ? e : `DECODE(${e},'base64')`,
Map: e => e[0] === '$' ? e : `CAST(${e} as jsonb)`,

// HANA Types
'cds.hana.CLOB': e => e[0] === '$' ? e : `DECODE(${e},'base64')`,
1 change: 1 addition & 0 deletions sqlite/lib/SQLiteService.js
Original file line number Diff line number Diff line change
@@ -247,6 +247,7 @@ class SQLiteService extends SQLService {
Time: () => 'TIME_TEXT',
DateTime: () => 'DATETIME_TEXT',
Timestamp: () => 'TIMESTAMP_TEXT',
Map: () => 'JSON_TEXT'
}

get is_distinct_from_() {
3 changes: 2 additions & 1 deletion test/bookshop/db/schema.cds
Original file line number Diff line number Diff line change
@@ -67,5 +67,6 @@ entity C : managed {
B : Integer;
toB : Composition of many B
on toB.ID = $self.B;
};
}

entity BooksAnnotated as projection on Books;
6 changes: 6 additions & 0 deletions test/compliance/literals.test.js
Original file line number Diff line number Diff line change
@@ -56,4 +56,10 @@ describe('literals', () => {
throw new Error('not supported')
})
})

describe('maps', () => {
test.skip('missing', () => {
throw new Error('not supported')
})
})
})
4 changes: 4 additions & 0 deletions test/compliance/resources/db/basic/literals.cds
Original file line number Diff line number Diff line change
@@ -58,6 +58,10 @@ entity array {
integer : array of Integer;
}

entity map {
map : Map;
}

entity binaries {
binary : Binary;
largebinary : LargeBinary;
20 changes: 20 additions & 0 deletions test/compliance/resources/db/basic/literals/basic.literals.map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = [
{
map: null,
},
{
map: {},
},
{
map: { key: null },
},
{
map: { key: 'value' },
},
{
map: { a: { b: { c: 3 } } },
},
{
map: { a: [{ b: 1 }, { c: 2 }] },
},
]

0 comments on commit c1ac228

Please sign in to comment.