logical sBase_SharedData :: InitKey (char *prop_path, char *extnames )
{
  PropertyHandle    *ph        = GetPropertyHandle();
  PropertyHandle    *kennung   = ph->GPH("kennung");
  PropertyHandle    *id        = ph->GPH(prop_path);
  char               idkey[16];
BEGINSEQ
  if ( kennung->IsEmpty() )
    kennung->SetValue(::GetEigentuemerKennung(),NO);
    
  if ( extnames && id->IsEmpty() )
  {
    id->SetValue(1,NO);  

    PropertyHandle    all(ph->GetObjectHandle(),extnames,PI_Read);
                                                    SDBCERR
    all.SetOrder("ik_kennung");
    memset(idkey,0,sizeof(idkey));
    *idkey = *kennung->GetString();
    if ( !all.LocateKey(Key(idkey)) )
      all.Position(-1);
    else
      all.Get(LAST_INSTANCE);
    if ( all.IsPositioned() )
      if ( *all.GPH("kennung") == *kennung )
        id->SetValue(all.GPH(prop_path)->GetInt()+1,NO);  
  }

RECOVER

ENDSEQ
  return(NO);
}
logical pc_SDB_Relationship :: Check (ErrorProtocol *protocol, PropertyHandle *str_ph, PropertyHandle *cs_ph, PropertyHandle *ext_ph, logical base_opt )
{
  PropertyHandle  *ddetype  = GPH("ddetype");
  PropertyHandle  *ddeinv   = GPH("ddeinv");
  PropertyHandle  *ddeext   = GPH("ddeext");
  PropertyHandle  *ddesecr  = GPH("ddesecr");
  PropertyHandle  *str_rshp = NULL;
  PropertyHandle  *str_base = NULL;
  PropertyHandle  *inv_ph   = NULL;
  TypeKey          tkey;
  logical          term         = NO;
BEGINSEQ
  protocol->SetErrorVariable(2,GPH("sys_ident")->GetString(),0);

  term = pc_SDB_Reference::Check(protocol,str_ph,cs_ph,base_opt);
  GetTypeKey(tkey);

  if ( CheckExtend(protocol,str_ph,ext_ph,NULL) )
    term = YES;
    
  if ( !GPH("ddeext")->IsEmpty() )
    SetProperty("owning","N",protocol,"required when base extent");
  
  if ( !ddeinv->IsEmpty() )
  {
    if ( !str_ph->Get(tkey.GetKey()) )
    {
      if ( !term )
        protocol->Write(140,0);
      ERROR
    } 
    if ( GPH("week_typed")->IsTrue() && *ddetype == *GetParentProperty()->GPH("sys_ident") )
                                                     LEAVESEQ
    str_rshp = str_ph->GPH("smcershp");
    str_base = str_ph->GPH("smcebase");
    
    if ( str_rshp->Get(*ddeinv) )
      inv_ph = str_rshp;
    else
    {
      if ( !str_base->Get(*ddeinv) )
      {
        protocol->Write(191,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      else if ( base_opt )
      {
        protocol->Write(195,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      inv_ph = str_base;
    }
예제 #3
0
logical sNotiz :: DBModify ( )
{
  PropertyHandle   *ph = GetPropertyHandle();

BEGINSEQ
  if ( UserState2() )                                LEAVESEQ
  if ( !ph->IsServer() )                             LEAVESEQ
  if ( !strcmp(ph->GetPropertyPath(),"NotizWiedervorlage") )   
                                                    LEAVESEQ
  PropertyHandle  old_wv(ph->GetStructDef(),"wiedervorlage",GetOldInstance());
  PropertyHandle  old_typ(ph->GetStructDef(),"typ",GetOldInstance());
  PropertyHandle *wiedervorlage = ph->GPH("wiedervorlage");
  PropertyHandle *typ = ph->GPH("typ");
  
  if ( *typ != old_typ )
    InitWV();

  if (  *wiedervorlage != old_wv &&
         (wiedervorlage->IsEmpty() || old_wv.IsEmpty()) ) 
    SetUserState1(YES);

ENDSEQ
  return(NO);
}