Skip to content

Commit

Permalink
Make docu on @sql.append/prepend and string literals a bit more preci…
Browse files Browse the repository at this point in the history
…se (#699)
  • Loading branch information
stewsk authored Feb 22, 2024
1 parent 4bf0683 commit 2c1b907
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cds/cdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ Using literals in CDS models is commonly used, for example, to set default value
[Learn more about literals and their representation in CSN.](./csn#literals){.learn-more}


#### Multiline String Literals
#### String Literals
{#multiline-literals}

String literals enclosed in single ticks, for example `'string'`,
are limited to a single line.
are limited to a single line. A single tick `'` inside the literal is escaped by doubling it: `'it''s escaped`.

Use string literals enclosed in single or triple **backticks** for multiline strings. Within those strings, escape sequences from JavaScript, such as `\t` or `\u0020`, are supported. Line endings are normalized. If you don't want a line ending at that position, end a line with a backslash (`\`). Only for string literals inside triple backticks, indentation is stripped and tagging is possible.

Expand Down
5 changes: 2 additions & 3 deletions guides/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,8 @@ CREATE VIEW V AS SELECT ... FROM E WITH DDL ONLY;
The following rules apply:
- The value of the annotation must be a [string literal](../cds/cdl#multiline-literals).
- The compiler doesn't check or process the provided SQL snippets in any way. You're responsible to ensure that the resulting statement is valid and doesn't negatively impact your database or your application. We don't provide support for problems caused by using this feature.
- If you refer to a column name in the annotation, you need to take care of
Expand All @@ -690,9 +692,6 @@ The following rules apply:
If you use native database clauses in combination with `@cds.persistence.journal`, see [Schema Evolution Support of Native Database Clauses](databases-hana#schema-evolution-native-db-clauses).
### Reserved Words
The CDS compiler and CAP runtimes provide smart quoting for reserved words in SQLite and in SAP HANA so that they can still be used in most situations. But in general reserved words cannot be used as identifiers. The list of reserved words varies per database.
Expand Down

0 comments on commit 2c1b907

Please sign in to comment.