def get_list(user_id, start_index, count): """ 返回用于分页的某个用户的所有项目; 如果count <= 0,则忽略 start_index,返回全部列表 """ if count <= 0: return Db.exec_list("select name, url from projects " "where userID = '%s'", user_id) else: return Db.exec_list("select name, url from projects " "where userID = '%s' limit %s,%s", (user_id, start_index, count))
def get_list(user_id, project_name): prj_id = Db.exec_one("select id from projects " "where name = '%s' and userID=(select id from user where name='%s')", (project_name, user_id)) if prj_id is None: raise Exception("Project does not exist for %s, %s" % (user_id, project_name)) return Db.exec_list("select name from services where projectID='%s'", prj_id)
def get(user_id): return Db.exec_list("select volume from info where name='%s'", user_id)
def get_machine_list(): return Db.exec_list("select ip from machine")