pangao1990 / PPX

基于 JavaScript 和 Python,一键生成 macOS、Windows 和 Linux 平台客户端应用

Home Page:https://blog.pangao.vip/docs-ppx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

数据库使用的是val还是value?是不是有些错误?

DreamSilverFox opened this issue · comments

    def getStorageVar(self, key):
        '''获取储存变量'''
        resVal = ''
        dbSession = DB.session()
        with dbSession.begin():
            stmt = select(PPXStorageVar.value).where(PPXStorageVar.key == key)
            result = dbSession.execute(stmt)
            result = result.one_or_none()
            if result is None:
                # 新建
                stmt = insert(PPXStorageVar).values(key=key)
                dbSession.execute(stmt)
            else:
                resVal = result[0]
        dbSession.close()
        return resVal

def setStorageVar(self, key, val):
        '''更新储存变量'''
        dbSession = DB.session()
        with dbSession.begin():
            stmt = update(PPXStorageVar).where(PPXStorageVar.key == key).values(value=val)
            dbSession.execute(stmt)
        dbSession.close()

这两个函数是value,但是数据库里的列是val?

已经在V4.2.1版本中修复了该问题,感谢指正!

image