Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
basic
Commits
38edd4fc
Commit
38edd4fc
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
use Prepared Statement in Data_alias.CONTRACT.query
parent
30f55108
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aliasDefinition/Data_alias/indexsearchgroups/contract/query.js
+18
-18
18 additions, 18 deletions
...Definition/Data_alias/indexsearchgroups/contract/query.js
with
18 additions
and
18 deletions
aliasDefinition/Data_alias/indexsearchgroups/contract/query.js
+
18
−
18
View file @
38edd4fc
import
(
"
system.translate
"
);
import
(
"
system.result
"
);
import
(
"
system.vars
"
);
import
(
"
system.calendars
"
);
import
(
"
system.db
"
);
import
(
"
system.vars
"
);
import
(
"
system.translate
"
);
import
(
"
Keyword_lib
"
);
import
(
"
Sql_lib
"
);
import
(
"
KeywordRegistry_basic
"
);
var
sqlQuery
,
sqlHelper
,
queryCondition
,
affectedIds
;
queryCondition
=
""
;
var
sqlHelper
=
new
SqlMaskingUtils
();
var
affectedIds
;
var
sqlQuery
=
newSelect
(
"
CONTRACTID,
"
+
sqlHelper
.
concat
([
"
CONTRACTCODE
"
,
KeywordUtils
.
getResolvedTitleSqlPart
(
$KeywordRegistry
.
contractStatus
(),
"
CONTRACTSTATUS
"
)],
"
|
"
)
+
"
as TITLECOLUMN,
"
+
sqlHelper
.
concat
([
"
ORGANISATION.NAME
"
,
"
'|
"
+
translate
.
text
(
"
Type of contract
"
)
+
"
:'
"
,
KeywordUtils
.
getResolvedTitleSqlPart
(
$KeywordRegistry
.
contractType
(),
"
CONTRACTTYPE
"
)])
+
"
as DESCCOLUMN, CONTRACTCODE, ORGANISATION.NAME, CUSTOMERCODE
"
)
.
from
(
"
CONTRACT
"
)
.
join
(
"
CONTACT
"
,
"
CONTRACT.CONTACT_ID = CONTACTID
"
)
.
join
(
"
ORGANISATION
"
,
"
ORGANISATIONID = CONTACT.ORGANISATION_ID
"
)
.
orderBy
(
"
CONTRACTCODE
"
)
if
(
vars
.
exists
(
"
$local.idvalue
"
))
{
affectedIds
=
vars
.
get
(
"
$local.idvalue
"
);
queryCondition
=
"
where CONTRACTID in ('
"
+
affectedIds
.
map
(
function
(
v
){
return
db
.
quote
(
v
);}).
join
(
"
', '
"
)
+
"
')
"
;
//TODO: refactor this for incremental indexer (injections?)
sqlQuery
.
where
(
"
CONTRACT.CONTRACTID
"
,
affectedIds
,
SqlBuilder
.
IN
())
}
sqlHelper
=
new
SqlMaskingUtils
();
sqlQuery
=
"
select CONTRACTID,
"
+
sqlHelper
.
concat
([
"
CONTRACTCODE
"
,
KeywordUtils
.
getResolvedTitleSqlPart
(
$KeywordRegistry
.
contractStatus
(),
"
CONTRACTSTATUS
"
)],
"
|
"
)
+
"
as TITLECOLUMN,
"
+
sqlHelper
.
concat
([
"
ORGANISATION.NAME
"
,
"
'|
"
+
translate
.
text
(
"
Type of contract
"
)
+
"
:'
"
,
KeywordUtils
.
getResolvedTitleSqlPart
(
$KeywordRegistry
.
contractType
(),
"
CONTRACTTYPE
"
)])
+
"
as DESCCOLUMN, CONTRACTCODE, ORGANISATION.NAME, CUSTOMERCODE
"
+
"
from CONTRACT
"
+
"
join CONTACT on CONTRACT.CONTACT_ID = CONTACTID
"
+
"
join ORGANISATION on ORGANISATIONID = CONTACT.ORGANISATION_ID
"
+
queryCondition
+
"
order by CONTRACTCODE
"
;
result
.
string
(
sqlQuery
);
\ No newline at end of file
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