Changeset d00ca50 in osmose-frontend


Ignore:
Timestamp:
Jun 6, 2013 8:57:31 PM (6 years ago)
Author:
Jocelyn Jaubert <jocelyn.jaubert@…>
Branches:
master
Children:
20a3b99
Parents:
e6bd1c4
Message:

Insert new class when updating from a diff change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/update.py

    rfb925e6 rd00ca50  
    336336                sql  = u"INSERT INTO dynpoi_class (" + u','.join(keys) + u") " 
    337337                sql += u"VALUES (" + (u','.join(["%s"] * len(keys))) + u");" 
     338                execute_sql(self._dbcurs, sql, vals) 
    338339 
    339340            else: 
    340341                sql  = u"UPDATE dynpoi_class SET " + (u' = %s, '.join(keys)) + u" = %s " 
    341342                sql += u"WHERE source = %s AND class = %s;" 
    342                 vals += [self._source_id, self._class_id] 
    343  
    344             execute_sql(self._dbcurs, sql, vals) 
     343                ch_vals = vals + [self._source_id, self._class_id] 
     344                execute_sql(self._dbcurs, sql, ch_vals) 
     345 
     346                if self._dbcurs.rowcount == 0: 
     347                    sql  = u"INSERT INTO dynpoi_class (" + u','.join(keys) + u") " 
     348                    sql += u"VALUES (" + (u','.join(["%s"] * len(keys))) + u");" 
     349                    execute_sql(self._dbcurs, sql, vals) 
    345350 
    346351        elif name == u"fixes": 
Note: See TracChangeset for help on using the changeset viewer.