您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetCurrentCommandId函数代码示例

51自学网 2021-06-01 21:05:53
  C++
这篇教程C++ GetCurrentCommandId函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Cancel

void CControlSocket::Cancel(){	if (GetCurrentCommandId() != Command::none)	{		if (GetCurrentCommandId() == Command::connect)			DoClose(FZ_REPLY_CANCELED);		else			ResetOperation(FZ_REPLY_CANCELED);	}}
开发者ID:RanesJan,项目名称:it340midterm,代码行数:10,


示例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. */SnapshotCopyCurrentSnapshot(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;}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:35,


示例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;}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:35,


示例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;}
开发者ID:gavioto,项目名称:postgres_cluster,代码行数:26,


示例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;}
开发者ID:RingsC,项目名称:postgres,代码行数:39,


示例6: transientrel_startup

/* * transientrel_startup --- executor startup */static voidtransientrel_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);}
开发者ID:qowldi,项目名称:pg,代码行数:29,


示例7: ExecCQMatRelInsert

/* * ExecCQMatViewInsert * * Insert a new row into a CV materialization table */voidExecCQMatRelInsert(ResultRelInfo *ri, TupleTableSlot *slot, EState *estate){	HeapTuple tup = ExecMaterializeSlot(slot);	heap_insert(ri->ri_RelationDesc, tup, GetCurrentCommandId(true), 0, NULL);	ExecInsertCQMatRelIndexTuples(ri, slot, estate);}
开发者ID:NianYue,项目名称:pipelinedb,代码行数:13,


示例8: UpdateActiveSnapshotCommandId

/* * UpdateActiveSnapshotCommandId * * Update the current CID of the active snapshot.  This can only be applied * to a snapshot that is not referenced elsewhere. */voidUpdateActiveSnapshotCommandId(void){	Assert(ActiveSnapshot != NULL);	Assert(ActiveSnapshot->as_snap->active_count == 1);	Assert(ActiveSnapshot->as_snap->regd_count == 0);	ActiveSnapshot->as_snap->curcid = GetCurrentCommandId(false);}
开发者ID:avontd2868,项目名称:postgres,代码行数:15,


示例9: RegisterSmgrInvalidation

/* * RegisterSmgrInvalidation * * As above, but register an smgr invalidation event. */static voidRegisterSmgrInvalidation(RelFileNode rnode){	AddSmgrInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,							   rnode);	/*	 * As above, just in case there is not an associated catalog change.	 */	(void) GetCurrentCommandId(true);}
开发者ID:KMU-embedded,项目名称:mosbench-ext,代码行数:16,


示例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();}
开发者ID:RanesJan,项目名称:it340midterm,代码行数:13,


示例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;}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:13,


示例12: PushUpdatedSnapshot

/* * PushUpdatedSnapshot *		As above, except we set the snapshot's CID to the current CID. */voidPushUpdatedSnapshot(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);}
开发者ID:badalex,项目名称:postgresql-scratchpad,代码行数:18,


示例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);	}}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:49,


示例14: UpdateActiveSnapshotCommandId

/* * UpdateActiveSnapshotCommandId * * Update the current CID of the active snapshot.  This can only be applied * to a snapshot that is not referenced elsewhere. */voidUpdateActiveSnapshotCommandId(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	}
开发者ID:pgresql,项目名称:postgres-xl,代码行数:23,


示例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;		}	}}
开发者ID:bugiii,项目名称:filezilla3ex,代码行数:44,


示例16: GetCurrentCommandId

int CHttpControlSocket::ProcessData(char* p, int len){	int res;	enum Command commandId = GetCurrentCommandId();	switch (commandId)	{	case cmd_transfer:		res = FileTransferParseResponse(p, len);		break;	default:		LogMessage(Debug_Warning, _T("No action for parsing data for command %d"), (int)commandId);		ResetOperation(FZ_REPLY_INTERNALERROR);		res = FZ_REPLY_ERROR;		break;	}	wxASSERT(p || !m_pCurOpData);	return res;}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:20,


示例17: PgPaxosExecutorStart

