self.src_cursor.execute("SELECT COUNT(*) FROM %s.Support" % self.src_db_name)
count = self.src_cursor.fetchone()[0]
+ self.stats = { 'total': count, 'imported': 0, 'ignored': 0}
for offset in range(0, count):
query = "INSERT INTO %s.media_collections (\n %s\n)\n" \
try:
self.target_cursor.execute(query)
+ self.stats['imported'] += 1
except IntegrityError, e:
(errno, errmsg) = e
if errno == DUP_ENTRY:
self.src_cursor.execute("SELECT Cote FROM %s.Support LIMIT %d, 1" % (self.src_db_name, offset))
id = self.src_cursor.fetchone()[0]
print "Collection %s not imported: %s" % (id, errmsg)
+ self.stats['ignored'] += 1
else:
raise e
"WHERE code = %s", (idrow[0], code))
if self.target_cursor.rowcount > 1:
raise Exception("Updated more than one row, this shouldn't happen..")
+ elif not self.target_cursor.rowcount:
+ print "Can't find migrated collection: %s" % code
else:
print "Can't find value '%s' in %s" % (value, enum_tables[i])