Пример #1
0
def table_column_diff(cur1, cur2):
    names = shared_tables(cur1, cur2)
    diffs = []
    for n in names:
        col1 = utils.sqlite_master_table_def(cur1, n)
        col2 = utils.sqlite_master_table_def(cur2, n)
        if col1 != col2:
            diffs.append( (col1, col2) )
    if len(diffs) > 0:
        return diffs
    else:
        return False
Пример #2
0
 def test_sqlite_master_table_def(self):
     self.assertEquals(utils.table_names(self.db.cursor()),
                       set([u'bonds', u'stocks']))
     self.assertEquals(utils.sqlite_master_table_def(self.db.cursor(), "stocks"),
                       (u'table', u'stocks', u'stocks', 2, u'CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)'))
     self.assertEquals(utils.table_definition(self.db.cursor(), "stocks"),
                       ((u'table', u'stocks', u'stocks', 2, u'CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)'), [(u'index', u'idx_stock_symbol', u'stocks', 4, u'CREATE INDEX idx_stock_symbol ON stocks (symbol)')]))