Exemple #1
0
size_t CDBL_SendDataCmd::SendChunk(const void* pChunk, size_t nof_bytes)
{
    CHECK_DRIVER_ERROR(
        !pChunk  ||  !nof_bytes,
        "Wrong (zero) arguments." + GetDbgInfo(),
        290000 );

    if (!GetBytes2Go())
        return 0;

    if (nof_bytes > GetBytes2Go())
        nof_bytes = GetBytes2Go();

    if (Check(dbmoretext(GetCmd(), (DBINT) nof_bytes, (BYTE*) pChunk)) != SUCCEED) {
        Check(dbcancel(GetCmd()));
        DATABASE_DRIVER_ERROR( "dbmoretext failed." + GetDbgInfo(), 290001 );
    }

    SetBytes2Go(GetBytes2Go() - nof_bytes);

    if (GetBytes2Go() <= 0) {
        //        if (dbsqlok(m_Cmd) != SUCCEED || dbresults(m_Cmd) == FAIL) {
        if (Check(dbsqlok(GetCmd())) != SUCCEED || GetConnection().x_Results(GetCmd()) == FAIL) {
            DATABASE_DRIVER_ERROR( "dbsqlok/results failed." + GetDbgInfo(), 290002 );
        }
    }

    return nof_bytes;
}
Exemple #2
0
bool PostgreDatabase::WaitExecute(const char* QueryString, ...)
{
    if(QueryString == NULL) return false;

    va_list vlist;
    va_start(vlist, QueryString);

    mSearchMutex.acquire();
    uint32 Connection = GetConnection();
    InUseMarkers[Connection] = true;
    mSearchMutex.release();

    vsprintf(QueryBuffer[Connection], QueryString, vlist);

    PGresult * res = SendQuery(Connection, QueryBuffer[Connection], false);
    if(res == 0) return false;
    InUseMarkers[Connection] = false;

    ExecStatusType result = PQresultStatus(res);
    bool passed = false;

    if(result == PGRES_TUPLES_OK || result == PGRES_COMMAND_OK)
        passed = true;
    else
        sLog.outError("Execute failed because of [%s]", PQresultErrorMessage(res));

    // free up the memory
    PQclear(res);

    return passed;
}
void CFSPlayer::SetShipUpdate(const ClientShipUpdate& su)
{
    if (su.time > m_timeUpdate)
    {
        ShipUpdateStatus sus = GetIGCShip()->ProcessShipUpdate(su);
        if (sus == c_susAccepted)
        {
            m_ucLastUpdate = c_ucShipUpdate;

            m_su = su;
            m_timeUpdate = su.time;

            if (m_warpState == warpNoUpdate)
            {
                m_warpState = warpWaiting;
                m_timeNextWarp = g.timeNow + 2.0f;  //Some fudge factor
            }
            else if ((m_warpState == warpWaiting) && (g.timeNow >= m_timeNextWarp))
                m_warpState = warpReady;
        }
        else if (sus == c_susRejected)
        {
            BEGIN_PFM_CREATE(g.fm, pfmSR, S, SHIP_RESET)
            END_PFM_CREATE

            GetIGCShip()->ExportShipUpdate(&(pfmSR->shipupdate));
            pfmSR->cookie = NewCookie();

            g.fm.SendMessages(GetConnection(), FM_GUARANTEED, FM_FLUSH);
        }
    }
}
Exemple #4
0
void pgTrigger::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids && GetLanguage() != wxT("edbspl"))
	{
		ReadColumnDetails();

		if (browser)
		{
			// if no browser present, function will not be appended to tree
			expandedKids = true;
		}
		if (triggerFunction)
			delete triggerFunction;

		// append function here
		triggerFunction = functionFactory.AppendFunctions(this, GetSchema(), browser, wxT(
		                      "WHERE pr.oid=") + NumToStr(functionOid) + wxT("::oid\n"));
		if (triggerFunction)
		{
			iSetFunction(triggerFunction->GetQuotedFullIdentifier());
		}
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		if (GetConnection()->BackendMinimumVersion(8, 2))
			properties->AppendYesNoItem(_("Constraint?"), GetIsConstraint());
		properties->AppendItem(_("Fires"), GetFireWhen());
		properties->AppendItem(_("Event"), GetEvent());
		if (!GetQuotedColumns().IsEmpty())
		{
			properties->AppendItem(_("Columns"), GetColumns());
		}
		properties->AppendItem(_("For each"), GetForEach());
		if (GetLanguage() != wxT("edbspl"))
			properties->AppendItem(_("Function"), GetFunction() + wxT("(") + GetArguments() + wxT(")"));
		if (GetConnection()->BackendMinimumVersion(8, 5))
			properties->AppendItem(_("When?"), GetWhen());
		properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System trigger?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
wxString edbPackageFunction::GetArgListWithNames()
{
	wxString args;

	for (unsigned int i = 0; i < argTypesArray.Count(); i++)
	{
		if (i > 0)
			args += wxT(", ");

		wxString arg;

		if (GetIsProcedure())
		{
			if (!argNamesArray.Item(i).IsEmpty())
				arg += qtIdent(argNamesArray.Item(i));

			if (!argModesArray.Item(i).IsEmpty())
			{
				if (arg.IsEmpty())
					arg += argModesArray.Item(i);
				else
					arg += wxT(" ") + argModesArray.Item(i);
			}
		}
		else
		{
			if (!argModesArray.Item(i).IsEmpty())
				arg += argModesArray.Item(i);

			if (!argNamesArray.Item(i).IsEmpty())
			{
				if (arg.IsEmpty())
					arg += qtIdent(argNamesArray.Item(i));
				else
					arg += wxT(" ") + qtIdent(argNamesArray.Item(i));
			}
		}

		if (!arg.IsEmpty())
			arg += wxT(" ") + argTypesArray.Item(i);
		else
			arg += argTypesArray.Item(i);

		// Parameter default value
		if (GetConnection()->HasFeature(FEATURE_FUNCTION_DEFAULTS) &&
		        !argDefsArray.IsEmpty())
		{
			if ((argModesArray.Item(i).IsEmpty() ||
			        argModesArray.Item(i) == wxT("IN") ||
			        argModesArray.Item(i) == wxT("VARIADIC")) &&
			        !argDefsArray.Item(i).IsEmpty() &&
			        i < argDefsArray.Count())
				arg += wxT(" DEFAULT ") + argDefsArray.Item(i);
		}

		args += arg;
	}
	return args;
}
Exemple #6
0
bool pgProcedure::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
	if (!GetConnection()->EdbMinimumVersion(8, 0))
		return pgFunction::DropObject(frame, browser, cascaded);

	wxString sql = wxT("DROP PROCEDURE ") + this->GetSchema()->GetQuotedIdentifier() + wxT(".") + this->GetQuotedIdentifier();
	return GetDatabase()->ExecuteVoid(sql);
}
///<summary>Executes the GetLockedObjects command, returning an FdoILockedObjectReader.</summary>
/// <returns>Returns FdoILockedObjectReade.r</returns> 
FdoILockedObjectReader* ArcSDEGetLockedObjectsCommand::Execute ()
{
    FdoPtr<ArcSDEConnection> connection;
    CHAR user_name[SE_MAX_OWNER_LEN];
    FdoStringP user_str;
    CHAR* user;
    LONG result;
    SE_REGINFO *registrations;
    LONG count;
    CHAR table_name[SE_QUALIFIED_TABLE_NAME];
    LONG number;
    LONG *ids;
    FdoPtr<ArcSDELockedObjectReader> ret;

    // verify the connection
    connection = static_cast<ArcSDEConnection*>(GetConnection ());
    if (connection == NULL)
        throw FdoException::Create (NlsMsgGet (ARCSDE_CONNECTION_NOT_ESTABLISHED, "Connection not established."));

    // establish an empty locked object reader
    ret = new ArcSDELockedObjectReader (connection);

    // get the user name
    if (NULL == GetLockOwner () || (0 == wcscmp (L"", GetLockOwner ())))
    {
        result = SE_connection_get_user_name (connection->GetConnection (), user_name);
        handle_sde_err<FdoCommandException> (connection->GetConnection (), result, __FILE__, __LINE__, ARCSDE_USER_UNKNOWN, "Cannot determine current user.");
        user = user_name;
    }
    else
    {
        user_str = mLockOwner.Upper();
#ifdef SDE_UNICODE
        user = (CHAR*)sde_cstwc(user_str);
#else
        sde_wide_to_multibyte (user, (FdoString*)user_str);
#endif
    }

    // process the list of registered arcsde tables, checking for locks by user (or not)
    // Read all registered arcsde tables, adding user locks on the rows to the FdoILockedObjectReader
    connection->GetArcSDERegistrationList(&registrations, &count);
    for (int i = 0; i < count; i++)
    {
        if (SE_reginfo_allow_rowlocks (registrations[i]))
        {
            result = SE_reginfo_get_table_name (registrations[i], table_name);
            handle_sde_err<FdoCommandException> (connection->GetConnection(), result, __FILE__, __LINE__, ARCSDE_REGISTRATION_INFO_ITEM, "Table registration info item '%1$ls' could not be retrieved.", L"table_name");
            result = SE_table_get_rowlocks_by_user (connection->GetConnection(), table_name, user, &number, &ids);
            handle_sde_err<FdoCommandException>(connection->GetConnection(), result, __FILE__, __LINE__, ARCSDE_GET_ROW_LOCK_LIST_FAILED, "Failed to get the row lock list.");
            for (int j = 0; j < number; j++)
                ret->AddIdentity (table_name, ids[j]);
            SE_table_free_rowlocks_list (number, ids, NULL);
        }
    }

    return (FDO_SAFE_ADDREF (ret.p));
}
bool ConnectionSocket::ConnectSocketToHost(std::string& hostName, const std::string& service, int addrFamily) {

	Connection host = GetConnection(hostName, service, addrFamily);

	m_socketID = ConnectToHostSocket(host);

	return true;

}
//----------------------------------------------------------------------------
// Save a data stream to file
//
// pFile will contain "device path,pc folder" of which we want the 'pc folder' part
int CSTATEngine::SaveTransferFile(const char *pFile, char *pContents, unsigned long ulLength)
{
	int ret = E_BADFILENAME;

	CString path = ST_WORKINGPATH_VALUE;
	//read from inifile if entry exists
	if(statIniFile.SectionExists(ST_TEST_KEY) )
	{
		CString setting;
		setting.Empty();
		setting=statIniFile.GetKeyValue(ST_WORKINGPATH,ST_TEST_KEY);
		if(!setting.IsEmpty())
			path = setting;
	}
	// add a backslash
	if (path.Right(1) != _T('\\'))
		path += _T('\\');

	// get any additional sub folders
	CString folder = pFile;
	int index = folder.Find(_T(','));
	if (index == -1)
		return E_BADFILENAME;
	// if the comma is the last char there are no folders to add
	if (folder.Right(1) != _T(','))
	{
		path += folder.Mid(index + 1);

		// add a backslash
		if (path.Right(1) != _T('\\'))
			path += _T('\\');
	}

	if (bMultithreaded)
	{
		// add a sub-folder for the connection type
		path += GetConnection(eConnectType);
		path += _T(".");
		path += szAddress;
		path += _T('\\');
	}

	// now extract the filename from the first argument
	CString filename = folder.Left(index);
	index = filename.ReverseFind(_T('\\'));
	if (index == -1)
		path += filename;
	else
		path += filename.Mid(index + 1);

	Message("Saving file [%s]", ToAnsi(path));

	ret = SaveTheFile(path, pContents, ulLength);
	if (ret != ITS_OK)
		Message("Error saving [%s] (%d)", ToAnsi(path), GetLastError());
	return ret;
}
Exemple #10
0
//--------------------------------------------------------------------------
void Client::Disconnect(const VeChar8* pcName)
{
	VE_AUTO_LOCK_MUTEX(m_kMutex);
	Connection* pkConnect = GetConnection(pcName);
	if(pkConnect)
	{
		pkConnect->ForceDisconnect(Connection::CONNECT_TURN_OFF);
	}
}
Exemple #11
0
bool CFighterMediator::SendToGac(const void* pData,uint32 uSize,uint32 uRange)const
{
	CConnServer* pConn= GetConnection();
	if( pConn && (!DirectorMovingIsDisabled() || uRange == eOnlyToDirector) )
		pConn->Send(pData,uSize);
	if(uRange != eOnlyToDirector)
		GetIS(uRange)->Send(pData,uSize);
	return true;
}
void C4Network2ClientListBox::ConnectionListItem::OnButtonDisconnect(C4GUI::Control *pButton)
{
	// close connection
	C4Network2IOConnection *pConn = GetConnection();
	if (pConn)
	{
		pConn->Close();
	}
}
Exemple #13
0
IWriter* CStatement::GetBlobWriter(I_ITDescriptor &d, size_t blob_size,
                                   TBlobOStreamFlags flags)
{
    delete m_wr;
    m_wr = 0;
    m_wr = new CxBlobWriter(GetConnection()->GetCDB_Connection(),
                            d, blob_size, flags, false);
    return m_wr;
}
Exemple #14
0
bool pgDatabase::GetCanHint()
{
	if (encoding == wxT("SQL_ASCII"))
		return true;

	if (encoding == wxT("UNICODE"))
	{
		wxString ver = GetServer()->GetVersionString();
		if (ver.Find(wxT("mingw32")) > 0 && ver.Find(wxT("SQL 8.0.")) > 0)
			return true;
	}

	if (GetServer()->GetConnection() == GetConnection() &&
	        GetConnection()->BackendMinimumVersion(8, 0) &&
	        !GetConnection()->HasFeature(FEATURE_FILEREAD))
		return true;

	return false;
}
Exemple #15
0
//--------------------------------------------------------------------------
void Client::Connect(const VeChar8* pcName, const VeChar8* pcSrvIp,
	VeUInt32 u32Port, const VeChar8* pcSrvPass)
{
	VE_AUTO_LOCK_MUTEX(m_kMutex);
	Connection* pkConnect = GetConnection(pcName);
	if(pkConnect)
	{
		pkConnect->Connect(pcSrvIp, u32Port, pcSrvPass);
	}
}
Exemple #16
0
void CSGGameLoopCallback::Process(const CmdData* pCmdData)
{
	if(pCmdData->nCmd==SGCMDCODE_CONNECT) {
		assert(pCmdData->nWho!=0);
		CSGConnection* pConnection;
		pConnection = GetConnection(pCmdData->nWho);
		if(pConnection) {
			pConnection->Disconnect();
			pConnection->OnDisconnect();
			pConnection->Release();
		}
		CCmdDataReader cmd(pCmdData);
		IGameFES* pFES = NULL; /* MsgLoop_GetFES(cmd.GetValue<unsigned int>(), cmd.GetValue<unsigned short>());
		assert(pFES);
		if(!pFES) return; */
		cmd.GetValue<unsigned int>();
		cmd.GetValue<unsigned short>();
		pConnection = CreateConnection(pCmdData->nWho, pFES, cmd.GetValue<unsigned int>());
		assert(pConnection);
		if(!pConnection) return;
		pConnection->OnConnect();
		return;
	}
	if(pCmdData->nCmd==SGCMDCODE_USERDATA) {
		assert(pCmdData->nWho!=0);
		CSGConnection* pConnection;
		pConnection = GetConnection(pCmdData->nWho);
		assert(pConnection);
		if(!pConnection) return;
		pConnection->OnData(pCmdData->pData, pCmdData->nSize);
		return;
	}
	if(pCmdData->nCmd==SGCMDCODE_DISCONNECT) {
		assert(pCmdData->nWho!=0);
		CSGConnection* pConnection;
		pConnection = GetConnection(pCmdData->nWho);
		assert(pConnection);
		if(!pConnection) return;
		pConnection->OnDisconnect();
		pConnection->Release();
		return;
	}
}
SOCKET CChannelInfo::GetSocket(SOCKET_TYPE enSocketType)
{
    CConnection* pConnection = GetConnection(enSocketType);
    if (NULL == pConnection)
    {
        return INVALID_SOCKET;
    }

    return pConnection->GetSocket();
}
bool ConnectionSocket::BindSocketToHost(std::string& hostName, const std::string& service, int addrFamily, int addrInfoFlags) {

	m_name = hostName;

	Connection host = GetConnection(hostName, service, addrFamily, addrInfoFlags);
	
	m_socketID = BindSocketWithConnection(host);

	return true;
}
/*-------------------------------------------------------------------------
 * SetDPGroup
 *-------------------------------------------------------------------------
 * Purpose:
 *    Adds the player to a "primary" group within a mission, i.e. either
 *        flying or docked in a sector. Players in missions are always in 
 *        exactly 1 primary group.
 * 
 * Side Effects:
 *    Removes them from the group they were in
 */
