当前位置: 首页>>代码示例>>C++>>正文


C++ GetConnection函数代码示例

本文整理汇总了C++中GetConnection函数的典型用法代码示例。如果您正苦于以下问题:C++ GetConnection函数的具体用法?C++ GetConnection怎么用?C++ GetConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetConnection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CHECK_DRIVER_ERROR

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;
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:29,代码来源:connection.cpp

示例2: va_start

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;
}
开发者ID:AwkwardDev,项目名称:WoWD,代码行数:31,代码来源:PostgreDatabase.cpp

示例3: GetIGCShip

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);
        }
    }
}
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:32,代码来源:fsship.cpp

示例4: ReadColumnDetails

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()));
	}
}
开发者ID:zr40,项目名称:pgadmin3-light,代码行数:47,代码来源:pgTrigger.cpp

示例5: wxT

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;
}
开发者ID:SokilV,项目名称:pgadmin3,代码行数:59,代码来源:edbPackageFunction.cpp

示例6: DropObject

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);
}
开发者ID:intgr,项目名称:pgadmin3,代码行数:8,代码来源:pgFunction.cpp

示例7: ArcSDELockedObjectReader

///<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));
}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:60,代码来源:ArcSDEGetLockedObjectsCommand.cpp

示例8: GetConnection

bool ConnectionSocket::ConnectSocketToHost(std::string& hostName, const std::string& service, int addrFamily) {

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

	m_socketID = ConnectToHostSocket(host);

	return true;

}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:9,代码来源:ConnectionSocket.cpp

示例9: _T

//----------------------------------------------------------------------------
// 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;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:61,代码来源:statengine.cpp

示例10: VE_AUTO_LOCK_MUTEX

//--------------------------------------------------------------------------
void Client::Disconnect(const VeChar8* pcName)
{
	VE_AUTO_LOCK_MUTEX(m_kMutex);
	Connection* pkConnect = GetConnection(pcName);
	if(pkConnect)
	{
		pkConnect->ForceDisconnect(Connection::CONNECT_TURN_OFF);
	}
}
开发者ID:snailwork,项目名称:Texas-cs,代码行数:10,代码来源:Client.cpp

示例11: GetConnection

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;
}
开发者ID:svn2github,项目名称:ybtx,代码行数:9,代码来源:CFighterMediator.cpp

示例12: GetConnection

void C4Network2ClientListBox::ConnectionListItem::OnButtonDisconnect(C4GUI::Control *pButton)
{
	// close connection
	C4Network2IOConnection *pConn = GetConnection();
	if (pConn)
	{
		pConn->Close();
	}
}
开发者ID:gitMarky,项目名称:openclonk,代码行数:9,代码来源:C4Network2Dialogs.cpp

示例13: CxBlobWriter

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;
}
开发者ID:swuecho,项目名称:igblast,代码行数:9,代码来源:stmt_impl.cpp

示例14: GetServer

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;
}
开发者ID:KrisShannon,项目名称:pgadmin3,代码行数:19,代码来源:pgDatabase.cpp

示例15: assert

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;
	}
}
开发者ID:EmuxEvans,项目名称:sailing,代码行数:43,代码来源:SGGameLoop.cpp


注:本文中的GetConnection函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。