You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@sap/cds-compiler

Package Overview
Dependencies
3
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.50.2 to 1.50.4

6

CHANGELOG.md

@@ -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 @@

52

lib/render/renderUtil.js

@@ -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,
}

46

lib/render/toSql.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc