Ejemplo n.º 1
0
uint16 CACObject :: GetVersion (dttm timestamp )
{
  uint16      version = 0;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(timestamp);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_GetVersion_ci) )
        version = Get_rec_result()[0].GetUShort(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(version);
  
#else             // server version
  
  version = ((SC_DBObject *)cso_ptr)->GetVersion(
                  (*parms)[0].GetTimestamp(connection->get_conversion())
            );
   
  result->Fill(version);

  return(NO);

#endif

}
Ejemplo n.º 2
0
int32 CACObject :: VersionCount ( )
{
  int32        count = 0;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill();
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_VersionCount_ci) )
        count = Get_rec_result()[0].GetLong(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(count);
  
#else             // server version
  
  count =  ((SC_DBObject *)cso_ptr)->VersionCount();
   
  result->Fill(count);

  return(NO);

#endif

}
Ejemplo n.º 3
0
HRESULT CNktDvTransportEngine::ConnectAgent(__in DWORD dwPid, __in DWORD dwTimeout)
{
  CNktDvShutdownAutoLock cSdLock(&cShutdownMtx);
  CNktDvAutoCancellableFastMutex cLock(this, &cShutdownMtx);
  CConnection *lpConn;
  HRESULT hRes;

  if (cLock.IsLockHeld() == FALSE || cShutdownMtx.IsShuttingDown() != FALSE)
    return NKT_DVERR_Cancelled;
  if (cShutdownMtx.IsSystemActive() == FALSE)
    return E_FAIL; //not initialized
  if (dwPid == 0 || dwPid == dwMePid)
    return E_INVALIDARG;
  //check if connection already exists
  {
    CConnectionAutoRef cConnAutoRef(lpConn = FindConnectionAndAddRef(dwPid), FALSE);

    if (lpConn != NULL)
      return NKT_DVERR_AlreadyExists;
  }
  //----
  lpConn = NKT_MEMMGR_NEW CConnection(this, dwPid);
  if (lpConn == NULL)
    return E_OUTOFMEMORY;
  //create pipe
  hRes = lpConn->Initialize(hIOCP, dwTimeout);
  if (FAILED(hRes))
  {
    lpConn->Release();
    return hRes;
  }
  //add to connection list
  cConnList.PushTail(lpConn);
  return S_OK;
}
Ejemplo n.º 4
0
logical CACObject :: ChangeTimeStamp (uint16 version_nr, dttm timestamp )
{
  logical   term = YES;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(version_nr,timestamp);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_ChangeTimeStamp_ci) )
        term = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(term);
  
#else             // server version
  
  term =  ((SC_DBObject *)cso_ptr)->ChangeTimeStamp(
                  (*parms)[0].GetUShort(connection->get_conversion()),
                  (*parms)[1].GetTimestamp(connection->get_conversion())
          );
   
  result->Fill(term);

  return(NO);

#endif

}
Ejemplo n.º 5
0
int16 CACObject :: GetModCount (EB_Number entnr )
{
  int16        modcount = UNDEF;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill((int32)entnr.get_ebsnum());
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_GetModCount_ci) )
        modcount = Get_rec_result()[0].GetShort(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(modcount);
  
#else             // server version
  
  modcount = ((SC_DBObject *)cso_ptr)->GetExtInstModCount(
                  (*parms)[0].GetLong(connection->get_conversion())
               );
   
  result->Fill(modcount);

  return(NO);

#endif

}
Ejemplo n.º 6
0
char *CACObject :: GetExtent (int32 indx0 )
{
  char       *extentnames = NULL;
  char       *results     = NULL;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(indx0);
    
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_GetExtent_ci) )
        if ( extentnames = (char *)Get_rec_result()[0].GetString() )
          results = set_result_string(extentnames,RET_STR_LEN);
      UnlockSendParms();
    }
  }
  return(results);
  
#else             // server version
  
  extentnames = ((SC_DBObject *)cso_ptr)->GetExtent(
                  (*parms)[0].GetLong(connection->get_conversion())
               );
   
  result->Fill(extentnames);

  return(NO);

#endif

}
Ejemplo n.º 7
0
logical CACObject :: ExtentExist (char *extnames )
{
  logical                 cond = NO;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(extnames);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_ExtentExist_ci) )
        cond = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(cond);
  
#else             // server version
  
  cond =  ((SC_DBObject *)cso_ptr)->ExtentExist(
                  (*parms)[0].GetString()
          );
   
  result->Fill(cond);

  return(NO);

