'Test whether CREATE TABLE needs ENGINE=InnoDB for rollback.'

def _test_transaction(sql):

    sql.drop_table_if_exists(('%stest_1' % sql.prefix))
    try:
        sql.ddl(('CREATE    TABLE    %stest_1    (a    NUMERIC(12))' % sql.prefix))
        sql.sql(('INSERT    INTO    %stest_1    (a)    VALUES    (4)' % sql.prefix))
        sql.commit()
        sql.sql(('INSERT    INTO    %stest_1    (a)    VALUES    (5)' % sql.prefix))
        sql.rollback()
        data = [int(row[0]) for row in sql.selectall(('SELECT    a    FROM    %stest_1' % sql.prefix))]
        return (data == [4])
    except sql.module.DatabaseError as e:
        sql.rollback()
        return False
    except Exception as e:
        sql.rollback()
        return False
    finally:
        sql.drop_table_if_exists(('%stest_1' % sql.prefix))
