-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support current_utctimestamp (#865)
works locally with SAP HANA Cloud but does not work with HXE --------- Co-authored-by: Samuel Brucksch <SamuelBrucksch@users.noreply.github.com>
- Loading branch information
1 parent
f6593e6
commit aaf39ad
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const cds = require('../../test/cds') | ||
|
||
describe('HANA native functions', () => { | ||
const { expect } = cds.test(__dirname, 'fuzzy.cds') | ||
|
||
describe('current_timestamp', () => { | ||
test('no arguments', async () => { | ||
const cqn = { SELECT: { | ||
one: true, | ||
from: {ref: ['DUMMY']}, | ||
columns: [{func: 'current_utctimestamp', as: 'NO'}] | ||
}} | ||
|
||
const res = await cds.run(cqn) | ||
|
||
expect(res.NO.match(/\.(\d\d\d)0000/)).not.to.be.null // default 3 | ||
}) | ||
|
||
// HXE does not allow args | ||
test.skip('0 skips ms precision', async () => { | ||
const cqn = { SELECT: { | ||
one: true, | ||
from: {ref: ['DUMMY']}, | ||
columns: [ | ||
{func: 'current_utctimestamp', as: 'NO'}, | ||
{func: 'current_utctimestamp', args: [{val: 0}], as: 'P0'}] | ||
}} | ||
|
||
const res = await cds.run(cqn) | ||
|
||
expect(res.P0.match(/\.0000000/)).not.to.be.null | ||
}) | ||
|
||
// HXE does not allow args | ||
test.skip('arbitrary values', async () => { | ||
const cqn = { SELECT: { | ||
one: true, | ||
from: {ref: ['DUMMY']}, | ||
columns: [ | ||
{func: 'current_utctimestamp', args: [{val: 3}], as: 'P3'}, | ||
{func: 'current_utctimestamp', args: [{val: 7}], as: 'P7'}] | ||
}} | ||
|
||
const res = await cds.run(cqn) | ||
|
||
expect(res.P3.match(/\.(\d\d\d)0000/)).not.to.be.null | ||
expect(res.P7.match(/\.(\d\d\d\d\d\d\d)/)).not.to.be.null | ||
}) | ||
}) | ||
}) |