Example #1
0
def creatUserInfo(username,password):
    """创建
    """
    sql = "insert into tb_register(username,`password`) values ('%s','%s')"%(username,password)
    count = dbpool.executeSQL(sql)
    if(count >= 1):
        return True
    return False
Example #2
0
def InsertUserCharacter(userId,characterId):
    """加入角色用户关系"""
    sql = "update tb_register set characterId = %d where `id` = %d"%( characterId ,userId)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    else:
        return False
Example #3
0
def creatUserInfo(username, password):
    """创建
    """
    sql = "insert into tb_register(username,`password`) values ('%s','%s')" % (
        username, password)
    count = dbpool.executeSQL(sql)
    if (count >= 1):
        return True
    return False
Example #4
0
def creatUserCharacter(uid):
    """为新用户建立空的用户角色关系记录
    @param id: int 用户id
    """
    sql = "insert into `tb_user_character` (`id`) values(%d)" %uid
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    else:
        return False
Example #5
0
def InsertUserCharacter(userId, characterId):
    """加入角色用户关系"""
    sql = "update tb_register set characterId = %d where `id` = %d" % (
        characterId, userId)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    else:
        return False
Example #6
0
def creatUserCharacter(uid):
    """为新用户建立空的用户角色关系记录
    @param id: int 用户id
    """
    sql = "insert into `tb_user_character` (`id`) values(%d)" % uid
    count = dbpool.executeSQL(sql)
    if count >= 1:
        return True
    else:
        return False
Example #7
0
def updateUserCharacter(userId ,fieldname ,characterId):
    """更新用户角色关系表
    @param userId: 用户的id
    @param fieldname: str 用户角色关系表中的字段名,表示用户的第几个角色
    @param characterId: int 角色的id
    """
    sql = "update `tb_user_character` set %s = %d where id = %d"%(fieldname ,characterId ,userId)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    else:
        return False
Example #8
0
def updateUserCharacter(userId, fieldname, characterId):
    """更新用户角色关系表
    @param userId: 用户的id
    @param fieldname: str 用户角色关系表中的字段名,表示用户的第几个角色
    @param characterId: int 角色的id
    """
    sql = "update `tb_user_character` set %s = %d where id = %d" % (
        fieldname, characterId, userId)
    count = dbpool.executeSQL(sql)

    if count >= 1:
        return True
    else:
        return False