@sap/cds-compiler
Advanced tools
Comparing version 1.50.2 to 1.50.4
@@ -9,2 +9,8 @@ # ChangeLog for cdx compiler and backends | ||
## Version 1.50.4 - 2021-04-06 | ||
### Fixed | ||
- to.hdbcds: CDS and HANA CDS types inside cast expressions are mapped to their SQL-counterparts, as the CDS types can't be used in a cast. | ||
## Version 1.50.2 - 2021-03-19 | ||
@@ -11,0 +17,0 @@ |
@@ -34,5 +34,55 @@ // Common render functions for toCdl.js and toSql.js | ||
// Type mapping from cds type names to DB type names: | ||
// (in the future, we would introduce an option for the mapping table) | ||
const cdsToSqlTypes = { | ||
standard: { | ||
// characters and binaries | ||
'cds.String': 'NVARCHAR', | ||
'cds.hana.NCHAR': 'NCHAR', | ||
'cds.LargeString': 'NCLOB', | ||
'cds.hana.VARCHAR': 'VARCHAR', | ||
'cds.hana.CHAR': 'CHAR', | ||
'cds.hana.CLOB': 'CLOB', | ||
'cds.Binary': 'VARBINARY', // not a Standard SQL type, but HANA and MS SQL Server | ||
'cds.hana.BINARY': 'BINARY', | ||
'cds.LargeBinary': 'BLOB', | ||
// numbers: exact and approximate | ||
'cds.Decimal': 'DECIMAL', | ||
'cds.DecimalFloat': 'DECIMAL', | ||
'cds.Integer64': 'BIGINT', | ||
'cds.Integer': 'INTEGER', | ||
'cds.hana.SMALLINT': 'SMALLINT', | ||
'cds.hana.TINYINT': 'TINYINT', // not a Standard SQL type | ||
'cds.Double': 'DOUBLE', | ||
'cds.hana.REAL': 'REAL', | ||
// other: date/time, boolean | ||
'cds.Date': 'DATE', | ||
'cds.Time': 'TIME', | ||
'cds.DateTime': 'TIMESTAMP', // cds-compiler#2758 | ||
'cds.Timestamp': 'TIMESTAMP', | ||
'cds.Boolean': 'BOOLEAN', | ||
'cds.UUID': 'NVARCHAR', // changed to cds.String earlier | ||
// (TODO: do it later; TODO: why not CHAR or at least VARCHAR?) | ||
}, | ||
hana: { | ||
'cds.hana.SMALLDECIMAL': 'SMALLDECIMAL', | ||
'cds.LocalDate': 'DATE', | ||
'cds.LocalTime': 'TIME', | ||
'cds.DateTime': 'SECONDDATE', | ||
'cds.UTCDateTime': 'SECONDDATE', | ||
'cds.UTCTimestamp': 'TIMESTAMP', | ||
'cds.hana.ST_POINT': 'ST_POINT', | ||
'cds.hana.ST_GEOMETRY': 'ST_GEOMETRY', | ||
}, | ||
sqlite: { | ||
'cds.Binary': 'CHAR', | ||
'cds.hana.BINARY': 'CHAR', | ||
'cds.hana.SMALLDECIMAL': 'DECIMAL', | ||
}, | ||
}; | ||
module.exports = { | ||
renderFunc | ||
renderFunc, | ||
cdsToSqlTypes, | ||
} |
@@ -8,3 +8,3 @@ | ||
const version = require('../../package.json').version; | ||
const { renderFunc } = require('./renderUtil'); | ||
const { renderFunc, cdsToSqlTypes } = require('./renderUtil'); | ||
const DuplicateChecker = require('./DuplicateChecker'); | ||
@@ -17,46 +17,2 @@ const { checkCSNVersion } = require('../json/csnVersion'); | ||
// Type mapping from cds type names to DB type names: | ||
// (in the future, we would introduce an option for the mapping table) | ||
const cdsToSqlTypes = { | ||
standard: { | ||
// characters and binaries | ||
'cds.String': 'NVARCHAR', | ||
'cds.hana.NCHAR': 'NCHAR', | ||
'cds.LargeString' : 'NCLOB', | ||
'cds.hana.VARCHAR': 'VARCHAR', | ||
'cds.hana.CHAR': 'CHAR', | ||
'cds.hana.CLOB': 'CLOB', | ||
'cds.Binary': 'VARBINARY', // not a Standard SQL type, but HANA and MS SQL Server | ||
'cds.hana.BINARY': 'BINARY', | ||
'cds.LargeBinary': 'BLOB', | ||
// numbers: exact and approximate | ||
'cds.Decimal': 'DECIMAL', | ||
'cds.DecimalFloat': 'DECIMAL', | ||
'cds.Integer64': 'BIGINT', | ||
'cds.Integer': 'INTEGER', | ||
'cds.hana.SMALLINT': 'SMALLINT', | ||
'cds.hana.TINYINT': 'TINYINT', // not a Standard SQL type | ||
'cds.Double': 'DOUBLE', | ||
'cds.hana.REAL': 'REAL', | ||
// other: date/time, boolean | ||
'cds.Date': 'DATE', | ||
'cds.Time': 'TIME', | ||
'cds.DateTime': 'TIMESTAMP', // cds-compiler#2758 | ||
'cds.Timestamp': 'TIMESTAMP', | ||
'cds.Boolean': 'BOOLEAN', | ||
'cds.UUID': 'NVARCHAR', // changed to cds.String earlier | ||
// (TODO: do it later; TODO: why not CHAR or at least VARCHAR?) | ||
}, | ||
hana: { | ||
'cds.hana.SMALLDECIMAL': 'SMALLDECIMAL', | ||
'cds.DateTime': 'SECONDDATE', | ||
'cds.hana.ST_POINT': 'ST_POINT', | ||
'cds.hana.ST_GEOMETRY': 'ST_GEOMETRY', | ||
}, | ||
sqlite: { | ||
'cds.Binary': 'CHAR', | ||
'cds.hana.BINARY': 'CHAR', | ||
'cds.hana.SMALLDECIMAL': 'DECIMAL', | ||
}, | ||
}; | ||
@@ -63,0 +19,0 @@ /** |
{ | ||
"name": "@sap/cds-compiler", | ||
"version": "1.50.2", | ||
"version": "1.50.4", | ||
"description": "CDS (Core Data Services) compiler and backends", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
Sorry, the diff of this file is too big to display
3853859
74210