Esempio n. 1
0
    def delete(self):
        handle = StorageHelper(None, StorageType.Custom)
        handle.StartStorageServce()
        try:
            result = handle.GetDBHandle().delete(self.recordInstance)
            result = True
        except Exception as ex:
            result = False

        handle.StopStorageServce()

        # db.delete(doc)
        return result
Esempio n. 2
0
    def saveDoc(doc):
        handle = StorageHelper(None, StorageType.Custom)
        handle.StartStorageServce()
        try:
            result = handle.GetDBHandle().update(doc)
            result = True
        except Exception as ex:
            result = False

        handle.StopStorageServce()

        # db.delete(doc)
        return result
Esempio n. 3
0
    def save(self):
        handle = StorageHelper(None, StorageType.Custom)
        handle.StartStorageServce()

        # 先尝试更新
        try:
            result = handle.GetDBHandle().update(self.recordInstance)
            result = True
        except Exception as ex:
            result = False

        # 再尝试插入
        if not result:
            try:
                result = handle.GetDBHandle().insert(self.recordInstance)
                result = True
            except Exception as ex:
                result = False

        handle.StopStorageServce()

        # db.delete(doc)
        return result