转:http://www.cnblogs.com/dannyli/archive/2012/11/29/2794845.html

/************************************************************************************************

**  功能:根据实例ID,删除[K2ServerLog]中的流程实例数据(物理删除,不可恢复,操作前请备份)

**  作者:Danny,Li [xing.dong.li@163.com]

**  日期:2012-11-28

**  版本:v121128

************************************************************************************************

**  返回值        返回值描述

**  ------        --------------------------------------------------------------

**   

**

************************************************************************************************

**  修订日期        修订作者        修订描述

**  ----------    --------    -----------------------------------------------

**   

**   

************************************************************************************************/

USE [K2ServerLog]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE [dbo].[uSP_DeleteK2ServerLogProcInst]

    @procInstID INT        -- Process Instance ID

AS

SET NOCOUNT ON

BEGIN

    PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' starting'

   

    DECLARE @iError INT

    SELECT @iError = @@Error

   

    BEGIN TRANSACTION

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInst'

        DELETE _ActInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstAudit'

        DELETE _ActInstAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDest'

        DELETE _ActInstDest WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDest'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestData'

        DELETE _ActInstDestData WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestData'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestDataAudit'

        DELETE _ActInstDestDataAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestDataAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestXml'

        DELETE _ActInstDestXml WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestXml'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestXmlAudit'

        DELETE _ActInstDestXmlAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestXmlAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _EscInst'

        DELETE _EscInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _EscInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _EventInst'

        DELETE _EventInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _EventInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _IPC'

        DELETE _IPC WHERE SrcProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _IPC'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _LogBatch'

        DELETE _LogBatch WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _LogBatch'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _LineInst'

        DELETE _LineInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _LineInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInst'

        DELETE _ProcInst WHERE ID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstAudit'

        DELETE _ProcInstAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstData'

        DELETE _ProcInstData WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstData'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstDataAudit'

        DELETE _ProcInstDataAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstDataAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstXml'

        DELETE _ProcInstXml WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstXmlAudit'

        DELETE _ProcInstXmlAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstXmlAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError <> 0

    BEGIN

        ROLLBACK TRANSACTION

        PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' rollback'

    END

    ELSE

    BEGIN

        COMMIT TRANSACTION

        PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' commit'

    END

END

K2 Blackpearl中从数据库直接删除流程实例之K2ServerLog表的更多相关文章

  1. K2 Blackpearl中从数据库直接删除流程实例之K2Server表

    转:http://www.cnblogs.com/dannyli/archive/2012/11/29/2794772.html /********************************** ...

  2. EBS中OPM成本更新处理流程及对应的表结构、SLA表

    OPM成本更新流程:  1.跑实际成本处理  功能作用:计算成本  2.成本更新        功能作用:更新成本  3.OPM会计预处理程序->活动->提交流程 功能作用:是创建会计事件 ...

  3. 工作流学习——Activiti流程实例、任务管理四步曲 (zhuan)

    http://blog.csdn.net/zwk626542417/article/details/46646565 ***************************************** ...

  4. Activiti的流程实例及挂起激活(七)

    1.1什么是流程实例 参与者(可以是用户也可以是程序)按照流程定义内容发起一个流程,这就是一个流程实例.是动态的.流程定义和流程实例的图解: 1.2启动流程实例 流程定义部署在 activiti 后, ...

  5. Activiti 流程实例、任务、执行对象及相关的表

    一个流程中,流程实例只有一个,执行对象可以有多个(如果存在分支和聚合) SELECT * FROM activiti.act_ru_execution a;  #正在执行的执行对象表 SELECT * ...

  6. 将数据库中的表注册到K2服务中,并封装为Smart Object

    转:http://www.cnblogs.com/dannyli/archive/2011/08/15/2139550.html K2 blackpearl项目中经常需要将其他数据中的表注册到K2服务 ...

  7. 使用C#代码发起K2 Blackpearl流程

    转:http://www.cnblogs.com/dannyli/archive/2011/08/02/2125285.html 使用C#代码,发起一个K2的流程,其形式和链接SQL Server数据 ...

  8. K2 blackpearl 流程开发(二)

    转:http://blog.csdn.net/gxiangzi/article/details/8444590 本来想一篇文章把流程开发介绍完的,后来发现实在是太多了,只好分成两部分了.上一篇很简单的 ...

  9. K2 blackpearl 流程开发(一)

    转:http://blog.csdn.net/gxiangzi/article/details/8444060 郁闷,今天K2的license过期了,很多东西都没法用了,还得去找PM大大帮忙申请一个. ...

随机推荐

  1. sync or async connect redis in golang

    Head of head 在golang的整个生态里,redis client lib全部都使用多连接或者连接池.这是让人难以理解的,所以我和xiaofei一起写了一个同时支持同步和异步的redis ...

  2. #Eclipse web工程 部署 三种方式 3

    Eclipse web工程 部署 三种方式 3.热部署 在Eclipse中,实现 修改一个.java文件或者.jsp文件甚至是配置文件,不需要重启WEB服务器的前提下让修改生效,实现tomcat自动加 ...

  3. Linux常用命令 (转载自大牛笔记 --- http://www.weixuehao.com)

    Linux简介及Ubuntu安装 常见指令 系统管理命令 打包压缩相关命令 关机/重启机器 Linux管道 Linux软件包管理 vim使用 用户及用户组管理 文件权限管理 大牛笔记-www.weix ...

  4. php simple_html_dom

    这个真的很好用,如果用正则,就太麻烦了. 首先,下载simple_html_dom,用include_once就可以使用了. 可以直接定位,可以像个对象一样操作,很方便. $ret=file_get_ ...

  5. BZOJ3673 可持久化并查集 by zky 【主席树】

    BZOJ3673 可持久化并查集 by zky Description n个集合 m个操作 操作: 1 a b 合并a,b所在集合 2 k 回到第k次操作之后的状态(查询算作操作) 3 a b 询问a ...

  6. Serf 了解

    Introduction to Serf Welcome to the intro guide to Serf! This guide will show you what Serf is, expl ...

  7. bzoj 2039 [2009国家集训队]employ人员雇佣——二元关系

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2039 用最小割看.对于一组关系 i , j ,如果都选,收益 2*Ei,j,可以看作0,作为 ...

  8. xunsearch安装及环境检测(一)

    1.运行执行下载解压安装包wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2解压到指定目录 tar -xjf xu ...

  9. 关于vim搜索/替换功能的两条配置

    之前是直接照着这篇的配置的强大的vim配置文件 自己也只是对vim新建文件修改文件的哪个函数SetTitle()做了点修改,毕竟用vim只写C/C++和python.shell. 没想到今天在用vim ...

  10. TCP之二:TCP的三次握手与四次分手

    一.TCP是什么? 具体的关于TCP是什么,我不打算详细的说了:当你看到这篇文章时,我想你也知道TCP的概念了,想要更深入的了解TCP的工作,我们就继续.它只是一个超级麻烦的协议,而它又是互联网的基础 ...