예제 #1
0
    def add_insert_event(self, moc):
        """
        Method: _add_event
        Description: 追加数据同步Event
        Parameter:
            moc: MOC对象
        Return:
        Others:
        """
        if moc.__IMC_SYNC_PRIORITY__ == mit.IMC_SYNC_NOT_SYNC:
            return

        table = moc.get_moc_name()
        priority = moc.__IMC_SYNC_PRIORITY__
        operation = DBSyncOperationType.INSERT
        data = DBSyncUtil.serialize(moc.to_db_record())
        self._add_event(table, DBSyncType.INCREMENTAL, priority, operation, data, None)
예제 #2
0
    def add_update_event(self, moc):
        """
        Method: add_update_event
        Description: 更新数据同步Event
        Parameter:
            moc: MOC对象
        Return:
        Others:
        """
        if moc.__IMC_SYNC_PRIORITY__ == mit.IMC_SYNC_NOT_SYNC:
            return

        table = moc.get_moc_name()
        priority = moc.__IMC_SYNC_PRIORITY__
        operation = DBSyncOperationType.UPDATE
        data = DBSyncUtil.serialize(moc.to_db_record())
        condition = ("\"moid\" = '%s'" % moc.get_moid().replace("'", "''"))
        self._add_event(table, DBSyncType.INCREMENTAL, priority, operation, data, condition)