/* * PgPaxosExecutorStart blocks until the table is ready to read. */static voidPgPaxosExecutorStart(QueryDesc *queryDesc, int eflags){	PlannedStmt *plannedStmt = queryDesc->plannedstmt;	List *rangeTableList = plannedStmt->rtable;	CmdType commandType = queryDesc->operation;	if (IsPgPaxosActive() && HasPaxosTable(rangeTableList))	{		char *sqlQuery = (char *) queryDesc->sourceText;		char *groupId = NULL;		bool topLevel = true;		/* disallow transactions during paxos commands */		PreventTransactionChain(topLevel, "paxos commands");		groupId = DeterminePaxosGroup(rangeTableList);		if (commandType == CMD_INSERT || commandType == CMD_UPDATE ||			commandType == CMD_DELETE)		{			PrepareConsistentWrite(groupId, sqlQuery);		}		else		{			PrepareConsistentRead(groupId);		}		queryDesc->snapshot->curcid = GetCurrentCommandId(false);	}	/* call into the standard executor start, or hook if set */	if (PreviousExecutorStartHook != NULL)	{		PreviousExecutorStartHook(queryDesc, eflags);	}	else	{		standard_ExecutorStart(queryDesc, eflags);	}}
开发者ID:godouxm,项目名称:pg_paxos,代码行数:44,


示例18: simple_table_update

/* * simple_table_update - replace a tuple * * This routine may be used to update a tuple when concurrent updates of * the target tuple are not expected (for example, because we have a lock * on the relation associated with the tuple).  Any failure is reported * via ereport(). */voidsimple_table_update(Relation rel, ItemPointer otid,					TupleTableSlot *slot,					Snapshot snapshot,					bool *update_indexes){	TM_Result	result;	TM_FailureData tmfd;	LockTupleMode lockmode;	result = table_update(rel, otid, slot,						  GetCurrentCommandId(true),						  snapshot, InvalidSnapshot,						  true /* wait for commit */ ,						  &tmfd, &lockmode, update_indexes);	switch (result)	{		case TM_SelfModified:			/* Tuple was already updated in current command? */			elog(ERROR, "tuple already updated by self");			break;		case TM_Ok:			/* done successfully */			break;		case TM_Updated:			elog(ERROR, "tuple concurrently updated");			break;		case TM_Deleted:			elog(ERROR, "tuple concurrently deleted");			break;		default:			elog(ERROR, "unrecognized table_update status: %u", result);			break;	}}
开发者ID:davidfetter,项目名称:postgresql_projects,代码行数:49,


示例19: RegisterRelcacheInvalidation

/* * RegisterRelcacheInvalidation * * As above, but register a relcache invalidation event. */static voidRegisterRelcacheInvalidation(Oid dbId, Oid relId){	AddRelcacheInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,								   dbId, relId);	/*	 * Most of the time, relcache invalidation is associated with system	 * catalog updates, but there are a few cases where it isn't.  Quick hack	 * to ensure that the next CommandCounterIncrement() will think that we	 * need to do CommandEndInvalidationMessages().	 */	(void) GetCurrentCommandId(true);	/*	 * If the relation being invalidated is one of those cached in the	 * relcache init file, mark that we need to zap that file at commit.	 */	if (RelationIdIsInInitFile(relId))		transInvalInfo->RelcacheInitFileInval = true;}
开发者ID:AXLEproject,项目名称:postgres,代码行数:26,


示例20: matrel_heap_update

static boolmatrel_heap_update(Relation relation, ItemPointer otid, HeapTuple tup){	HTSU_Result result;	HeapUpdateFailureData hufd;	LockTupleMode lockmode;	result = heap_update(relation, otid, tup,						 GetCurrentCommandId(true), InvalidSnapshot,						 true /* wait for commit */ ,						 &hufd, &lockmode);	switch (result)	{		case HeapTupleSelfUpdated:			/* Tuple was already updated in current command? */			elog(ERROR, "tuple already updated by self");			break;		case HeapTupleMayBeUpdated:			/* done successfully */			break;		case HeapTupleUpdated:			/*			 * Tuple updated by a concurrent transaction? The only legal case is if the tuple was deleted			 * which can happen if the auto-vacuumer deletes the tuple while we were trying to update it.			 */			if (memcmp(&hufd.ctid, otid, sizeof(ItemPointerData)) == 0)				return false;			elog(ERROR, "tuple concurrently updated");			break;		default:			elog(ERROR, "unrecognized heap_update status: %u", result);			break;	}	return true;}
开发者ID:myechuri,项目名称:pipelinedb,代码行数:39,


