4.1.0或4.1.1升級至4.2說明

本次升級為(wèi)知識包添加了編碼屬性,系統數據庫需要添加這個字段,并确保值非空。新(xīn)版本獲取知識包可(kě)以通過code獲取:

KnowledgeService service=(KnowledgeService)Utils.getApplicationContext().getBean(KnowledgeService.BEAN_ID);
//通過KnowledgeService接口獲取指定編碼的知識包"JWFP_FP"
KnowledgePackage knowledgePackage=service.getKnowledge("JWFP_FP");

你可(kě)以通過如下的腳步自動完成這個工(gōng)作(zuò):

mysql,hsql

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=UUID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

oracle

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=SYS_GUID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

sqlserver, sybase

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=NEWID() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

postgresql

首先确保postgresql安(ān)裝(zhuāng)了uuid函數 如果是pgcrypto 擴展函數,則代碼如下:

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=gen_random_uuid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

如果是uuid-ossp 擴展函數,則代碼如下:

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=uuid_generate_v1() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

informix

要有(yǒu)一個自定義的uuid生成函數,例如:

create function sys_guid() returning varchar(36);
    define guid varchar(50);

    let guid =replace(cast(dbms_lob_new_clob(to_char(sysdate,'%H:%M:%S.%FS')) as lvarchar(36)),'0000','');
    return guid;
end function;

然後調整urule的表:

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=sys_guid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

informix

要有(yǒu)一個自定義的uuid生成函數,例如:

--uuid()
CREATE FUNCTION uuid() RETURNS VARCHAR(50)
LANGUAGE SQL
BEGIN
   DECLARE RESULT VARCHAR(50) DEFAULT '';
   DECLARE a VARCHAR(18) DEFAULT '';
   DECLARE b VARCHAR(18) DEFAULT '';
 SET a = substr(hex(DECIMAL(TO_CHAR(CURRENT_TIMESTAMP,'yyyyMMddHH24miss'))),1,16);
 SET b = substr(hex(MICROSECOND(CURRENT_TIMESTAMP)* RAND()* RAND()* 1000000),1,16);
 SET RESULT = a || '-' || b ;
 RETURN RESULT;
 END

然後調整urule的表:

alter table URULE_PACKET add column CODE_ VARCHAR(255);
UPDATE URULE_PACKET SET CODE_=uuid() WHERE CODE_ is null;
CREATE UNIQUE INDEX URULE_PACKET_CODE_INDEX ON URULE_PACKET(CODE_);

results matching ""

    No results matching ""