Пример #1
0
def insert_tagInfo(tag):
    tagInfo = session.query(TagInfo).filter_by(name=tag).first()
    if not tagInfo:
        tagInfo = TagInfo()
        tagInfo.name = tag
        session.add(tagInfo)
        session.commit()
    return tagInfo
Пример #2
0
def insert_gameInfo2TagInfo_not_exists(tagId, gameId):
    gameInfo2TagInfo = session.query(GameInfo2TagInfo).filter_by(tagId=tagId, gameId=gameId).first()
    if not gameInfo2TagInfo:
        gameInfo2TagInfo = GameInfo2TagInfo()
        gameInfo2TagInfo.tagId = tagId
        gameInfo2TagInfo.gameId = gameId
        session.add(gameInfo2TagInfo)
        session.commit()
    return gameInfo2TagInfo
Пример #3
0
def insert_gameInfo2CategoryInfo(categoryId, gameId):
    gameInfo2CategoryInfo = session.query(GameInfo2CategoryInfo) \
        .filter_by(categoryId=categoryId, gameId=gameId).first()
    if not gameInfo2CategoryInfo:
        gameInfo2CategoryInfo = GameInfo2CategoryInfo()
        gameInfo2CategoryInfo.categoryId = categoryId
        gameInfo2CategoryInfo.gameId = gameId
        session.add(gameInfo2CategoryInfo)
        session.commit()
    return gameInfo2CategoryInfo
Пример #4
0
def insert_categoryInfo(id, name):
    category = session.query(CategoryInfo) \
        .filter_by(id=id).first()
    if not category:
        category = CategoryInfo()
        category.id = id
        category.name = name
        session.add(category)
        session.commit()
    return category
Пример #5
0
def insert_GameInfo2VersionInfo_not_exists(versionId, gameId):
    gameInfo2VersionInfo = session.query(GameInfo2VersionInfo).filter_by(
        versionId=versionId, gameId=gameId).first()
    if not gameInfo2VersionInfo:
        gameInfo2VersionInfo = GameInfo2VersionInfo()
        gameInfo2VersionInfo.versionId = versionId
        gameInfo2VersionInfo.gameId = gameId
        session.add(gameInfo2VersionInfo)
        session.commit()
    return gameInfo2VersionInfo
Пример #6
0
def insert_gameInfo(id, icon, name, info):
    gameInfo = session.query(GameInfo).filter_by(id=id).first()
    if not gameInfo:
        gameInfo = GameInfo()
        gameInfo.id = id
        gameInfo.icon = icon
        gameInfo.name = name
        gameInfo.info = info
        md5_util = md5()
        md5_util.update(gameInfo.name.encode())
        gameInfo.md5 = md5_util.hexdigest()
        session.add(gameInfo)
    return gameInfo
Пример #7
0
def insert_versionInfo(url, total_size, version_name, versionCode,
                       orientation):
    versionInfo = session.query(VersionInfo) \
        .filter_by(url=url).first()
    if not versionInfo:
        versionInfo = VersionInfo()
        versionInfo.url = url
        versionInfo.total_size = total_size
        versionInfo.version_name = version_name
        versionInfo.version_code = versionCode
        versionInfo.orientation = orientation
        session.add(versionInfo)
        session.commit()
    return versionInfo
Пример #8
0
def queryGameInfo(id):
    return session.query(GameInfo).filter_by(id=id).first()
Пример #9
0
def queryGameInfoList():
    return session.query(GameInfo)
Пример #10
0
def query_versionInfo():
    return session.query(VersionInfo).all()
Пример #11
0
def query_GameInfo2VersionInfo(versionId):
    return session.query(GameInfo2VersionInfo).filter_by(
        versionId=versionId).first()