def get_users(): fields = [ 'id', 'username', 'phone', 'role', 'cn_name', 'position', 'password', 'email' ] sql = '''SELECT %s FROM users; ''' % ','.join(fields) print sql values = select_all_result(sql) retdata = [dict(zip(fields, value)) for value in values] return retdata
def checkname(username): ret = 0 sql = '''select username from users; ''' usernames = select_all_result(sql) for x in range(len(usernames)): if "".join(tuple(usernames[x])) == username['username']: ret = 1 if ret == 1: return False else: return True
def get_user(name): sql = '''SELECT id,username,password,email FROM users WHERE username = '******';''' % name return select_all_result(sql)
def get_users(): sql = '''SELECT id,username,password,email,role FROM users ''' return select_all_result(sql)
def get_user(name): sql = '''SELECT * FROM users WHERE username = '******';''' % name return select_all_result(sql)
def get_users(): sql = '''SELECT * FROM users ''' return select_all_result(sql)
def get_assets(): sql = '''SELECT * FROM assets ''' return select_all_result(sql)
def assets_get(): sql = '''SELECT id,hostname,status,i_ip,e_ip,ram,hd,cpu,cpu_model,address,update_date FROM assets''' return select_all_result(sql)