0

我有这种格式的全局数据:

 ^kza("mltab","TAB","Dta",1,1)  =   3341
 ^kza("mltab","TAB","Dta",1,2)  =   "First Name"
 ^kza("mltab","TAB","Dta",1,3)  =   "type1"
 ^kza("mltab","TAB","Dta",1,4)  =   7400.11
 ^kza("mltab","TAB","Dta",2,1)  =   3614
 ^kza("mltab","TAB","Dta",2,2)  =   "Second Name"
 ^kza("mltab","TAB","Dta",2,3)  =   "type2"
 ^kza("mltab","TAB","Dta",2,4)  =   7600.11

我的对象类如下所示:

Class Kza.Employees Extends %Persistent [ StorageStrategy = EmpStorage ]
{

    Property num As %Integer; //unique identifier
    Property id As %Integer;
    Property num As %Integer;
    Property name As %String;
    Property type As %String;
    Property pay As %Double;
    Index NewIndex1 On id [ IdKey, PrimaryKey, Unique ];

    <Storage name="EmpStorage">
     <ExtentSize>100000</ExtentSize>
     <SequenceNumber>8</SequenceNumber>
     <SQLMap name="MasterMap">
       <ConditionalWithHostVars></ConditionalWithHostVars>
       <Data name="num">
         <Node>1</Node>
       </Data>
       <Data name="name">
         <Node>2</Node>
       </Data>
       <Data name="pay">
         <Node>4</Node>
       </Data>
       <Data name="type">
         <Node>3</Node>
       </Data>
       <Global>^kza</Global>
       <RowIdSpec name="1">
         <Expression>{L1}</Expression>
         <Field>id</Field>
       </RowIdSpec>
       <Subscript name="1">
         <Expression>"mltab"</Expression>
       </Subscript>
       <Subscript name="2">
         <Expression>"TAB"</Expression>
       </Subscript>
       <Subscript name="3">
         <Expression>"Dta"</Expression>
      </Subscript>
      <Subscript name="4">
         <Expression>{id}</Expression>
      </Subscript>
      <Type>data</Type>
    </SQLMap>
  <StreamLocation>^Kza.EmployeesS</StreamLocation>
  <Type>%CacheSQLStorage</Type>
</Storage>
}

问题是,如果我这样做

insert into Kza.Employees(id, num, name, pay, type) VALUES(132, 3214, 'Name Second', 89000, 'type5')

结果是:

^kza("mltab","TAB","Dta",1) =   ""
^kza("mltab","TAB","Dta",1,1)   =   3214
^kza("mltab","TAB","Dta",1,2)   =   "Name Second"
^kza("mltab","TAB","Dta",1,3)   =   'type 5'
^kza("mltab","TAB","Dta",1,4)   =   89000

但我不需要保存第一行,所以如何消除保存这个节点:

^kza("mltab","TAB","Dta",1) = ""

4

1 回答 1

2

尝试将 num、name、type 或 pay 属性设为必需(如果有任何不能为 null)。
Caché 定义了 ^kza("mltab","TAB","Dta",1) 节点,因为如果其他 4 个字段都为空,则存在 ^kza("mltab","TAB","Dta", 1) 节点定义了行的存在。换句话说,如果 num、name、type 或 pay 都为 null 并且 ^kza("mltab","TAB","Dta",1) 未定义,则不会定义该行。

于 2015-04-06T16:57:11.687 回答