no-db-keywords
Rule Details
The CDS compiler and CAP runtimes provide smart quoting for reserved words in SQLite so they can still be used in most situations. But in general reserved words cannot be used as identifiers and this rule warns you if you use any of the reserved SQL keywords.
Examples
✅ Correct example
In the following example, none of the reserved SQL keywords are used as identifiers, so the rule doesn't raise any warnings:
cds
namespace sap.capire.bookshop;
entity Books {
key ID : Integer;
@mandatory title : localized String(111);
}
entity Order {
key ID : Integer;
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
❌ Incorrect example
This example shows the reserved SQL keyword Order used as an entity name, so the rule will raise a warning:
cds
entity sap.capire.bookshop.Books {
key ID : Integer;
@mandatory title : localized String(111);
}
// Order is a reserved keyword in SQLite.
entity ORDER {
key ID : Integer;
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Version
This rule was introduced in @sap/eslint-plugin-cds 2.1.0.