Skip to content

Commit 0563967

Browse files
committed
Fix value escaping.
1 parent 0d4e20d commit 0563967

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

scripts/database/update_database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,14 @@ def get_add_sql(self, add_fields):
416416
val = add_fields[field]
417417
# Change how the value should look in the sql depending on it's type.
418418
if type(val) is str:
419-
value = "'" + val + "'"
419+
value = self.connector.connect().escape(val)
420420
elif type(val) is int:
421421
value = str(val)
422422
elif type(val) is bool:
423423
value = str(val).upper()
424424
# Add the necessary text.
425425
sql += field
426-
vals += self.connector.connect().escape(value)
426+
vals += value
427427
# If this is not the last key, add a comma.
428428
if i < len(key_list) - 1:
429429
sql += ", "
@@ -501,13 +501,13 @@ def get_update_sql(self, update_fields, test_id):
501501
field = key_list[i]
502502
val = update_fields[field]
503503
if type(val) is str:
504-
value = "'" + val + "'"
504+
value = self.connector.connect().escape(val)
505505
elif type(val) is int:
506506
value = str(val)
507507
elif type(val) is bool:
508508
value = str(val).upper()
509509
# Add the necessary text.
510-
sql += field + " = " + self.connector.connect().escape(value)
510+
sql += field + " = " + value
511511
# If this is not the last key, add a comma.
512512
if i < len(key_list) - 1:
513513
sql += ","

unit_tests/run_all_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def main():
2121
parser = make_parser()
2222
args = parser.parse_args()
2323

24-
# TODO: Should this be split more than this?
24+
# TODO: Should this be split more than it currently is?
2525
fast_test_list = [test_job_status.TestJobClass, test_job_status.TestJobStatus,
2626
test_parse_file.TestErrors, test_parse_file.TestParseJobID, test_parse_file.TestParseRGTInput,
2727
test_test_status.TestTestStatus,

0 commit comments

Comments
 (0)