示例21: RegisterRelcacheInvalidation

/* * RegisterRelcacheInvalidation * * As above, but register a relcache invalidation event. */static voidRegisterRelcacheInvalidation(Oid dbId, Oid relId){	AddRelcacheInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,								   dbId, relId);	/*	 * Most of the time, relcache invalidation is associated with system	 * catalog updates, but there are a few cases where it isn't.  Quick hack	 * to ensure that the next CommandCounterIncrement() will think that we	 * need to do CommandEndInvalidationMessages().	 */	(void) GetCurrentCommandId(true);	/*	 * If the relation being invalidated is one of those cached in a relcache	 * init file, mark that we need to zap that file at commit. For simplicity	 * invalidations for a specific database always invalidate the shared file	 * as well.  Also zap when we are invalidating whole relcache.	 */	if (relId == InvalidOid || RelationIdIsInInitFile(relId))		transInvalInfo->RelcacheInitFileInval = true;}
开发者ID:MasahikoSawada,项目名称:postgresql,代码行数:28,


示例22: getExtractGridDataReturnValues

struct GridPointDataListIterator * getExtractGridDataReturnValues(FunctionCallInfo fcinfo){    struct PlaceSpecification ps;    Datum placeSpec = PG_GETARG_DATUM(0);    extractPlaceSpecification( & ps, & placeSpec );    GEOSGeom location = NULL;    if ( ! PG_ARGISNULL(1) )    {		bytea * locationRaw = PG_GETARG_BYTEA_P(1);		location = GEOSGeomFromWKB_buf((unsigned char *) VARDATA(locationRaw), VARSIZE(locationRaw) - VARHDRSZ);    }    enum InterpolationType interpolation = (enum InterpolationType) PG_GETARG_INT32(2);    FileId dataId = PG_GETARG_INT64(3);    TransactionId xid = GetTopTransactionId();    CommandId cid = GetCurrentCommandId(true); // Incremented for each function call in the same transaction    // function takes ownership of location parameter    struct GridPointDataListIterator * ret = readPoints(& ps, location, interpolation, dataId, xid, cid);    return ret;}
开发者ID:metno,项目名称:wdb,代码行数:23,


示例23: BufferedWriterInit

/** * @brief Initialize a BufferedWriter */static voidBufferedWriterInit(BufferedWriter *self){	/*	 * Set defaults to unspecified parameters.	 */	if (self->base.max_dup_errors < -1)		self->base.max_dup_errors = DEFAULT_MAX_DUP_ERRORS;	self->base.rel = heap_open(self->base.relid, AccessExclusiveLock);	VerifyTarget(self->base.rel, self->base.max_dup_errors);	self->base.desc = RelationGetDescr(self->base.rel);	SpoolerOpen(&self->spooler, self->base.rel, true, self->base.on_duplicate,				self->base.max_dup_errors, self->base.dup_badfile);	self->base.context = GetPerTupleMemoryContext(self->spooler.estate);	self->bistate = GetBulkInsertState();	self->cid = GetCurrentCommandId(true);	self->base.tchecker = CreateTupleChecker(self->base.desc);	self->base.tchecker->checker = (CheckerTupleProc) CoercionCheckerTuple;}
开发者ID:bwtakacy,项目名称:prev_pg_bulkload_repo,代码行数:27,


示例24: simple_table_delete

/* * simple_table_delete - delete a tuple * * This routine may be used to delete a tuple when concurrent updates of * the target tuple are not expected (for example, because we have a lock * on the relation associated with the tuple).  Any failure is reported * via ereport(). */voidsimple_table_delete(Relation rel, ItemPointer tid, Snapshot snapshot){	TM_Result	result;	TM_FailureData tmfd;	result = table_delete(rel, tid,						  GetCurrentCommandId(true),						  snapshot, InvalidSnapshot,						  true /* wait for commit */ ,						  &tmfd, false /* changingPart */ );	switch (result)	{		case TM_SelfModified:			/* Tuple was already updated in current command? */			elog(ERROR, "tuple already updated by self");			break;		case TM_Ok:			/* done successfully */			break;		case TM_Updated:			elog(ERROR, "tuple concurrently updated");			break;		case TM_Deleted:			elog(ERROR, "tuple concurrently deleted");			break;		default:			elog(ERROR, "unrecognized table_delete status: %u", result);			break;	}}
开发者ID:davidfetter,项目名称:postgresql_projects,代码行数:44,


示例25: UpdateActiveSnapshotCommandId

/* * UpdateActiveSnapshotCommandId * * Update the current CID of the active snapshot.  This can only be applied * to a snapshot that is not referenced elsewhere. */voidUpdateActiveSnapshotCommandId(void){	CommandId	save_curcid,				curcid;	Assert(ActiveSnapshot != NULL);	Assert(ActiveSnapshot->as_snap->active_count == 1);	Assert(ActiveSnapshot->as_snap->regd_count == 0);	/*	 * Don't allow modification of the active snapshot during parallel	 * operation.  We share the snapshot to worker backends at beginning of	 * parallel operation, so any change to snapshot can lead to	 * inconsistencies.  We have other defenses against	 * CommandCounterIncrement, but there are a few places that call this	 * directly, so we put an additional guard here.	 */	save_curcid = ActiveSnapshot->as_snap->curcid;	curcid = GetCurrentCommandId(false);	if (IsInParallelMode() && save_curcid != curcid)		elog(ERROR, "cannot modify commandid in active snapshot during a parallel operation");	ActiveSnapshot->as_snap->curcid = curcid;}
开发者ID:BenjaminYu,项目名称:postgres,代码行数:30,


示例26: RegisterRelcacheInvalidation

/* * RegisterRelcacheInvalidation * * As above, but register a relcache invalidation event. */static voidRegisterRelcacheInvalidation(Oid dbId, Oid relId){	AddRelcacheInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,								   dbId, relId);	/*	 * Most of the time, relcache invalidation is associated with system	 * catalog updates, but there are a few cases where it isn't.  Quick hack	 * to ensure that the next CommandCounterIncrement() will think that we	 * need to do CommandEndInvalidationMessages().	 */	(void) GetCurrentCommandId(true);	/*	 * If the relation being invalidated is one of those cached in the local	 * relcache init file, mark that we need to zap that file at commit.	 * (Note: perhaps it would be better if this code were a bit more	 * decoupled from the knowledge that the init file contains exactly those	 * non-shared rels used in catalog caches.)	 */	if (OidIsValid(dbId) && RelationSupportsSysCache(relId))		transInvalInfo->RelcacheInitFileInval = true;}
开发者ID:lansz,项目名称:postgres,代码行数:29,


