@sap/xsodata
Version:
Expose data from a HANA database as OData V2 service with help of .xsodata files.
49 lines (37 loc) • 2.4 kB
JavaScript
;
const utils = require('../utils/utils');
/**
* If the HANA version is greater or equal 2.00.030.00.1515544046
* a rollback automatically deletes tmp tables. So no manual cleanup required in that case.
*
* @param context Used to obtain the current db version
* @returns {boolean} true if the tmp table MUST not cleaned manually, false otherwise
*/
module.exports.shouldNotCleanTmpTables = (context) => {
if (!context.gModel) {
return false; // do cleanup
}
let version = context.gModel.getDbVersion();
if (!version) {
return false; // do cleanup
}
/*
fixed in release 1.00.122.16 ---> 1.00.122.16.1520578817 HANA 1.0 SPS 12; revision SPS number 2
fixed in release 2.00.012.04 ---> 2.00.012.04.1517989041 HANA 2.0 SPS 01; revision SPS number 2
// (utils.compareDBVersion(version, '2.00.030.00.1515544046', utils.SAME_3RD_SPS) >= 0) || not directly released
fixed in release 2.00.024.00 ---> 2.00.024.00.1520347815 HANA 2.0 SPS 02; revision SPS number 4
fixed in release 2.00.030.00 ---> 2.00.030.00.1522209842 HANA 2.0 SPS 03; revision SPS number 0
*/
if ((utils.compareDBVersion(version, '1.00.122.16.1520578817', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '1.00.123.00.0000000000', utils.SAME_2ND) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '1.01.000.00.0000000000', utils.SAME_1ST_HANA_REL) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '2.00.012.04.1517989041', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '2.00.024.00.1520347815', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '2.00.030.00.1522209842', utils.SAME_3RD_SPS) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '2.00.031.00.0000000000', utils.SAME_2ND) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '2.01.000.00.0000000000', utils.SAME_1ST_HANA_REL) === utils.VERSION_A_COVERS_VERSION_B) ||
(utils.compareDBVersion(version, '3.00.000.00.0000000000', utils.NO_FIX_PART) === utils.VERSION_A_COVERS_VERSION_B)) {
return true;// skip cleanup
}
return false; // do cleanup
};