#endif

}
Ejemplo n.º 8
0
PIACC CACObject :: GetAccess ( )
{
  PIACC       accmode = PI_Read;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill();
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_GetAccess_ci) )
        accmode = (PIACC)Get_rec_result()[0].GetLong(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(accmode);
  
#else             // server version
  
  accmode = ((SC_DBObject *)cso_ptr)->GetAccess();
   
  result->Fill((int32)accmode);

  return(NO);

#endif

}
Ejemplo n.º 9
0
logical CACObject :: DeleteExtentRef (char *extnames )
{
  logical                 term = YES;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(extnames);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_DeleteExtentRef_ci) )
        term = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(term);
  
#else             // server version
  
  term =  ((SC_DBObject *)cso_ptr)->DeleteExtent(
                  (*parms)[0].GetString()
          );
   
  result->Fill(term);

  return(NO);

#endif
  return(term);
}
Ejemplo n.º 10
0
logical CACObject :: SetUserDefinedIdentity (logical identity_opt )
{
  logical     userdefined_id = NO;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(identity_opt);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_SetUserDefinedIdentity_ci) )
        userdefined_id = Get_rec_result()[0].GetUChar();
      ACObject::SetUserDefinedIdentity(userdefined_id);
      UnlockSendParms();
    }
  }
  return(userdefined_id);
  
#else             // server version
  
  userdefined_id = ((SC_DBObject *)cso_ptr)->SetOverload(
                     (*parms)[0].GetUChar()
                 );
   
  result->Fill(userdefined_id);

  return(NO);

#endif

}
Ejemplo n.º 11
0
int16 CACObject :: GetTALevel ( )
{
  int16       talevel = 0;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill();
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_GetTALevel_ci) )
        talevel = Get_rec_result()[0].GetShort(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(talevel);
  
#else             // server version
  
  talevel = ((SC_DBObject *)cso_ptr)->GetTransactionLevel();
   
  result->Fill(talevel);

  return(NO);

#endif

}
Ejemplo n.º 12
0
INTERVAL(dttm) CACObject :: VersionIntervall (uint16 version_nr )
{
  INTERVAL(dttm)   timeint;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(version_nr);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_VersionIntervall_ci) )
      {
        timeint.get_low()  = Get_rec_result()[0].GetTimestamp(csconnection->get_conversion());
        timeint.get_high() = Get_rec_result()[1].GetTimestamp(csconnection->get_conversion());
      }
      UnlockSendParms();
    }
  }
  return(timeint);
  
#else             // server version
  
  timeint = ((SC_DBObject *)cso_ptr)->VersionIntervall(
                  (*parms)[1].GetUShort(connection->get_conversion())
            );
   
  result->Fill(timeint.get_low(),timeint.get_high());

  return(NO);

#endif

}
Ejemplo n.º 13
0
logical CACObject :: UpdateTimestamp (logical timestamp_enabled )
{
  logical    oldmode = YES;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(timestamp_enabled);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_UpdateTimestamp_ci) )
        oldmode = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(oldmode);
  
#else             // server version
  
  oldmode =  ((SC_DBObject *)cso_ptr)->UpdateTimestamp(
                  (*parms)[0].GetUChar()
          );
   
  result->Fill(oldmode);

  return(NO);

#endif
  return(timestamp_enabled);
}
Ejemplo n.º 14
0
logical CACObject :: StopTA (int16 talevel, logical error_case_w )
{
  logical   term = YES;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(talevel,error_case_w);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_StopTA_ci) )
        term = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(term);
  
#else             // server version
  
  logical error_case = (*parms)[1].GetUChar();

  term =  error_case
          ? ((SC_DBObject *)cso_ptr)->RollBack((*parms)[0].GetShort(connection->get_conversion()))
          : ((SC_DBObject *)cso_ptr)->CommitTransaction((*parms)[0].GetShort(connection->get_conversion()));
   
  result->Fill(term);

  return(NO);

#endif

}
Ejemplo n.º 15
0
int16 CACObject :: StartTA (logical ext_TA, int16 w_maxnum )
{
  int16       talevel = 0;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(ext_TA,w_maxnum);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_StartTA_ci) )
        talevel = Get_rec_result()[0].GetShort(csconnection->get_conversion());
      UnlockSendParms();
    }
  }
  return(talevel);
  
#else             // server version
  
  talevel = ((SC_DBObject *)cso_ptr)->BeginTransaction(
                  (*parms)[0].GetUChar(),
                  (*parms)[1].GetShort(connection->get_conversion())
            );
   
  result->Fill(talevel);

  return(NO);

#endif

}
Ejemplo n.º 16
0
logical CACObject :: SetVersion (dbdt date )
{
  logical   term = NO;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(date.GetLongInt());
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_SetVersion_ci2) )
        term = Get_rec_result()[0].GetUChar();
      UnlockSendParms();
    }
  }
  return(term);
  
