Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions  Download package

bool DBMSrvKnl_Session::Release (  ) 

release a connection

public member

Definition at line 141 of file DBMSrvKnl_Session.cpp.

References PIn_Part::AddArgument(), PIn_RequestSegment::AddPart(), PIn_RequestPacket::AddSegment(), PIn_RequestSegment::ClosePart(), PIn_RequestPacket::CloseSegment(), PIn_RequestPacket::InitVersion(), SAPDBErr_MessageList::IsEmpty(), PIn_SQLPacket::IsValid(), PIn_SQLPacket::Length(), and PIn_RequestSegment::SetProducer().

Referenced by cn85FreeKernelSession().

{
  bool bReturn = true;
  SAPDBErr_MessageList oLocalMsg;

  if (this->IsConnected()) {
    // send release command
    // create request packet
    PIn_RequestPacket  oPacket(this->pPacket, this->nPacketSize, this->nUnicode);
    // initialise request packet
    oPacket.InitVersion(csp_comp_db_manager, NULL);
    // create segement
    PIn_RequestSegment oSegment = oPacket.AddSegment(sp1m_dbs, sp1sm_session_sqlmode);
    oSegment.SetProducer(sp1pr_internal_cmd);
    // create command part
    PIn_Part oCommandPart = oSegment.AddPart(sp1pk_command);
    // fill commadn part
    oCommandPart.AddArgument(CMD_RELEASE, (int) strlen(CMD_RELEASE));
    // close part
    oSegment.ClosePart(oCommandPart);
    // close segment
    oPacket.CloseSegment(oSegment);
    // send request to kernel
    if (!Request(oPacket.Length())) {
      if (bReturn) oLocalMsg = this->LastMessage();
      bReturn = false;
    } // end if
    // receive answer from kernel and create answer packet
    PIn_ReplyPacket  oReplyPacket(Receive());
    // check answer packet
    if (!oReplyPacket.IsValid()) {
      if (bReturn) oLocalMsg = this->LastMessage();
      bReturn = false;
    } // end if

    sqlarelease (this->nSessionHandle);

    if (!oLocalMsg.IsEmpty()) this->oMessageList = oLocalMsg;
  } // end if

  this->Reset();
  return bReturn;
} // end DBMSrvKnl_Session :: Release


Generated by  Doxygen 1.6.0   Back to index