def select(table_name, uri=None, column_list=None, where=None, order_list=None, order='asc'): # parse value from uri _db = MySQLdb.connect(**split_uri(uri=uri)) # return common return common.select(_db, table_name, column_list=column_list, where=where, order_list=order_list, order=order)
def exist_table(table_name, uri=None): # parse value from uri _db = sqlite3.connect(_uri(uri=uri)) # prepare params _column_list = ['name'] _criteria_list = [ 'type = \'table\'', 'name = \'%s\'' % table_name, ] # count result _r = common.select(_db, 'sqlite_master', column_list=_column_list, where=common.and_(_criteria_list)) # return test return len(_r) != 0