示例27: toast_save_datum

/* ---------- * toast_save_datum - * *	Save one single datum into the secondary relation and return *	a Datum reference for it. * ---------- */static Datumtoast_save_datum(Relation rel, Datum value, int options){	Relation	toastrel;	Relation	toastidx;	HeapTuple	toasttup;	TupleDesc	toasttupDesc;	Datum		t_values[3];	bool		t_isnull[3];	CommandId	mycid = GetCurrentCommandId(true);	struct varlena *result;	struct varatt_external toast_pointer;	struct	{		struct varlena hdr;		char		data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */		int32		align_it;	/* ensure struct is aligned well enough */	}			chunk_data;	int32		chunk_size;	int32		chunk_seq = 0;	char	   *data_p;	int32		data_todo;	Pointer		dval = DatumGetPointer(value);	/*	 * Open the toast relation and its index.  We can use the index to check	 * uniqueness of the OID we assign to the toasted item, even though it has	 * additional columns besides OID.	 */	toastrel = heap_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);	toasttupDesc = toastrel->rd_att;	toastidx = index_open(toastrel->rd_rel->reltoastidxid, RowExclusiveLock);	/*	 * Get the data pointer and length, and compute va_rawsize and va_extsize.	 *	 * va_rawsize is the size of the equivalent fully uncompressed datum, so	 * we have to adjust for short headers.	 *	 * va_extsize is the actual size of the data payload in the toast records.	 */	if (VARATT_IS_SHORT(dval))	{		data_p = VARDATA_SHORT(dval);		data_todo = VARSIZE_SHORT(dval) - VARHDRSZ_SHORT;		toast_pointer.va_rawsize = data_todo + VARHDRSZ;		/* as if not short */		toast_pointer.va_extsize = data_todo;	}	else if (VARATT_IS_COMPRESSED(dval))	{		data_p = VARDATA(dval);		data_todo = VARSIZE(dval) - VARHDRSZ;		/* rawsize in a compressed datum is just the size of the payload */		toast_pointer.va_rawsize = VARRAWSIZE_4B_C(dval) + VARHDRSZ;		toast_pointer.va_extsize = data_todo;		/* Assert that the numbers look like it's compressed */		Assert(VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer));	}	else	{		data_p = VARDATA(dval);		data_todo = VARSIZE(dval) - VARHDRSZ;		toast_pointer.va_rawsize = VARSIZE(dval);		toast_pointer.va_extsize = data_todo;	}	/*	 * Insert the correct table OID into the result TOAST pointer.	 *	 * Normally this is the actual OID of the target toast table, but during	 * table-rewriting operations such as CLUSTER, we have to insert the OID	 * of the table's real permanent toast table instead.  rd_toastoid is set	 * if we have to substitute such an OID.	 */	if (OidIsValid(rel->rd_toastoid))		toast_pointer.va_toastrelid = rel->rd_toastoid;	else		toast_pointer.va_toastrelid = RelationGetRelid(toastrel);	/*	 * Choose an unused OID within the toast table for this toast value.	 */	toast_pointer.va_valueid = GetNewOidWithIndex(toastrel,												  RelationGetRelid(toastidx),												  (AttrNumber) 1);	/*	 * Initialize constant parts of the tuple data	 */	t_values[0] = ObjectIdGetDatum(toast_pointer.va_valueid);	t_values[2] = PointerGetDatum(&chunk_data);	t_isnull[0] = false;	t_isnull[1] = false;//.........这里部分代码省略.........
开发者ID:LittleForker,项目名称:postgres,代码行数:101,


示例28: HeapTupleSatisfiesNow

/* * HeapTupleSatisfiesNow *		True iff heap tuple is valid "now". * *	Here, we consider the effects of: *		all committed transactions (as of the current instant) *		previous commands of this transaction * * Note we do _not_ include changes made by the current command.  This * solves the "Halloween problem" wherein an UPDATE might try to re-update * its own output tuples. * * Note: *		Assumes heap tuple is valid. * * The satisfaction of "now" requires the following: * * ((Xmin == my-transaction &&				inserted by the current transaction *	 Cmin < my-command &&					before this command, and *	 (Xmax is null ||						the row has not been deleted, or *	  (Xmax == my-transaction &&			it was deleted by the current transaction *	   Cmax >= my-command)))				but not before this command, * ||										or *	(Xmin is committed &&					the row was inserted by a committed transaction, and *		(Xmax is null ||					the row has not been deleted, or *		 (Xmax == my-transaction &&			the row is being deleted by this transaction *		  Cmax >= my-command) ||			but it's not deleted "yet", or *		 (Xmax != my-transaction &&			the row was deleted by another transaction *		  Xmax is not committed))))			that has not been committed * *		mao says 17 march 1993:  the tests in this routine are correct; *		if you think they're not, you're wrong, and you should think *		about it again.  i know, it happened to me.  we don't need to *		check commit time against the start time of this transaction *		because 2ph locking protects us from doing the wrong thing. *		if you mess around here, you'll break serializability.  the only *		problem with this code is that it does the wrong thing for system *		catalog updates, because the catalogs aren't subject to 2ph, so *		the serializability guarantees we provide don't extend to xacts *		that do catalog accesses.  this is unfortunate, but not critical. */boolHeapTupleSatisfiesNow(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer){	if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))	{		if (tuple->t_infomask & HEAP_XMIN_INVALID)			return false;		if (tuple->t_infomask & HEAP_MOVED_OFF)		{			TransactionId xvac = HeapTupleHeaderGetXvac(tuple);			if (TransactionIdIsCurrentTransactionId(xvac))				return false;			if (!TransactionIdIsInProgress(xvac))			{				if (TransactionIdDidCommit(xvac))				{					SetHintBits(tuple, buffer, HEAP_XMIN_INVALID,								InvalidTransactionId);					return false;				}				SetHintBits(tuple, buffer, HEAP_XMIN_COMMITTED,							InvalidTransactionId);			}		}		else if (tuple->t_infomask & HEAP_MOVED_IN)		{			TransactionId xvac = HeapTupleHeaderGetXvac(tuple);			if (!TransactionIdIsCurrentTransactionId(xvac))			{				if (TransactionIdIsInProgress(xvac))					return false;				if (TransactionIdDidCommit(xvac))					SetHintBits(tuple, buffer, HEAP_XMIN_COMMITTED,								InvalidTransactionId);				else				{					SetHintBits(tuple, buffer, HEAP_XMIN_INVALID,								InvalidTransactionId);					return false;				}			}		}		else if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple)))		{			if (HeapTupleHeaderGetCmin(tuple) >= GetCurrentCommandId(false))				return false;	/* inserted after scan started */			if (tuple->t_infomask & HEAP_XMAX_INVALID)	/* xid invalid */				return true;			if (tuple->t_infomask & HEAP_IS_LOCKED)		/* not deleter */				return true;			Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI));			if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple)))//.........这里部分代码省略.........
开发者ID:Khalefa,项目名称:PostgreSQL_hierarchical,代码行数:101,


示例29: intorel_startup

//.........这里部分代码省略.........		 * collation could not be resolved, so double-check.  (We must check		 * this here because DefineRelation would adopt the type's default		 * collation rather than complaining.)		 */		if (!OidIsValid(col->collOid) &&			type_is_collatable(coltype->typeOid))			ereport(ERROR,					(errcode(ERRCODE_INDETERMINATE_COLLATION),					 errmsg("no collation was derived for column /"%s/" with collatable type %s",							col->colname, format_type_be(coltype->typeOid)),					 errhint("Use the COLLATE clause to set the collation explicitly.")));		create->tableElts = lappend(create->tableElts, col);	}	if (lc != NULL)		ereport(ERROR,				(errcode(ERRCODE_SYNTAX_ERROR),				 errmsg("too many column names were specified")));	/*	 * Actually create the target table	 */	intoRelationId = DefineRelation(create, relkind, InvalidOid);	/*	 * If necessary, create a TOAST table for the target table.  Note that	 * AlterTableCreateToastTable ends with CommandCounterIncrement(), so that	 * the TOAST table will be visible for insertion.	 */	CommandCounterIncrement();	/* parse and validate reloptions for the toast table */	toast_options = transformRelOptions((Datum) 0,										create->options,										"toast",										validnsps,										true, false);	(void) heap_reloptions(RELKIND_TOASTVALUE, toast_options, true);	AlterTableCreateToastTable(intoRelationId, toast_options);	/* Create the "view" part of a materialized view. */	if (is_matview)	{		/* StoreViewQuery scribbles on tree, so make a copy */		Query	   *query = (Query *) copyObject(into->viewQuery);		StoreViewQuery(intoRelationId, query, false);		CommandCounterIncrement();	}	/*	 * Finally we can open the target table	 */	intoRelationDesc = heap_open(intoRelationId, AccessExclusiveLock);	/*	 * Check INSERT permission on the constructed table.	 *	 * XXX: It would arguably make sense to skip this check if into->skipData	 * is true.	 */	rte = makeNode(RangeTblEntry);	rte->rtekind = RTE_RELATION;	rte->relid = intoRelationId;	rte->relkind = relkind;	rte->requiredPerms = ACL_INSERT;	for (attnum = 1; attnum <= intoRelationDesc->rd_att->natts; attnum++)		rte->modifiedCols = bms_add_member(rte->modifiedCols,								attnum - FirstLowInvalidHeapAttributeNumber);	ExecCheckRTPerms(list_make1(rte), true);	/*	 * Tentatively mark the target as populated, if it's a matview and we're	 * going to fill it; otherwise, no change needed.	 */	if (is_matview && !into->skipData)		SetMatViewPopulatedState(intoRelationDesc, true);	/*	 * Fill private fields of myState for use by later routines	 */	myState->rel = intoRelationDesc;	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 |		(XLogIsNeeded() ? 0 : HEAP_INSERT_SKIP_WAL);	myState->bistate = GetBulkInsertState();	/* Not using WAL requires smgr_targblock be initially invalid */	Assert(RelationGetTargetBlock(intoRelationDesc) == InvalidBlockNumber);}
开发者ID:BioBD,项目名称:Hypothetical_Indexes,代码行数:101,



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


C++ GetCurrentContext函数代码示例
C++ GetCurrent函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。