本文整理匯總了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;
}
示例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;
}
示例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);
}
}
}
示例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()));
}
}
示例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;
}
示例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);
}
示例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(®istrations, &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));
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例12: GetConnection
void C4Network2ClientListBox::ConnectionListItem::OnButtonDisconnect(C4GUI::Control *pButton)
{
// close connection
C4Network2IOConnection *pConn = GetConnection();
if (pConn)
{
pConn->Close();
}
}
示例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;
}
示例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;
}
示例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;
}
}