void CFSPlayer::SetDPGroup(CFSCluster*  pfsCluster, bool bFlying)
{
  if (m_pfsClusterFlying)
  {
      m_pfsClusterFlying->RemoveFlyingPlayer(this);
  }

  CFMGroup* pgrp;
  if (pfsCluster)
  {
      if (bFlying)
      {
          pgrp = pfsCluster->GetClusterGroups()->pgrpClusterFlying;

          m_pfsClusterFlying = pfsCluster;
          pfsCluster->AddFlyingPlayer(this);
      }
      else
      {
          pgrp = pfsCluster->GetClusterGroups()->pgrpClusterDocked;
          m_pfsClusterFlying = NULL;
      }
  }
  else
  {
      pgrp = NULL;
      m_pfsClusterFlying = NULL;
  }

  if (m_pgrp)
  {
#ifdef DEBUG
    // mmf only log this in debug build
    debugf("Removing %s(%u) from group %s(%u)\n", GetName(), GetConnection()->GetID(), 
            m_pgrp->GetName(), m_pgrp->GetID());
#endif
    g.fm.DeleteConnectionFromGroup(m_pgrp, GetConnection());
  }
  m_pgrp = pgrp;
  if (m_pgrp)
	g.fm.AddConnectionToGroup(m_pgrp, GetConnection());
}
Exemple #20
0
wxString pgView::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- View: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP VIEW ") + GetQuotedFullIdentifier() + wxT(";")
		      + wxT("\n\nCREATE OR REPLACE VIEW ") + GetQuotedFullIdentifier() + wxT(" AS \n")
		      + GetFormattedDefinition()
		      + wxT("\n\n")
		      + GetOwnerSql(7, 3, wxT("TABLE ") + GetQuotedFullIdentifier());

		if (GetConnection()->BackendMinimumVersion(8, 2))
			sql += GetGrant(wxT("arwdxt"), wxT("TABLE ") + GetQuotedFullIdentifier());
		else
			sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") + GetQuotedFullIdentifier());

		sql += GetCommentSql()
		       + wxT("\n");

		pgCollection *columns = browser->FindCollection(columnFactory, GetId());
		if (columns)
		{
			wxString defaults, comments;
			columns->ShowTreeDetail(browser);
			treeObjectIterator colIt(browser, columns);

			pgColumn *column;
			while ((column = (pgColumn *)colIt.GetNextObject()) != 0)
			{
				column->ShowTreeDetail(browser);
				if (column->GetColNumber() > 0)
				{
					if (!column->GetDefault().IsEmpty())
					{
						defaults += wxT("ALTER TABLE ") + GetQuotedFullIdentifier()
						            +  wxT(" ALTER COLUMN ") + column->GetQuotedIdentifier()
						            +  wxT(" SET DEFAULT ") + column->GetDefault()
						            + wxT(";\n");
					}
					comments += column->GetCommentSql();
				}
			}
			if (!defaults.IsEmpty())
				sql += defaults + wxT("\n");

			if (!comments.IsEmpty())
				sql += comments + wxT("\n");
		}

		AppendStuff(sql, browser, ruleFactory);
		AppendStuff(sql, browser, triggerFactory);
	}
	return sql;
}
Exemple #21
0
void ClusterTransport::DropConnection(uint64_t nodeID)
{
    ClusterConnection* conn;
    
    conn = GetConnection(nodeID);
    
    if (!conn)
        return;
        
    DeleteConnection(conn);
}
Exemple #22
0
wxString pgDomain::GetSql(ctlTree *browser)
{
    if (sql.IsNull())
    {
        sql = wxT("-- Domain: ") + GetQuotedFullIdentifier() + wxT("\n\n")
              + wxT("-- DROP DOMAIN ") + GetQuotedFullIdentifier() + wxT(";")
              + wxT("\n\nCREATE DOMAIN ") + GetQuotedFullIdentifier()
              + wxT("\n  AS ") + GetQuotedBasetype();
        if (GetCollationOid() > 0)
            sql += wxT("\n  COLLATE ") + GetQuotedCollation();
        AppendIfFilled(sql, wxT("\n  DEFAULT "), GetDefault());
        // CONSTRAINT Name Dont know where it's stored, may be omitted anyway
        if (notNull)
            sql += wxT("\n  NOT NULL");

        // Get a count of the constraints.
        int consCount = 0;
        pgCollection *constraints = browser->FindCollection(checkFactory, GetId());
        if (constraints)
        {
            constraints->ShowTreeDetail(browser);
            treeObjectIterator consIt(browser, constraints);

            pgObject *data;

            while ((data = consIt.GetNextObject()) != 0)
            {
                data->ShowTreeDetail(browser);

                sql += wxT("\n  CONSTRAINT ") + data->GetQuotedIdentifier()
                       + wxT(" ") + data->GetTypeName().Upper()
                       + wxT(" ") ;

                switch (data->GetMetaType())
                {
                case PGM_CHECK:
                    sql += wxT("(") + ((pgCheck *)data)->GetDefinition() + wxT(")");
                    if (GetDatabase()->BackendMinimumVersion(9, 2) && !((pgCheck *)data)->GetValid())
                        sql += wxT(" NOT VALID");
                    break;
                }
            }
        }

        sql += wxT(";\n")
               + GetOwnerSql(7, 4)
               + GetCommentSql();

        if (GetConnection()->BackendMinimumVersion(9, 1))
            sql += GetSeqLabelsSql();
    }

    return sql;
}
Exemple #23
0
void ClusterTransport::DropConnection(Endpoint endpoint)
{
    ClusterConnection* conn;
    
    conn = GetConnection(endpoint);
    
    if (!conn)
        return;
        
    DeleteConnection(conn);
}
Exemple #24
0
bool CIntGraph::IsCrossingConnection (DWORD dwFromID, DWORD dwToID)

//	IsCrossingConnection
//
//	Returns TRUE if a connection between the two nodes would cross an already
//	existing connection.

	{
	int i;

	//	Get the coordinates of the proposed connection

	SNode *pFrom = GetNode((int)dwFromID);
	SNode *pTo = GetNode((int)dwToID);
	int A1x = pFrom->x;
	int A1y = pFrom->y;
	int A2x = pTo->x;
	int A2y = pTo->y;

	//	Walk all nodes

	for (i = 0; i < m_Nodes.GetCount(); i++)
		{
		SNode *pNode = GetNode(i);
		if (!NodeIsFree(pNode) && pNode != pFrom && pNode != pTo)
			{
			//	Walk all connections for this node
			//	(We only walk forward connections)

			int iConnection = pNode->iFirstForward;
			while (iConnection != -1)
				{
				SConnection *pConnection = GetConnection(iConnection);
				SNode *pFrom2 = GetNode(pConnection->iFrom);
				SNode *pTo2 = GetNode(pConnection->iTo);

				if (pTo2 != pFrom && pTo2 != pTo)
					{
					int B1x = pFrom2->x;
					int B1y = pFrom2->y;
					int B2x = pTo2->x;
					int B2y = pTo2->y;

					if (IntSegmentsIntersect(A1x, A1y, A2x, A2y, B1x, B1y, B2x, B2y))
						return true;
					}

				iConnection = pConnection->iNext;
				}
			}
		}

	return false;
	}
Exemple #25
0
CDBL_SendDataCmd::~CDBL_SendDataCmd()
{
    try {
        DetachSendDataIntf();

        GetConnection().DropCmd(*(impl::CSendDataCmd*)this);

        Cancel();
    }
    NCBI_CATCH_ALL_X( 2, NCBI_CURRENT_FUNCTION )
}
Exemple #26
0
CDBL_BCPInCmd::~CDBL_BCPInCmd()
{
    try {
        DetachInterface();

        GetConnection().DropCmd(*this);

        Cancel();
    }
    NCBI_CATCH_ALL_X( 1, NCBI_CURRENT_FUNCTION )
}
Exemple #27
0
CODBC_RPCCmd::~CODBC_RPCCmd()
{
    try {
        DetachInterface();

        GetConnection().DropCmd(*this);

        Cancel();
    }
    NCBI_CATCH_ALL_X( 5, NCBI_CURRENT_FUNCTION )
}
Exemple #28
0
///////////////////////////////////////////////////////////////////////////////
/// CSRConnection::SendSYN
/// @description Composes an SYN and writes it to the channel.
/// @param The message to SYN.
/// @pre A message has been accepted.
/// @post A syn has been written to the channel
///////////////////////////////////////////////////////////////////////////////
void CSRConnection::SendSYN()
{
    Logger.Debug << __PRETTY_FUNCTION__ << std::endl;
    unsigned int seq = m_outseq;
    freedm::broker::CMessage outmsg;
    if(m_window.size() == 0)
    {
        m_outseq = (m_outseq+1)%SEQUENCE_MODULO;
    }
    else
    {
        //Don't bother if front of queue is already a SYN
        if(m_window.front().GetStatus() == CMessage::Created)
        {
            return;
        }
        //Set it as the seq before the front of queue
        seq = m_window.front().GetSequenceNumber();
        if(seq == 0)
        {
            seq = SEQUENCE_MODULO-1;
        }
        else
        {
            seq--;
        }
    }
    // Presumably, if we are here, the connection is registered 
    outmsg.SetSourceUUID(GetConnection()->GetConnectionManager().GetUUID());
    outmsg.SetSourceHostname(GetConnection()->GetConnectionManager().GetHostname());
    outmsg.SetStatus(freedm::broker::CMessage::Created);
    outmsg.SetSequenceNumber(seq);
    outmsg.SetSendTimestampNow();
    outmsg.SetProtocol(GetIdentifier());
    Write(outmsg);
    m_window.push_front(outmsg);
    m_outsync = true;
    /// Hook into resend until the message expires.
    boost::system::error_code x;
    Resend(x);
}
Exemple #29
0
void pgFunction::ShowStatistics(frmMain *form, ctlListView *statistics)
{
	if (GetConnection()->BackendMinimumVersion(8, 4))
	{
		wxString sql = wxT("SELECT calls AS ") + qtIdent(_("Number of calls")) +
		               wxT(", total_time AS ") + qtIdent(_("Total Time")) +
		               wxT(", self_time AS ") + qtIdent(_("Self Time")) +
		               wxT(" FROM pg_stat_user_functions") +
		               wxT(" WHERE funcid = ") + NumToStr(GetOid());
		DisplayStatistics(statistics, sql);
	}
}
//----------------------------------------------------------------------------
// Convert and save a screenshot
int CSTATEngine::ConvertAndSaveScreeenshot(CString &file, const char *pContents, const unsigned long ulLength)
{
	int ret = E_BADFILENAME;

	// clean out any previous mbm files lying around
	if (!RemoveLeftoverMBMFiles())
		return E_SCREENSHOT_LEFTOVERFILES;

	// get the destination screenshot name
	CString destfile = file;
	if (destfile.IsEmpty())
	{
		// construct a filename from date/time
		char szName[20] = {0};
		time_t curTime;
		time (&curTime);
		strftime (szName, 
					sizeof (szName),
					"%Y%m%d%H%M%S",
					localtime (&curTime));

		destfile = szName;
	}

	// get the full name of the source image
	CString SrcPath = cScreenshotDirectory;

	if (bMultithreaded)
	{
		// add a sub-folder for the connection type
		SrcPath += GetConnection(eConnectType);
		SrcPath += _T(".");
		SrcPath += szAddress;
		SrcPath += _T('\\');
	}

	// attach the filename
	CString path = SrcPath;

	path += destfile;
	path += _T(".mbm");

//	Message("Saving screenshot [%s]", ToAnsi(path));

	// save bitmap data to file
	if ((ret = SaveTheFile(path, pContents, ulLength)) == ITS_OK)
		ret = pConverter->ConvertScreenShot(SrcPath, SrcPath);

	// save the full path to the converted image
	if (ret == ITS_OK)
		file = SrcPath;
	return ret;
}