Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
259df08b
Commit
259df08b
authored
Feb 22, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take into account empty values in selective update
parent
e43ce19e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
db.py
services/db.py
+13
-6
No files found.
services/db.py
View file @
259df08b
...
...
@@ -583,7 +583,8 @@ def update_scholar_cols(selected_safe_recs, reg_db, where_luid=None):
For modification of selected columns:
-> *update* row with the values that are present and are real columns
(if values are null or absent, they are left unchanged)
(if values are absent, they are left unchanged)
(if values are present and None, they are become NULL in db)
see also COLS variable and doc/table_specifications.md
"""
...
...
@@ -592,15 +593,21 @@ def update_scholar_cols(selected_safe_recs, reg_db, where_luid=None):
db_tgtcols
=
[]
db_qstrvals
=
[]
mlog
(
"INFO"
,
"DB selective update
%
s"
%
selected_safe_recs
)
for
colinfo
in
USER_COLS
:
colname
=
colinfo
[
0
]
val
=
selected_safe_recs
.
get
(
colname
,
None
)
# selective updating: ignoring None values
if
val
!=
None
and
colname
!=
'luid'
:
quotedstrval
=
"'"
+
str
(
val
)
+
"'"
# selective updating: only provided columns
if
colname
in
selected_safe_recs
and
colname
!=
'luid'
:
val
=
selected_safe_recs
[
colname
]
if
val
is
None
:
quotedstrval
=
"NULL"
else
:
quotedstrval
=
"'"
+
str
(
val
)
+
"'"
mlog
(
"DEBUG"
,
"DB selective update
%
s
"
%
quotedstrval
)
"DB selective update
%
s
%
s"
%
(
colname
,
quotedstrval
)
)
db_tgtcols
.
append
(
colname
)
db_qstrvals
.
append
(
quotedstrval
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment