示例#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_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