#else             // server version
  
  term =  ((SC_DBObject *)cso_ptr)->SetVersion(
                  dbdt((*parms)[0].GetLong(connection->get_conversion()))
          );
   
  result->Fill(term);

  return(NO);

#endif

}
Ejemplo n.º 17
0
logical CACObject :: PushResult ( )
{
  logical   term = NO;
BEGINSEQ
  if ( !this )                                       LEAVESEQ
  if ( !csconnection )                               ERROR

  csconnection->LockSend();
  term = CConnection()->PushResult();
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
Ejemplo n.º 18
0
     CACObject :: CACObject (ACObject *obhandle, int32 objid, PIACC accopt, uint16 version_nr )
                     : CSHandle (obhandle->GetClientACObject()->IsValid() ? obhandle->GetClientACObject()->get_csconnection() : NULL),
ACObject(obhandle,objid,accopt,version_nr),
 cdbhandle(obhandle->GetDBHandle()->GetClientDBHandle()),
  topnode_list(new DLL(CNode))
{


#ifndef IF_Class  // client version

  CACObject  *cobhandle = obhandle->GetClientACObject();
  
  if ( !csconnection )                                 
    SDBSET(517)
  else
  {
    InitHandle();
    LockSendParms().Fill((CS_Handle *)cobhandle,objid,(int32)accopt,version_nr);
    
    if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_CACObject_ci1) )
    {
      if ( !Get_rec_result()[0].GetUChar() )
      {
        SetServerObject(Get_rec_result().GetHandle()->GetServerObject()); 
        CreateContext(); 
      }
    }
    UnlockSendParms();
  }
#else             // server version

  SC_DBObject *sc_dbo;
  CS_Handle   *handle = parms->GetHandle();
  
  sc_dbo = ((SC_DBObject *)(*parms)[0].GetHandle()->GetServerPointer())->ProvideDBObject(
                  handle->GetClientObject(),
                  (*parms)[1].GetLong(connection->get_conversion()),        // objid
                  (PIACC)(*parms)[2].GetLong(connection->get_conversion()), // accopt
                  (*parms)[3].GetUShort(connection->get_conversion()) );    // version_nr
   
  handle->SetServerPointer(sc_dbo);
  *result->GetHandle() = *handle;
  result->Fill((logical)!sc_dbo);

  return(NO);

#endif

}
Ejemplo n.º 19
0
logical CACObject :: CloseObject ( )
{
  logical   term = YES;
#ifndef IF_Class  // client version
  DLL(CNode)  *nodelist;
  CNode       *cnodeptr;
  ACObject    *objptr;

  if ( IsValid() )
  {
    ACObject::CloseObject();
  
    if ( nodelist = topnode_list )
    {
      topnode_list = NULL;
      while ( cnodeptr = nodelist->RemoveTail() )
      {
        cnodeptr->Switch(AUTO);
        delete cnodeptr;
      }
      delete nodelist;
    }
    while ( objptr = object_list->GetTail() )
      delete objptr;

    if ( (ACObject *)db_handle != (ACObject *)this && GetServerObject() )
    {
      LockSendParms().Fill();
      CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_CloseObject_ci);
      UnlockSendParms();
      UninitHandle();
    }
  }
  
  return(term);
  
#else             // server version
  
  ((SC_DBObject *)cso_ptr)->SetClientObject(0);
  ((SC_DBObject *)cso_ptr)->Remove();
   
  result->Fill();

  return(NO);

#endif

}
Ejemplo n.º 20
0
logical CACObject :: ExecObjCtxFunc (char *fnames, char *w_parms )
{
  logical      term = YES;
#ifndef IF_Class  // client version

  if ( IsValid() )
  {
    if ( !csconnection )                                 
      SDBSET(517)
    else
    {
      LockSendParms().Fill(fnames,w_parms);
      if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_ExecObjCtxFunc_ci) )
        if ( !(term = Get_rec_result()[0].GetUChar()) )
        {
          set_result_string(Get_rec_result()[1].GetString(),UNDEF);
          term = ACObject::ExecObjCtxFunc(fnames,w_parms);  // Client kann Ergebnis überschreiben
        }
      UnlockSendParms();
    }
  }
  return(term);
  
#else             // server version
  
  SC_DBObject    *sc_dbo     = (SC_DBObject *)cso_ptr;
  char           *result_str = NULL;
  
  if ( !(term =  sc_dbo->ExecuteDBObjectAction(
                      (*parms)[0].GetString(),
                      (*parms)[0].GetString()   )) )
    result_str = sc_dbo->GetActionResult();
   
  result->Fill(term,result_str);

  return(NO);

#endif

}
Ejemplo n.º 21
0
CConnection CProvider::CreateConnection() const 
{ 
  return CConnection(this->GetName());
}