Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
15f61c91
Commit
15f61c91
authored
4 years ago
by
Sebastian Listl
Browse files
Options
Downloads
Patches
Plain Diff
SqlMaskingUtils.prototype.concatWithSeparator fix for oracle
parent
ea54ab72
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/Sql_lib/process.js
+14
-9
14 additions, 9 deletions
process/Sql_lib/process.js
with
14 additions
and
9 deletions
process/Sql_lib/process.js
+
14
−
9
View file @
15f61c91
...
...
@@ -3653,7 +3653,7 @@ SqlMaskingUtils.prototype.concatWithSeparator = function (pFields, pSeparator, p
else
if
(
pSeparator
||
pSeparator
===
""
)
pSeparator
=
"
'
"
+
db
.
quote
(
pSeparator
,
this
.
alias
)
+
"
'
"
;
var
do
EmptyString
Check
=
tru
e
;
var
is
EmptyString
Null
=
fals
e
;
switch
(
this
.
dbType
)
{
...
...
@@ -3666,7 +3666,7 @@ SqlMaskingUtils.prototype.concatWithSeparator = function (pFields, pSeparator, p
case
db
.
DBTYPE_ORACLE10_CLUSTER
:
case
db
.
DBTYPE_ORACLE10_THIN
:
case
db
.
DBTYPE_ORACLE10_OCI
:
do
EmptyString
Check
=
fals
e
;
//empty strings are changed to DB-null-values internally in oracle
; by specifing JS-null we disable this check
is
EmptyString
Null
=
tru
e
;
//empty strings are changed to DB-null-values internally in oracle
break
;
case
db
.
DBTYPE_SQLSERVER2000
:
//MS SQL Server supports "concat_ws" (and ignoring null values) from version SQL Server 2017 and newer:
...
...
@@ -3675,7 +3675,7 @@ SqlMaskingUtils.prototype.concatWithSeparator = function (pFields, pSeparator, p
case
db
.
DBTYPE_DERBY10
:
break
;
default
:
throw
new
Error
(
translate
.
withArguments
(
"
${SQL_LIB_UNSUPPORTED_DBTYPE} function: %0
"
,
[
"
SqlMaskingUtils.prototype.concat
"
]));
throw
new
Error
(
translate
.
withArguments
(
"
${SQL_LIB_UNSUPPORTED_DBTYPE} function: %0
"
,
[
"
SqlMaskingUtils.prototype.concat
WithSeparator
"
]));
}
var
concatCharacter
=
this
.
getConcatSymbol
();
...
...
@@ -3686,10 +3686,13 @@ SqlMaskingUtils.prototype.concatWithSeparator = function (pFields, pSeparator, p
let
field
=
pFields
[
i
];
let
isLast
=
i
+
1
===
pFields
.
length
;
if
(
!
_isFixedValue
(
field
))
concatSql
+=
(
pAutoTrimFields
?
this
.
trim
(
this
.
isNull
(
field
))
:
this
.
isNull
(
field
));
else
if
(
_isFixedValue
(
field
))
concatSql
+=
(
pAutoTrimFields
?
"
'
"
+
field
.
slice
(
1
,
-
1
).
trim
()
+
"
'
"
:
field
);
else
{
let
stringField
=
isEmptyStringNull
?
field
:
this
.
isNull
(
field
);
concatSql
+=
(
pAutoTrimFields
?
this
.
trim
(
stringField
)
:
this
.
isNull
(
stringField
));
}
if
(
!
isLast
)
{
...
...
@@ -3702,10 +3705,12 @@ SqlMaskingUtils.prototype.concatWithSeparator = function (pFields, pSeparator, p
}
else
if
(
pSeparator
)
{
let
nextNotNullCondition
;
let
nextFieldTrimmed
=
pAutoTrimFields
?
this
.
trim
(
nextField
)
:
nextField
;
let
nextNotNullCondition
=
nextField
+
"
is not null
"
;
if
(
doEmptyStringCheck
||
pAutoTrimFields
)
nextNotNullCondition
+=
"
and
"
+
nextFieldTrimmed
+
"
!= ''
"
;
if
(
isEmptyStringNull
)
nextNotNullCondition
=
nextFieldTrimmed
+
"
is not null
"
;
else
nextNotNullCondition
=
nextField
+
"
is not null and
"
+
nextFieldTrimmed
+
"
!= ''
"
;
concatSql
+=
"
case when
"
+
nextNotNullCondition
+
"
then
"
+
pSeparator
+
"
else '' end
"
+
concatCharacter
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment