Beispiel #1
0
def batch_insert(conn, cur):
    users = []
    u1 = User('a', 11, 99)
    u2 = User('b', 12, 100)
    users.append(u1)
    users.append(u2)
    success = User.batch_insert(conn, cur, users)
    print('成功插入' + s(success) + '条用户数据')
Beispiel #2
0
def get_single(cur, id):
    user = User.get_by_id(cur, id)
    return user
Beispiel #3
0
def query(cur):
    user_list = User.get_all(cur)

    for user in user_list:
        user.info()
Beispiel #4
0
def insert(conn, cur):
    user_1 = User('煤球', 33)
    stat = user_1.save_user(conn, cur)
    print('插入成功' if stat > 0 else '插入失败')