Projet

Général

Profil

0002-replace-more-explicit-quoting-by-quote-36503.patch

Benjamin Dauvergne, 30 septembre 2019 13:48

Télécharger (2,22 ko)

Voir les différences:

Subject: [PATCH 2/2] replace more explicit quoting by quote() (#36503)

 wcs_olap/feeder.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
wcs_olap/feeder.py
350 350

  
351 351
    def create_table(self, name, columns, inherits=None, comment=None):
352 352
        sql = 'CREATE TABLE %s' % quote(name)
353
        sql += '(' + ', '.join('"%s" %s' % (n, t) for n, t in columns) + ')'
353
        sql += '(' + ', '.join('%s %s' % (quote(n), t) for n, t in columns) + ')'
354 354
        if inherits:
355
            sql += ' INHERITS ("%s")' % inherits
355
            sql += ' INHERITS (%s)' % quote(inherits)
356 356
        self.ex(sql)
357 357
        if comment:
358
            self.ex('COMMENT ON TABLE "%s" IS %%s' % name, vars=(comment,))
358
            self.ex('COMMENT ON TABLE %s IS %%s' % quote(name), vars=(comment,))
359 359

  
360 360
    def prev_table_exists(self, name):
361 361
        query = """SELECT EXISTS (SELECT 1 FROM information_schema.tables
......
636 636
                else:
637 637
                    # open item field, from data sources...
638 638
                    self.create_labeled_table_serial(table_name, comment=comment)
639
                field_def = 'integer REFERENCES "%s" (id)' % table_name
639
                field_def = 'integer REFERENCES %s (id)' % quote(table_name)
640 640
            elif field.type == 'bool':
641 641
                field_def = 'boolean'
642 642
            elif field.type == 'string':
......
843 843
            self.logger.warning('no data')
844 844
            return
845 845
        self.ex('INSERT INTO {formdata_table} ({columns}) VALUES {values} RETURNING id',
846
                ctx=dict(columns=', '.join(['"%s"' % column for column in self.columns[1:]]), values=', '.join(values)))
846
                ctx=dict(columns=', '.join(['%s' % quote(column) for column in self.columns[1:]]), values=', '.join(values)))
847 847

  
848 848
        # insert generic evolutions
849 849
        generic_evolutions = []
850
-