本文整理汇总了C++中GetCurrentCommandId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentCommandId函数的具体用法?C++ GetCurrentCommandId怎么用?C++ GetCurrentCommandId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentCommandId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cancel
void CControlSocket::Cancel()
{
if (GetCurrentCommandId() != Command::none)
{
if (GetCurrentCommandId() == Command::connect)
DoClose(FZ_REPLY_CANCELED);
else
ResetOperation(FZ_REPLY_CANCELED);
}
}
示例2: CopyCurrentSnapshot
/*
* CopyCurrentSnapshot
* Make a snapshot that is up-to-date as of the current instant,
* and return a copy.
*
* The copy is palloc'd in the current memory context.
*/
Snapshot
CopyCurrentSnapshot(void)
{
Snapshot currentSnapshot;
Snapshot snapshot;
if (QuerySnapshot == NULL) /* should not be first call in xact */
elog(ERROR, "no snapshot has been set");
/* Update the static struct */
currentSnapshot = GetSnapshotData(&CurrentSnapshotData, false);
currentSnapshot->curcid = GetCurrentCommandId();
/* Make a copy */
snapshot = (Snapshot) palloc(sizeof(SnapshotData));
memcpy(snapshot, currentSnapshot, sizeof(SnapshotData));
if (snapshot->xcnt > 0)
{
snapshot->xip = (TransactionId *)
palloc(snapshot->xcnt * sizeof(TransactionId));
memcpy(snapshot->xip, currentSnapshot->xip,
snapshot->xcnt * sizeof(TransactionId));
}
else
snapshot->xip = NULL;
return snapshot;
}
示例3: LogMessage
int CRealControlSocket::ContinueConnect(const wxIPV4address *address)
{
LogMessage(__TFILE__, __LINE__, this, Debug_Verbose, _T("CRealControlSocket::ContinueConnect(%p) m_pEngine=%p"), address, m_pEngine);
if (GetCurrentCommandId() != cmd_connect ||
!m_pCurrentServer)
{
LogMessage(Debug_Warning, _T("Invalid context for call to ContinueConnect(), cmd=%d, m_pCurrentServer=%p"), GetCurrentCommandId(), m_pCurrentServer);
return DoClose(FZ_REPLY_INTERNALERROR);
}
if (!address)
{
LogMessage(::Error, _("Invalid hostname or host not found"));
return DoClose(FZ_REPLY_ERROR | FZ_REPLY_CRITICALERROR);
}
CConnectOpData* pData;
if (!m_pCurOpData || m_pCurOpData->opId != cmd_connect)
pData = 0;
else
pData = static_cast<CConnectOpData *>(m_pCurOpData);
const unsigned int port = pData ? pData->port : m_pCurrentServer->GetPort();
LogMessage(Status, _("Connecting to %s:%d..."), address->IPAddress().c_str(), port);
wxIPV4address addr = *address;
addr.Service(port);
bool res = wxSocketClient::Connect(addr, false);
if (!res && LastError() != wxSOCKET_WOULDBLOCK)
return DoClose();
return FZ_REPLY_WOULDBLOCK;
}
示例4: DtmGetSnapshot
static Snapshot DtmGetSnapshot(Snapshot snapshot)
{
if (TransactionIdIsValid(DtmNextXid) && snapshot != &CatalogSnapshotData)
{
if (!DtmHasGlobalSnapshot && (snapshot != DtmLastSnapshot || DtmCurcid != GetCurrentCommandId(false))) {
ArbiterGetSnapshot(DtmNextXid, &DtmSnapshot, &dtm->minXid);
}
DtmLastSnapshot = snapshot;
DtmMergeWithGlobalSnapshot(snapshot);
DtmCurcid = snapshot->curcid;
if (!IsolationUsesXactSnapshot())
{
/* Use single global snapshot during all transaction for repeatable read isolation level,
* but obtain new global snapshot each time it is requested for read committed isolation level
*/
DtmHasGlobalSnapshot = false;
}
}
else
{
/* For local transactions and catalog snapshots use default GetSnapshotData implementation */
snapshot = PgGetSnapshotData(snapshot);
}
DtmUpdateRecentXmin(snapshot);
return snapshot;
}
示例5: create_estate_for_relation
/*
* Executor state preparation for evaluation of constraint expressions,
* indexes and triggers.
*
* This is based on similar code in copy.c
*/
static EState *
create_estate_for_relation(LogicalRepRelMapEntry *rel)
{
EState *estate;
ResultRelInfo *resultRelInfo;
RangeTblEntry *rte;
estate = CreateExecutorState();
rte = makeNode(RangeTblEntry);
rte->rtekind = RTE_RELATION;
rte->relid = RelationGetRelid(rel->localrel);
rte->relkind = rel->localrel->rd_rel->relkind;
estate->es_range_table = list_make1(rte);
resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0);
estate->es_result_relations = resultRelInfo;
estate->es_num_result_relations = 1;
estate->es_result_relation_info = resultRelInfo;
estate->es_output_cid = GetCurrentCommandId(true);
/* Triggers might need a slot */
if (resultRelInfo->ri_TrigDesc)
estate->es_trig_tuple_slot = ExecInitExtraTupleSlot(estate, NULL);
/* Prepare to catch AFTER triggers. */
AfterTriggerBeginQuery();
return estate;
}
示例6: transientrel_startup
/*
* transientrel_startup --- executor startup
*/
static void
transientrel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
{
DR_transientrel *myState = (DR_transientrel *) self;
Relation transientrel;
transientrel = heap_open(myState->transientoid, NoLock);
/*
* Fill private fields of myState for use by later routines
*/
myState->transientrel = transientrel;
myState->output_cid = GetCurrentCommandId(true);
/*
* We can skip WAL-logging the insertions, unless PITR or streaming
* replication is in use. We can skip the FSM in any case.
*/
myState->hi_options = HEAP_INSERT_SKIP_FSM | HEAP_INSERT_FROZEN;
if (!XLogIsNeeded())
myState->hi_options |= HEAP_INSERT_SKIP_WAL;
myState->bistate = GetBulkInsertState();
/* Not using WAL requires smgr_targblock be initially invalid */
Assert(RelationGetTargetBlock(transientrel) == InvalidBlockNumber);
}
示例7: ExecCQMatRelInsert
/*
* ExecCQMatViewInsert
*
* Insert a new row into a CV materialization table
*/
void
ExecCQMatRelInsert(ResultRelInfo *ri, TupleTableSlot *slot, EState *estate)
{
HeapTuple tup = ExecMaterializeSlot(slot);
heap_insert(ri->ri_RelationDesc, tup, GetCurrentCommandId(true), 0, NULL);
ExecInsertCQMatRelIndexTuples(ri, slot, estate);
}
示例8: UpdateActiveSnapshotCommandId
/*
* UpdateActiveSnapshotCommandId
*
* Update the current CID of the active snapshot. This can only be applied
* to a snapshot that is not referenced elsewhere.
*/
void
UpdateActiveSnapshotCommandId(void)
{
Assert(ActiveSnapshot != NULL);
Assert(ActiveSnapshot->as_snap->active_count == 1);
Assert(ActiveSnapshot->as_snap->regd_count == 0);
ActiveSnapshot->as_snap->curcid = GetCurrentCommandId(false);
}
示例9: RegisterSmgrInvalidation
/*
* RegisterSmgrInvalidation
*
* As above, but register an smgr invalidation event.
*/
static void
RegisterSmgrInvalidation(RelFileNode rnode)
{
AddSmgrInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,
rnode);
/*
* As above, just in case there is not an associated catalog change.
*/
(void) GetCurrentCommandId(true);
}
示例10: LogMessage
void CRealControlSocket::OnClose(int error)
{
LogMessage(MessageType::Debug_Verbose, _T("CRealControlSocket::OnClose(%d)"), error);
if (GetCurrentCommandId() != Command::connect)
{
if (!error)
LogMessage(MessageType::Error, _("Connection closed by server"));
else
LogMessage(MessageType::Error, _("Disconnected from server: %s"), CSocket::GetErrorDescription(error));
}
DoClose();
}
示例11: LogMessage
int CHttpControlSocket::ContinueConnect()
{
LogMessage(__TFILE__, __LINE__, this, Debug_Verbose, _T("CHttpControlSocket::ContinueConnect() m_pEngine=%p"), m_pEngine);
if (GetCurrentCommandId() != cmd_connect ||
!m_pCurrentServer)
{
LogMessage(Debug_Warning, _T("Invalid context for call to ContinueConnect(), cmd=%d, m_pCurrentServer=%p"), GetCurrentCommandId(), m_pCurrentServer);
return DoClose(FZ_REPLY_INTERNALERROR);
}
ResetOperation(FZ_REPLY_OK);
return FZ_REPLY_OK;
}
示例12: PushUpdatedSnapshot
/*
* PushUpdatedSnapshot
* As above, except we set the snapshot's CID to the current CID.
*/
void
PushUpdatedSnapshot(Snapshot snapshot)
{
Snapshot newsnap;
/*
* We cannot risk modifying a snapshot that's possibly already used
* elsewhere, so make a new copy to scribble on.
*/
newsnap = CopySnapshot(snapshot);
newsnap->curcid = GetCurrentCommandId(false);
PushActiveSnapshot(newsnap);
}
示例13: wxASSERT
void CHttpControlSocket::OnConnect()
{
wxASSERT(GetCurrentCommandId() == cmd_connect);
CHttpConnectOpData *pData = static_cast<CHttpConnectOpData *>(m_pCurOpData);
if (pData->tls)
{
if (!m_pTlsSocket)
{
LogMessage(Status, _("Connection established, initializing TLS..."));
delete m_pBackend;
m_pTlsSocket = new CTlsSocket(this, m_pSocket, this);
m_pBackend = m_pTlsSocket;
if (!m_pTlsSocket->Init())
{
LogMessage(::Error, _("Failed to initialize TLS."));
DoClose();
return;
}
const wxString trusted_rootcert = m_pEngine->GetOptions()->GetOption(OPTION_INTERNAL_ROOTCERT);
if (trusted_rootcert != _T("") && !m_pTlsSocket->AddTrustedRootCertificate(trusted_rootcert))
{
LogMessage(::Error, _("Failed to parse trusted root cert."));
DoClose();
return;
}
int res = m_pTlsSocket->Handshake();
if (res == FZ_REPLY_ERROR)
DoClose();
}
else
{
LogMessage(Status, _("TLS/SSL connection established, sending HTTP request"));
ResetOperation(FZ_REPLY_OK);
}
return;
}
else
{
LogMessage(Status, _("Connection established, sending HTTP request"));
ResetOperation(FZ_REPLY_OK);
}
}
示例14: UpdateActiveSnapshotCommandId
/*
* UpdateActiveSnapshotCommandId
*
* Update the current CID of the active snapshot. This can only be applied
* to a snapshot that is not referenced elsewhere.
*/
void
UpdateActiveSnapshotCommandId(void)
{
Assert(ActiveSnapshot != NULL);
Assert(ActiveSnapshot->as_snap->active_count == 1);
Assert(ActiveSnapshot->as_snap->regd_count == 0);
ActiveSnapshot->as_snap->curcid = GetCurrentCommandId(false);
#ifdef XCP
/*
* Set flag so that updated command ID is sent to the datanodes before the
* next query. This ensures that the effects of previous statements are
* visible to the subsequent statements
*/
SetSendCommandId(true);
#endif
}
示例15: LogMessage
void CRealControlSocket::OnSend()
{
if (m_pSendBuffer)
{
if (!m_nSendBufferLen)
{
delete [] m_pSendBuffer;
m_pSendBuffer = 0;
return;
}
int error;
int written = m_pBackend->Write(m_pSendBuffer, m_nSendBufferLen, error);
if (written < 0)
{
if (error != EAGAIN)
{
LogMessage(MessageType::Error, _("Could not write to socket: %s"), CSocket::GetErrorDescription(error));
if (GetCurrentCommandId() != Command::connect)
LogMessage(MessageType::Error, _("Disconnected from server"));
DoClose();
}
return;
}
if (written)
{
SetAlive();
m_pEngine->SetActive(CFileZillaEngine::send);
}
if (written == m_nSendBufferLen)
{
m_nSendBufferLen = 0;
delete [] m_pSendBuffer;
m_pSendBuffer = 0;
}
else
{
memmove(m_pSendBuffer, m_pSendBuffer + written, m_nSendBufferLen - written);
m_nSendBufferLen -= written;
}
}
}