Unverified Commit 3ce92962 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

fix string escape


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 7a191e51
Pipeline #19183 passed with stages
in 2 minutes and 1 second
......@@ -2,8 +2,8 @@ import logging
import numbers
import os
import time
import MySQLdb
import MySQLdb
import mysql.connector as mariadb
......@@ -45,9 +45,9 @@ class Indexer:
"""
db_fields = [dbField for dbField in fields
if dbField in record and record[dbField] is not None]
db_values = [MySQLdb.escape_string(str(record[db_field]))
db_values = [str(record[db_field])
if isinstance(record[db_field], numbers.Number)
else "'{}'".format(record[db_field])
else "'{}'".format(MySQLdb.escape_string(record[db_field]))
for db_field in db_fields]
key_value = \
", ".join([k + "=" + v for (k, v) in zip(db_fields, db_values) if k != 'sig'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment