Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const TABLE_TYPE = {

const INLINE_COMMENT = '--';

const PERSENT = '__PERCENT__';

const CONSTRAINT_POSTFIX = {
primaryKey: 'pk',
foreignKey: 'fk',
Expand All @@ -28,6 +26,5 @@ module.exports = {
ERROR_MESSAGE,
TABLE_TYPE,
INLINE_COMMENT,
PERSENT,
CONSTRAINT_POSTFIX,
};
Empty file modified shared/Db2Client/build.sh
100644 → 100755
Empty file.
Binary file modified shared/addons/Db2Client.jar
Binary file not shown.
20 changes: 8 additions & 12 deletions shared/helpers/queryHelper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { TABLE_TYPE, PERSENT } = require('../../constants/constants');
const { TABLE_TYPE } = require('../../constants/constants');

/**
* @param {{ query: string }}
Expand All @@ -11,18 +11,14 @@ const cleanUpQuery = ({ query = '' }) => query.replaceAll(/\s+/g, ' ');
* @returns {string}
*/
const getNonSystemSchemaWhereClause = ({ query, schemaNameKeyword }) => {
// On Windows (cmd.exe), environment variables can be referenced using syntax like %PATH%.
// When a command contains such patterns, cmd.exe automatically replaces them with the corresponding environment variable values.
// To prevent this automatic substitution, a placeholder string (PERSENT) is used here instead,
// which will later be replaced with the % symbol inside the Db2Client Java client.
const whereClause = `
WHERE ${schemaNameKeyword} NOT LIKE 'SYS${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}SYSCAT${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}SYSIBM${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}SYSSTAT${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}SYSTOOLS${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}NULLID${PERSENT}'
AND ${schemaNameKeyword} NOT LIKE '${PERSENT}SQLJ${PERSENT}';`;
WHERE ${schemaNameKeyword} NOT LIKE 'SYS%'
AND ${schemaNameKeyword} NOT LIKE '%SYSCAT%'
AND ${schemaNameKeyword} NOT LIKE '%SYSIBM%'
AND ${schemaNameKeyword} NOT LIKE '%SYSSTAT%'
AND ${schemaNameKeyword} NOT LIKE '%SYSTOOLS%'
AND ${schemaNameKeyword} NOT LIKE '%NULLID%'
AND ${schemaNameKeyword} NOT LIKE '%SQLJ%';`;

const clause = query.includes('WHERE') ? whereClause.replace('WHERE', 'AND') : whereClause;

Expand Down