Skip to content

Commit

Permalink
fix: descriptions of some standard database functions (#1519)
Browse files Browse the repository at this point in the history
after trying them out on my own, I saw some derivations from the actual
behavior compared to the described behavior.

---------

Co-authored-by: René Jeglinsky <[email protected]>
Co-authored-by: Christian Georgi <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent ac9a926 commit 8bc73af
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions guides/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,14 @@ This set of functions are by large the same as specified in OData:
* `floor(x)` — rounds the input numeric parameter down to the nearest numeric value
* `round(x)` — rounds the input numeric parameter to the nearest numeric value.
The mid-point between two integers is rounded away from zero, i.e. 0.5 is rounded to 1 and ‑0.5 is rounded to -1.
* `year(x)` `month(x)`, `day(x)`, `hour(x)`, `minute(x)`, `second(x)`, `fractionalseconds(x)`, `time(x)`, `date(x)`
* `year(x)` `month(x)`, `day(x)`, `hour(x)`, `minute(x)`, `second(x)`
returns parts of a datetime for a given `cds.DateTime` / `cds.Date` / `cds.Time`
* `time(x)`, `date(x)` - returns a string representing the `time` / `date` for a given `cds.DateTime` / `cds.Date` / `cds.Time`
* `fractionalseconds(x)` - returns a a `Decimal` representing the fractions of a second for a given `cds.Timestamp`
* `maxdatetime(x)`, `mindatetime(x)`return the maximum or minimum datetime for a given `cds.DateTime` / `cds.Date` / `cds.Time`
* `totalseconds(x)` — returns the total seconds of a datetime for a given `cds.DateTime` / `cds.Time`
* `totalseconds(x)` — returns the duration of the value in total seconds, including fractional seconds. The [OData spec](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_totalseconds) defines the input as EDM.Duration: `P12DT23H59M59.999999999999S`
* `now()` — returns the current datetime
* `min(x)` `max(x)` `sum(x)` `avg(x)` `count(x)`, `countdistinct(x)` — aggregate functions
* `min(x)` `max(x)` `sum(x)` `average(x)` `count(x)`, `countdistinct(x)` — aggregate functions
* `search(xs,y)` — checks whether `y` is contained in any of `xs`, may be fuzzy → [see Searching Data](../guides/providing-services#searching-data)
* `session_context(v)` — with standard variable names → [see Session Variables](#session-variables)
> <sup>1</sup> These functions work zero-based. E.g., `substring('abcdef', 1, 3)` returns 'bcd'
Expand Down

0 comments on commit 8bc73af

Please sign in to comment.