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

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

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

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

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

示例1: CheckInMemConstraintsPgType

/* * CheckInMemConstraintsPgType * 		Check uniqueness constraints for pg_type in-memory tuples upon insert */static voidCheckInMemConstraintsPgType(InMemHeapRelation relation, HeapTuple newTuple){	Assert(NULL != newTuple);	Assert(NULL != relation);	Assert(NULL != relation->rel);	TupleDesc tupleDesc = relation->rel->rd_att;	Oid relnamespaceNew = DatumGetObjectId(tuple_getattr(newTuple, tupleDesc, Anum_pg_type_typnamespace));	char *typnameNew    = DatumGetCString(tuple_getattr(newTuple, tupleDesc, Anum_pg_type_typname));	for (int i = 0; i < relation->tupsize; i++)	{		HeapTuple tuple = relation->tuples[i].tuple;		Assert(NULL != tuple);		insist_log(HeapTupleGetOid(tuple) != HeapTupleGetOid(newTuple),					"in-memory tuple with Oid = %d already exists in pg_type.", HeapTupleGetOid(tuple));		Oid relnamespace = DatumGetObjectId(tuple_getattr(tuple, tupleDesc, Anum_pg_type_typnamespace));		char *typname    = DatumGetCString(tuple_getattr(tuple, tupleDesc, Anum_pg_type_typname));		size_t typnameLen = strlen(typname);		insist_log(relnamespace != relnamespaceNew ||				   typnameLen != strlen(typnameNew) ||				   0 != strncmp(typname, typnameNew, typnameLen),				"in-memory tuple with typname = %s and typnamespace = %d already exists in pg_type.", typname, relnamespace);	}}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:33,


示例2: GpPersistentTablespaceNode_GetValues

void GpPersistentTablespaceNode_GetValues(	Datum							*values,	Oid 							*filespaceOid,	Oid 							*tablespaceOid,	PersistentFileSysState			*persistentState,	int64							*createMirrorDataLossTrackingSessionNum,	MirroredObjectExistenceState	*mirrorExistenceState,	int32							*reserved,	TransactionId					*parentXid,	int64							*persistentSerialNum){    *filespaceOid = DatumGetObjectId(values[Anum_gp_persistent_tablespace_node_filespace_oid - 1]);    *tablespaceOid = DatumGetObjectId(values[Anum_gp_persistent_tablespace_node_tablespace_oid - 1]);    *persistentState = DatumGetInt16(values[Anum_gp_persistent_tablespace_node_persistent_state - 1]);    *createMirrorDataLossTrackingSessionNum = DatumGetInt64(values[Anum_gp_persistent_tablespace_node_create_mirror_data_loss_tracking_session_num - 1]);    *mirrorExistenceState = DatumGetInt16(values[Anum_gp_persistent_tablespace_node_mirror_existence_state - 1]);	*reserved = DatumGetInt32(values[Anum_gp_persistent_tablespace_node_reserved - 1]);	*parentXid = (TransactionId)DatumGetInt32(values[Anum_gp_persistent_tablespace_node_parent_xid - 1]);    *persistentSerialNum = DatumGetInt64(values[Anum_gp_persistent_tablespace_node_persistent_serial_num - 1]);}
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:28,


示例3: GpPersistentTablespaceNode_GetValues

void GpPersistentTablespaceNode_GetValues(	Datum							*values,	Oid 							*filespaceOid,	Oid 							*tablespaceOid,	PersistentFileSysState			*persistentState,	int32							*reserved,	TransactionId					*parentXid,	int64							*persistentSerialNum,	ItemPointerData 				*previousFreeTid,	bool							*sharedStorage){    *filespaceOid = DatumGetObjectId(values[Anum_gp_persistent_tablespace_node_filespace_oid - 1]);    *tablespaceOid = DatumGetObjectId(values[Anum_gp_persistent_tablespace_node_tablespace_oid - 1]);    *persistentState = DatumGetInt16(values[Anum_gp_persistent_tablespace_node_persistent_state - 1]);	*reserved = DatumGetInt32(values[Anum_gp_persistent_tablespace_node_reserved - 1]);	*parentXid = (TransactionId)DatumGetInt32(values[Anum_gp_persistent_tablespace_node_parent_xid - 1]);    *persistentSerialNum = DatumGetInt64(values[Anum_gp_persistent_tablespace_node_persistent_serial_num - 1]);    *previousFreeTid = *((ItemPointer) DatumGetPointer(values[Anum_gp_persistent_tablespace_node_previous_free_tid - 1]));	*sharedStorage = true;}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:29,


示例4: CheckInMemConstraintsPgNamespace

/* * CheckInMemConstraintsPgNamespace * 		Check uniqueness constraints for pg_namespace in-memory tuples upon insert */static voidCheckInMemConstraintsPgNamespace(InMemHeapRelation relation, HeapTuple newTuple){	Assert(NULL != newTuple);	Assert(NULL != relation); 	Assert(NULL != relation->rel);	TupleDesc tupleDesc = relation->rel->rd_att;	Oid nspdboidNew     = DatumGetObjectId(tuple_getattr(newTuple, tupleDesc, Anum_pg_namespace_nspdboid));	char *nspnameNew    = DatumGetCString(tuple_getattr(newTuple, tupleDesc, Anum_pg_namespace_nspname));	for (int i = 0; i < relation->tupsize; i++)	{		HeapTuple tuple = relation->tuples[i].tuple;		Assert(NULL != tuple);		insist_log(HeapTupleGetOid(tuple) != HeapTupleGetOid(newTuple), 			"in-memory tuple with Oid = %d already exists in pg_namespace.", HeapTupleGetOid(tuple));		Oid nspdboid  = DatumGetObjectId(tuple_getattr(tuple, tupleDesc, Anum_pg_namespace_nspdboid));		char *nspname = DatumGetCString(tuple_getattr(tuple, tupleDesc, Anum_pg_namespace_nspname));		size_t nspnameLen = strlen(nspname);		insist_log(nspdboid != nspdboidNew ||				   nspnameLen != strlen(nspnameNew) ||				   0 != strncmp(nspname, nspnameNew, nspnameLen),			"in-memory tuple with nspname = %s and nspdboid = %d already exists in pg_namespace.", nspname, nspdboid);	}}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:33,


示例5: GpPersistentRelationNode_GetValues

void GpPersistentRelationNode_GetValues(	Datum									*values,	Oid 									*tablespaceOid,	Oid 									*databaseOid,	Oid 									*relfilenodeOid,	int32									*segmentFileNum,	PersistentFileSysRelStorageMgr			*relationStorageManager,	PersistentFileSysState					*persistentState,	int64									*createMirrorDataLossTrackingSessionNum,	MirroredObjectExistenceState			*mirrorExistenceState,	MirroredRelDataSynchronizationState 	*mirrorDataSynchronizationState,	bool									*mirrorBufpoolMarkedForScanIncrementalResync,	int64									*mirrorBufpoolResyncChangedPageCount,	XLogRecPtr								*mirrorBufpoolResyncCkptLoc,	BlockNumber								*mirrorBufpoolResyncCkptBlockNum,	int64									*mirrorAppendOnlyLossEof,	int64									*mirrorAppendOnlyNewEof,	PersistentFileSysRelBufpoolKind 		*relBufpoolKind,	TransactionId							*parentXid,	int64									*persistentSerialNum){	*tablespaceOid = DatumGetObjectId(values[Anum_gp_persistent_relation_node_tablespace_oid - 1]);	*databaseOid = DatumGetObjectId(values[Anum_gp_persistent_relation_node_database_oid - 1]);	*relfilenodeOid = DatumGetObjectId(values[Anum_gp_persistent_relation_node_relfilenode_oid - 1]);	*segmentFileNum = DatumGetInt32(values[Anum_gp_persistent_relation_node_segment_file_num - 1]);	*relationStorageManager = (PersistentFileSysRelStorageMgr)DatumGetInt16(values[Anum_gp_persistent_relation_node_relation_storage_manager - 1]);	*persistentState = (PersistentFileSysState)DatumGetInt16(values[Anum_gp_persistent_relation_node_persistent_state - 1]);	*createMirrorDataLossTrackingSessionNum = DatumGetInt64(values[Anum_gp_persistent_relation_node_create_mirror_data_loss_tracking_session_num - 1]);	*mirrorExistenceState = (MirroredObjectExistenceState)DatumGetInt16(values[Anum_gp_persistent_relation_node_mirror_existence_state - 1]);	*mirrorDataSynchronizationState = (MirroredRelDataSynchronizationState)DatumGetInt16(values[Anum_gp_persistent_relation_node_mirror_data_synchronization_state - 1]);	*mirrorBufpoolMarkedForScanIncrementalResync = DatumGetBool(values[Anum_gp_persistent_relation_node_mirror_bufpool_marked_for_scan_incremental_resync - 1]);	*mirrorBufpoolResyncChangedPageCount = DatumGetInt64(values[Anum_gp_persistent_relation_node_mirror_bufpool_resync_changed_page_count - 1]);	*mirrorBufpoolResyncCkptLoc = *((XLogRecPtr*) DatumGetPointer(values[Anum_gp_persistent_relation_node_mirror_bufpool_resync_ckpt_loc - 1]));	*mirrorBufpoolResyncCkptBlockNum = (BlockNumber)DatumGetInt32(values[Anum_gp_persistent_relation_node_mirror_bufpool_resync_ckpt_block_num - 1]);	*mirrorAppendOnlyLossEof = DatumGetInt64(values[Anum_gp_persistent_relation_node_mirror_append_only_loss_eof - 1]);	*mirrorAppendOnlyNewEof = DatumGetInt64(values[Anum_gp_persistent_relation_node_mirror_append_only_new_eof - 1]);	*relBufpoolKind = (PersistentFileSysRelBufpoolKind)DatumGetInt32(values[Anum_gp_persistent_relation_node_relation_bufpool_kind - 1]);	*parentXid = (TransactionId)DatumGetInt32(values[Anum_gp_persistent_relation_node_parent_xid - 1]);	*persistentSerialNum = DatumGetInt64(values[Anum_gp_persistent_relation_node_persistent_serial_num - 1]);}
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:58,


示例6: enum_elem_cmp

/* qsort comparison function for Datums that are OIDs */static intenum_elem_cmp(const void *left, const void *right){	Oid			l = DatumGetObjectId(*((const Datum *) left));	Oid			r = DatumGetObjectId(*((const Datum *) right));	if (l < r)		return -1;	if (l > r)		return 1;	return 0;}
开发者ID:Aldizh,项目名称:buffer_manager,代码行数:13,


示例7: btoidfastcmp

static intbtoidfastcmp(Datum x, Datum y, SortSupport ssup){	Oid			a = DatumGetObjectId(x);	Oid			b = DatumGetObjectId(y);	if (a > b)		return 1;	else if (a == b)		return 0;	else		return -1;}
开发者ID:ASchurman,项目名称:BufStrat,代码行数:13,


示例8: btoidfastcmp

static intbtoidfastcmp(Datum x, Datum y, SortSupport ssup){	Oid			a = DatumGetObjectId(x);	Oid			b = DatumGetObjectId(y);	if (a > b)		return A_GREATER_THAN_B;	else if (a == b)		return 0;	else		return A_LESS_THAN_B;}
开发者ID:winlibs,项目名称:postgresql,代码行数:13,


示例9: regnamespacein

/* * regnamespacein		- converts "nspname" to namespace OID * * We also accept a numeric OID, for symmetry with the output routine. * * '-' signifies unknown (OID 0).  In all other cases, the input must * match an existing pg_namespace entry. */Datumregnamespacein(PG_FUNCTION_ARGS){	char	   *nsp_name_or_oid = PG_GETARG_CSTRING(0);	Oid			result = InvalidOid;	/* '-' ? */	if (strcmp(nsp_name_or_oid, "-") == 0)		PG_RETURN_OID(InvalidOid);	/* Numeric OID? */	if (nsp_name_or_oid[0] >= '0' &&		nsp_name_or_oid[0] <= '9' &&		strspn(nsp_name_or_oid, "0123456789") == strlen(nsp_name_or_oid))	{		result = DatumGetObjectId(DirectFunctionCall1(oidin,										  CStringGetDatum(nsp_name_or_oid)));		PG_RETURN_OID(result);	}	/* Normal case: see if the name matches any pg_namespace entry. */	result = get_namespace_oid(nsp_name_or_oid, false);	PG_RETURN_OID(result);}
开发者ID:Distrotech,项目名称:postgresql,代码行数:33,


示例10: getoid

static Oidgetoid(HeapTuple tuple, TupleDesc desc, int column){    bool	isnull;    Datum	datum = SPI_getbinval(tuple, desc, column, &isnull);    return isnull ? InvalidOid : DatumGetObjectId(datum);}
开发者ID:dvarrazzo,项目名称:pg_reorg,代码行数:7,


示例11: sepgsql_relation_setattr_extra

/* * sepgsql_relation_setattr_extra * * It checks permission of the relation being referenced by extra attributes, * such as pg_index entries. Like core PostgreSQL, sepgsql also does not deal * with such entries as individual "objects", thus, modification of these * entries shall be considered as setting an attribute of the underlying * relation. */static voidsepgsql_relation_setattr_extra(Relation catalog,							   Oid catindex_id,							   Oid extra_oid,							   AttrNumber anum_relation_id,							   AttrNumber anum_extra_id){	ScanKeyData	skey;	SysScanDesc	sscan;	HeapTuple	tuple;	Datum		datum;	bool		isnull;	ScanKeyInit(&skey, anum_extra_id,				BTEqualStrategyNumber, F_OIDEQ,				ObjectIdGetDatum(extra_oid));	sscan = systable_beginscan(catalog, catindex_id, true,							   SnapshotSelf, 1, &skey);	tuple = systable_getnext(sscan);	if (!HeapTupleIsValid(tuple))		elog(ERROR, "catalog lookup failed for object %u in catalog /"%s/"",			 extra_oid, RelationGetRelationName(catalog));	datum = heap_getattr(tuple, anum_relation_id,						 RelationGetDescr(catalog), &isnull);	Assert(!isnull);	sepgsql_relation_setattr(DatumGetObjectId(datum));	systable_endscan(sscan);}
开发者ID:bwright,项目名称:postgres,代码行数:41,


示例12: getIntOid

OidgetIntOid(){    Oid		out;    int		ret;    bool	isnull;    bool	do_pop = false;    do_pop = _SPI_conn();    /*     * Get OID of our internal data type. This is necessary because record_in and     * record_out need it.     */    if ( (ret = SPI_execute("SELECT 'variant._variant'::regtype::oid", true, 1)) != SPI_OK_SELECT )        elog( ERROR, "SPI_execute returned %s", SPI_result_code_string(ret));    /* Don't need to copy the tuple because Oid is pass by value */    out = DatumGetObjectId( heap_getattr(SPI_tuptable->vals[0], 1, SPI_tuptable->tupdesc, &isnull) );    /* Remember this frees everything palloc'd since our connect/push call */    _SPI_disc(do_pop);    return out;}
开发者ID:decibel,项目名称:variant,代码行数:25,


示例13: regdictionaryin

/* * regdictionaryin		- converts "tsdictionaryname" to tsdictionary OID * * We also accept a numeric OID, for symmetry with the output routine. * * '-' signifies unknown (OID 0).  In all other cases, the input must * match an existing pg_ts_dict entry. * * This function is not needed in bootstrap mode, so we don't worry about * making it work then. */Datumregdictionaryin(PG_FUNCTION_ARGS){	char	   *dict_name_or_oid = PG_GETARG_CSTRING(0);	Oid			result;	List	   *names;	/* '-' ? */	if (strcmp(dict_name_or_oid, "-") == 0)		PG_RETURN_OID(InvalidOid);	/* Numeric OID? */	if (dict_name_or_oid[0] >= '0' &&		dict_name_or_oid[0] <= '9' &&		strspn(dict_name_or_oid, "0123456789") == strlen(dict_name_or_oid))	{		result = DatumGetObjectId(DirectFunctionCall1(oidin,										 CStringGetDatum(dict_name_or_oid)));		PG_RETURN_OID(result);	}	/*	 * Normal case: parse the name into components and see if it matches any	 * pg_ts_dict entries in the current search path.	 */	names = stringToQualifiedNameList(dict_name_or_oid);	result = get_ts_dict_oid(names, false);	PG_RETURN_OID(result);}
开发者ID:WiserTogether,项目名称:postgres,代码行数:42,


示例14: tsa_headline_byname

/* headline(text, text, tsquery [,text]) */Datumtsa_headline_byname(PG_FUNCTION_ARGS){	Datum		arg0 = PG_GETARG_DATUM(0);	Datum		arg1 = PG_GETARG_DATUM(1);	Datum		arg2 = PG_GETARG_DATUM(2);	Datum		result;	Oid			config_oid;	/* first parameter has to be converted to oid */	config_oid = DatumGetObjectId(DirectFunctionCall1(regconfigin,										DirectFunctionCall1(textout, arg0)));	if (PG_NARGS() == 3)		result = DirectFunctionCall3(ts_headline_byid,								   ObjectIdGetDatum(config_oid), arg1, arg2);	else	{		Datum		arg3 = PG_GETARG_DATUM(3);		result = DirectFunctionCall4(ts_headline_byid_opt,									 ObjectIdGetDatum(config_oid),									 arg1, arg2, arg3);	}	return result;}
开发者ID:50wu,项目名称:gpdb,代码行数:28,


示例15: type_is_domain

bool type_is_domain(char *type_name, Oid *base_type) {    bool       rc;    StringInfo query;    SPI_connect();    query = makeStringInfo();    appendStringInfo(query, "SELECT typtype = 'd', typbasetype FROM pg_type WHERE typname = %s", TextDatumGetCString(DirectFunctionCall1(quote_literal, CStringGetTextDatum(type_name))));    if (SPI_execute(query->data, true, 1) != SPI_OK_SELECT)        elog(ERROR, "Problem determing if %s is a domain with query: %s", type_name, query->data);    if (SPI_processed == 0) {        rc = false;    } else {        bool  isnull;        Datum d;        d  = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull);        rc = isnull || DatumGetBool(d);        d = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 2, &isnull);        *base_type = isnull ? InvalidOid : DatumGetObjectId(d);    }    SPI_finish();    return rc;}
开发者ID:zombodb,项目名称:zombodb,代码行数:28,


示例16: init_delete_hstore_text

static void init_delete_hstore_text(lua_State *L, const char* hstore_schema){    luaL_Buffer b;    const char *funcname;    if (OidIsValid(delete_hstore_text_oid))return;    luaL_buffinit(L, &b);    if (hstore_schema == NULL){        luaL_addstring(&b, "delete(hstore,text)");    }else{        luaL_addstring(&b, hstore_schema);        luaL_addstring(&b, ".delete(");        luaL_addstring(&b, hstore_schema);        luaL_addstring(&b, ".hstore,text)");    }    luaL_pushresult(&b);    funcname = lua_tostring(L, -1);    delete_hstore_text_oid = DatumGetObjectId(DirectFunctionCall1(regprocedurein, CStringGetDatum(funcname)));    lua_pop(L,1);    if (!OidIsValid(delete_hstore_text_oid)){        luaL_error(L,"failed to register delete(hstore,text)");    }}
开发者ID:eugwne,项目名称:pllua_unstable,代码行数:28,


示例17: init_dict

voidinit_dict(Oid id, DictInfo * dict){	Oid			arg[1];	bool		isnull;	Datum		pars[1];	int			stat;	void	   *plan;	char		buf[1024];	char	   *nsp = get_namespace(TSNSP_FunctionOid);	arg[0] = OIDOID;	pars[0] = ObjectIdGetDatum(id);	memset(dict, 0, sizeof(DictInfo));	SPI_connect();	sprintf(buf, "select dict_init, dict_initoption, dict_lexize from %s.pg_ts_dict where oid = $1", nsp);	pfree(nsp);	plan = SPI_prepare(buf, 1, arg);	if (!plan)		ts_error(ERROR, "SPI_prepare() failed");	stat = SPI_execp(plan, pars, " ", 1);	if (stat < 0)		ts_error(ERROR, "SPI_execp return %d", stat);	if (SPI_processed > 0)	{		Datum		opt;		Oid			oid = InvalidOid;		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));		if (!(isnull || oid == InvalidOid))		{			opt = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 2, &isnull);			dict->dictionary = (void *) DatumGetPointer(OidFunctionCall1(oid, opt));		}		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 3, &isnull));		if (isnull || oid == InvalidOid)			ts_error(ERROR, "Null dict_lexize for dictonary %d", id);		fmgr_info_cxt(oid, &(dict->lexize_info), TopMemoryContext);		dict->dict_id = id;	}	else		ts_error(ERROR, "No dictionary with id %d", id);	SPI_freeplan(plan);	SPI_finish();}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:47,


示例18: init_prs

voidinit_prs(Oid id, WParserInfo * prs){	Oid			arg[1];	bool		isnull;	Datum		pars[1];	int			stat;	void	   *plan;	char		buf[1024],			   *nsp;	arg[0] = OIDOID;	pars[0] = ObjectIdGetDatum(id);	memset(prs, 0, sizeof(WParserInfo));	SPI_connect();	nsp = get_namespace(TSNSP_FunctionOid);	sprintf(buf, "select prs_start, prs_nexttoken, prs_end, prs_lextype, prs_headline from %s.pg_ts_parser where oid = $1", nsp);	pfree(nsp);	plan = SPI_prepare(buf, 1, arg);	if (!plan)		ts_error(ERROR, "SPI_prepare() failed");	stat = SPI_execp(plan, pars, " ", 1);	if (stat < 0)		ts_error(ERROR, "SPI_execp return %d", stat);	if (SPI_processed > 0)	{		Oid			oid = InvalidOid;		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));		fmgr_info_cxt(oid, &(prs->start_info), TopMemoryContext);		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 2, &isnull));		fmgr_info_cxt(oid, &(prs->getlexeme_info), TopMemoryContext);		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 3, &isnull));		fmgr_info_cxt(oid, &(prs->end_info), TopMemoryContext);		prs->lextype = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 4, &isnull));		oid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 5, &isnull));		fmgr_info_cxt(oid, &(prs->headline_info), TopMemoryContext);		prs->prs_id = id;	}	else		ts_error(ERROR, "No parser with id %d", id);	SPI_freeplan(plan);	SPI_finish();}
开发者ID:shubham2094,项目名称:postgresql_8.2,代码行数:46,


示例19: InMemHeap_Insert

/* * insert a tuple into in-memory heap table. */voidInMemHeap_Insert(InMemHeapRelation relation, HeapTuple tup, int contentid){    InMemHeapTuple inmemtup;    MemoryContext oldmem = CurrentMemoryContext;    Assert(NULL != relation && NULL != tup);    Assert(GP_ROLE_EXECUTE == Gp_role || -1 == contentid);    Assert(NULL != relation && NULL != tup);        CurrentMemoryContext = relation->memcxt;    if (relation->tupsize >= relation->tupmaxsize)    {        Assert(NULL != relation->tuples);        relation->tuples = repalloc(relation->tuples,                sizeof(InMemHeapTupleData) * relation->tupmaxsize * 2);        relation->tupmaxsize *= 2;    }    inmemtup = &relation->tuples[relation->tupsize];    inmemtup->contentid = contentid;    inmemtup->flags = INMEM_HEAP_TUPLE_DISPATCHED;    inmemtup->tuple = heaptuple_copy_to(tup, NULL, NULL);    Assert(inmemtup->tuple != NULL);    if (relation->hashIndex)    {        Oid key;        bool isNull, found;        key = DatumGetObjectId(                heap_getattr(tup, relation->keyAttrno,                        RelationGetDescr(relation->rel), &isNull));        Insist(!isNull && "index key cannot be null");        MemHeapHashIndexEntry *entry;        entry = (MemHeapHashIndexEntry *) hash_search(relation->hashIndex, &key,                HASH_ENTER, &found);        if (!found)        {            entry->key = key;            entry->values = NIL;        }        entry->values = lappend_int(entry->values, relation->tupsize);        elog(DEBUG1, "add index %d key %d relation %s", relation->tupsize, key, relation->relname);    }    ++relation->tupsize;    CurrentMemoryContext = oldmem;}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:60,


示例20: minmax_get_strategy_procinfo

/* * Cache and return the procedure for the given strategy. */FmgrInfo *minmax_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype,							 uint16 strategynum){	MinmaxOpaque *opaque;	Assert(strategynum >= 1 &&		   strategynum <= BTMaxStrategyNumber);	opaque = (MinmaxOpaque *) bdesc->bd_info[attno - 1]->oi_opaque;	/*	 * We cache the procedures for the previous subtype in the opaque struct,	 * to avoid repetitive syscache lookups.  If the subtype changed,	 * invalidate all the cached entries.	 */	if (opaque->cached_subtype != subtype)	{		uint16		i;		for (i = 1; i <= BTMaxStrategyNumber; i++)			opaque->strategy_procinfos[i - 1].fn_oid = InvalidOid;		opaque->cached_subtype = subtype;	}	if (opaque->strategy_procinfos[strategynum - 1].fn_oid == InvalidOid)	{		Form_pg_attribute attr;		HeapTuple	tuple;		Oid			opfamily,					oprid;		bool		isNull;		opfamily = bdesc->bd_index->rd_opfamily[attno - 1];		attr = bdesc->bd_tupdesc->attrs[attno - 1];		tuple = SearchSysCache4(AMOPSTRATEGY, ObjectIdGetDatum(opfamily),								ObjectIdGetDatum(attr->atttypid),								ObjectIdGetDatum(subtype),								Int16GetDatum(strategynum));		if (!HeapTupleIsValid(tuple))			elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",				 strategynum, attr->atttypid, subtype, opfamily);		oprid = DatumGetObjectId(SysCacheGetAttr(AMOPSTRATEGY, tuple,												 Anum_pg_amop_amopopr, &isNull));		ReleaseSysCache(tuple);		Assert(!isNull && RegProcedureIsValid(oprid));		fmgr_info_cxt(get_opcode(oprid),					  &opaque->strategy_procinfos[strategynum - 1],					  bdesc->bd_context);	}	return &opaque->strategy_procinfos[strategynum - 1];}
开发者ID:RelentlessMike,项目名称:postgres,代码行数:59,


示例21: build_dummy_tuple

/* * build_dummy_tuple *		Generate a palloc'd HeapTuple that contains the specified key *		columns, and NULLs for other columns. * * This is used to store the keys for negative cache entries and CatCList * entries, which don't have real tuples associated with them. */static HeapTuplebuild_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys){	HeapTuple	ntp;	TupleDesc	tupDesc = cache->cc_tupdesc;	Datum	   *values;	char	   *nulls;	Oid			tupOid = InvalidOid;	NameData	tempNames[4];	int			i;	values = (Datum *) palloc(tupDesc->natts * sizeof(Datum));	nulls = (char *) palloc(tupDesc->natts * sizeof(char));	memset(values, 0, tupDesc->natts * sizeof(Datum));	memset(nulls, 'n', tupDesc->natts * sizeof(char));	for (i = 0; i < nkeys; i++)	{		int			attindex = cache->cc_key[i];		Datum		keyval = skeys[i].sk_argument;		if (attindex > 0)		{			/*			 * Here we must be careful in case the caller passed a C			 * string where a NAME is wanted: convert the given argument			 * to a correctly padded NAME.	Otherwise the memcpy() done in			 * heap_formtuple could fall off the end of memory.			 */			if (cache->cc_isname[i])			{				Name		newval = &tempNames[i];				namestrcpy(newval, DatumGetCString(keyval));				keyval = NameGetDatum(newval);			}			values[attindex - 1] = keyval;			nulls[attindex - 1] = ' ';		}		else		{			Assert(attindex == ObjectIdAttributeNumber);			tupOid = DatumGetObjectId(keyval);		}	}	ntp = heap_formtuple(tupDesc, values, nulls);	if (tupOid != InvalidOid)		HeapTupleSetOid(ntp, tupOid);	pfree(values);	pfree(nulls);	return ntp;}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:64,


示例22: CrossCheckTuple

/* * This function performs checks for certain system tables to validate tuple * fetched from table has the key, using which it was fetched from index. */static voidCrossCheckTuple(int cacheId,		Datum key1,		Datum key2,		Datum key3,		Datum key4,		HeapTuple tuple){	Form_pg_class rd_rel;	switch (cacheId)	{		case RELOID:			if (HeapTupleGetOid(tuple) != DatumGetObjectId(key1))			{				elog(ERROR, "pg_class_oid_index is broken, oid=%d is pointing to tuple with oid=%d (xmin:%u xmax:%u)",					DatumGetObjectId(key1), HeapTupleGetOid(tuple),					HeapTupleHeaderGetXmin((tuple)->t_data),					HeapTupleHeaderGetXmax((tuple)->t_data));			}			break;		case RELNAMENSP:			rd_rel = (Form_pg_class) GETSTRUCT(tuple);			if (strncmp(rd_rel->relname.data, DatumGetCString(key1), NAMEDATALEN) != 0)			{				elog(ERROR, "pg_class_relname_nsp_index is broken, intended tuple with name /"%s/" fetched /"%s/""					" (xmin:%u xmax:%u)",					DatumGetCString(key1), rd_rel->relname.data,					HeapTupleHeaderGetXmin((tuple)->t_data),					HeapTupleHeaderGetXmax((tuple)->t_data));			}			break;		case TYPEOID:			if (HeapTupleGetOid(tuple) != DatumGetObjectId(key1))			{				elog(ERROR, "pg_type_oid_index is broken, oid=%d is pointing to tuple with oid=%d (xmin:%u xmax:%u)",					DatumGetObjectId(key1), HeapTupleGetOid(tuple),					HeapTupleHeaderGetXmin((tuple)->t_data),					HeapTupleHeaderGetXmax((tuple)->t_data));			}			break;	}}
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:47,


示例23: regoperatorin

/* * regoperatorin		- converts "oprname(args)" to operator OID * * We also accept a numeric OID, for symmetry with the output routine. * * '0' signifies unknown (OID 0).  In all other cases, the input must * match an existing pg_operator entry. */Datumregoperatorin(PG_FUNCTION_ARGS){	char	   *opr_name_or_oid = PG_GETARG_CSTRING(0);	Oid			result;	List	   *names;	int			nargs;	Oid			argtypes[FUNC_MAX_ARGS];	/* '0' ? */	if (strcmp(opr_name_or_oid, "0") == 0)		PG_RETURN_OID(InvalidOid);	/* Numeric OID? */	if (opr_name_or_oid[0] >= '0' &&		opr_name_or_oid[0] <= '9' &&		strspn(opr_name_or_oid, "0123456789") == strlen(opr_name_or_oid))	{		result = DatumGetObjectId(DirectFunctionCall1(oidin,										  CStringGetDatum(opr_name_or_oid)));		PG_RETURN_OID(result);	}	/*	 * Else it's a name and arguments.  Parse the name and arguments, look up	 * potential matches in the current namespace search list, and scan to see	 * which one exactly matches the given argument types.	(There will not be	 * more than one match.)	 *	 * XXX at present, this code will not work in bootstrap mode, hence this	 * datatype cannot be used for any system column that needs to receive	 * data during bootstrap.	 */	parseNameAndArgTypes(opr_name_or_oid, "regoperatorin", true,						 &names, &nargs, argtypes);	if (nargs == 1)		ereport(ERROR,				(errcode(ERRCODE_UNDEFINED_PARAMETER),				 errmsg("missing argument"),				 errhint("Use NONE to denote the missing argument of a unary operator.")));	if (nargs != 2)		ereport(ERROR,				(errcode(ERRCODE_TOO_MANY_ARGUMENTS),				 errmsg("too many arguments"),				 errhint("Provide two argument types for operator.")));	result = OpernameGetOprid(names, argtypes[0], argtypes[1]);	if (!OidIsValid(result))		ereport(ERROR,				(errcode(ERRCODE_UNDEFINED_FUNCTION),				 errmsg("operator does not exist: %s", opr_name_or_oid)));	PG_RETURN_OID(result);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:63,


示例24: GpPersistentFilespaceNode_GetValues

void GpPersistentFilespaceNode_GetValues(	Datum							*values,	Oid 							*filespaceOid,	int16							*dbId1,	char							locationBlankPadded1[FilespaceLocationBlankPaddedWithNullTermLen],	int16							*dbId2,	char							locationBlankPadded2[FilespaceLocationBlankPaddedWithNullTermLen],	PersistentFileSysState			*persistentState,	int64							*createMirrorDataLossTrackingSessionNum,	MirroredObjectExistenceState	*mirrorExistenceState,	int32							*reserved,	TransactionId					*parentXid,	int64							*persistentSerialNum){	char *locationPtr;	int locationLen;    *filespaceOid = DatumGetObjectId(values[Anum_gp_persistent_filespace_node_filespace_oid - 1]);    *dbId1 = DatumGetInt16(values[Anum_gp_persistent_filespace_node_db_id_1 - 1]);	locationPtr = TextDatumGetCString(values[Anum_gp_persistent_filespace_node_location_1 - 1]);;	locationLen = strlen(locationPtr);	if (locationLen != FilespaceLocationBlankPaddedWithNullTermLen - 1)		elog(ERROR, "Expected filespace location 1 to be %d characters and found %d",			 FilespaceLocationBlankPaddedWithNullTermLen - 1,			 locationLen);			 	memcpy(locationBlankPadded1, locationPtr, FilespaceLocationBlankPaddedWithNullTermLen);    *dbId2 = DatumGetInt16(values[Anum_gp_persistent_filespace_node_db_id_2 - 1]);	locationPtr = TextDatumGetCString(values[Anum_gp_persistent_filespace_node_location_2 - 1]);	locationLen = strlen(locationPtr);	if (locationLen != FilespaceLocationBlankPaddedWithNullTermLen - 1)		elog(ERROR, "Expected filespace location 2 to be %d characters and found %d",			 FilespaceLocationBlankPaddedWithNullTermLen - 1,			 locationLen);			 	memcpy(locationBlankPadded2, locationPtr, FilespaceLocationBlankPaddedWithNullTermLen);    *persistentState = DatumGetInt16(values[Anum_gp_persistent_filespace_node_persistent_state - 1]);    *createMirrorDataLossTrackingSessionNum = DatumGetInt64(values[Anum_gp_persistent_filespace_node_create_mirror_data_loss_tracking_session_num - 1]);    *mirrorExistenceState = DatumGetInt16(values[Anum_gp_persistent_filespace_node_mirror_existence_state - 1]);	*reserved = DatumGetInt32(values[Anum_gp_persistent_filespace_node_reserved - 1]);	*parentXid = (TransactionId)DatumGetInt32(values[Anum_gp_persistent_filespace_node_parent_xid - 1]);    *persistentSerialNum = DatumGetInt64(values[Anum_gp_persistent_filespace_node_persistent_serial_num - 1]);}
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:54,


示例25: regprocedurein

/* * regprocedurein		- converts "proname(args)" to proc OID * * We also accept a numeric OID, for symmetry with the output routine. * * '-' signifies unknown (OID 0).  In all other cases, the input must * match an existing pg_proc entry. */Datumregprocedurein(PG_FUNCTION_ARGS){	char	   *pro_name_or_oid = PG_GETARG_CSTRING(0);	RegProcedure result = InvalidOid;	List	   *names;	int			nargs;	Oid			argtypes[FUNC_MAX_ARGS];	FuncCandidateList clist;	/* '-' ? */	if (strcmp(pro_name_or_oid, "-") == 0)		PG_RETURN_OID(InvalidOid);	/* Numeric OID? */	if (pro_name_or_oid[0] >= '0' &&		pro_name_or_oid[0] <= '9' &&		strspn(pro_name_or_oid, "0123456789") == strlen(pro_name_or_oid))	{		result = DatumGetObjectId(DirectFunctionCall1(oidin,										  CStringGetDatum(pro_name_or_oid)));		PG_RETURN_OID(result);	}	/*	 * Else it's a name and arguments.  Parse the name and arguments, look up	 * potential matches in the current namespace search list, and scan to see	 * which one exactly matches the given argument types.	(There will not be	 * more than one match.)	 *	 * XXX at present, this code will not work in bootstrap mode, hence this	 * datatype cannot be used for any system column that needs to receive	 * data during bootstrap.	 */	parseNameAndArgTypes(pro_name_or_oid, "regprocedurein", false,						 &names, &nargs, argtypes);	clist = FuncnameGetCandidates(names, nargs);	for (; clist; clist = clist->next)	{		if (memcmp(clist->args, argtypes, nargs * sizeof(Oid)) == 0)			break;	}	if (clist == NULL)		ereport(ERROR,				(errcode(ERRCODE_UNDEFINED_FUNCTION),				 errmsg("function /"%s/" does not exist", pro_name_or_oid)));	result = clist->oid;	PG_RETURN_OID(result);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:62,


示例26: CheckInMemConstraintsGpDistributionPolicy

/* * CheckInMemConstraintsGpDistributionPolicy * 		Check uniqueness constraints for gp_distribution_policy in-memory tuples upon insert */static voidCheckInMemConstraintsGpDistributionPolicy(InMemHeapRelation relation, HeapTuple newTuple){	Assert(NULL != newTuple);	Assert(NULL != relation);	Assert(NULL != relation->rel);	TupleDesc tupleDesc = relation->rel->rd_att;	Oid reloidNew = DatumGetObjectId(tuple_getattr(newTuple, tupleDesc, Anum_gp_policy_localoid));	for (int i = 0; i < relation->tupsize; i++)	{		HeapTuple tuple = relation->tuples[i].tuple;		Assert(NULL != tuple);		Oid reloid = DatumGetObjectId(tuple_getattr(tuple, tupleDesc, Anum_gp_policy_localoid));		insist_log(reloidNew != reloid,				   "in-memory tuple with localoid = %d already exists in gp_distribution_policy.", reloid);	}}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:25,


示例27: CheckInMemConstraintsPgExttable

/* * CheckInMemConstraintsPgExttable * 		Check uniqueness constraints for pg_exttable in-memory tuples upon insert */static voidCheckInMemConstraintsPgExttable(InMemHeapRelation relation, HeapTuple newTuple){	Assert(NULL != newTuple);	Assert(NULL != relation);	Assert(NULL != relation->rel);	TupleDesc tupleDesc = relation->rel->rd_att;	Oid reloidNew = DatumGetObjectId(tuple_getattr(newTuple, tupleDesc, Anum_pg_exttable_reloid));	for (int i = 0; i < relation->tupsize; i++)	{		HeapTuple tuple = relation->tuples[i].tuple;		Assert(NULL != tuple);		Oid reloid = DatumGetObjectId(tuple_getattr(tuple, tupleDesc, Anum_pg_exttable_reloid));		insist_log(reloidNew != reloid,				   "in-memory tuple with reloid = %d already exists in pg_exttable.", reloid);	}}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:25,


示例28: GpPersistentRelfileNode_GetValues

void GpPersistentRelfileNode_GetValues(	Datum									*values,	Oid 									*tablespaceOid,	Oid 									*databaseOid,	Oid 									*relfilenodeOid,	int32									*segmentFileNum,	PersistentFileSysRelStorageMgr			*relationStorageManager,	PersistentFileSysState					*persistentState,	PersistentFileSysRelBufpoolKind 		*relBufpoolKind,	TransactionId							*parentXid,	int64									*persistentSerialNum,	ItemPointerData 						*previousFreeTid,	bool									*sharedStorage){	*tablespaceOid = DatumGetObjectId(values[Anum_gp_persistent_relfile_node_tablespace_oid - 1]);	*databaseOid = DatumGetObjectId(values[Anum_gp_persistent_relfile_node_database_oid - 1]);	*relfilenodeOid = DatumGetObjectId(values[Anum_gp_persistent_relfile_node_relfilenode_oid - 1]);	*segmentFileNum = DatumGetInt32(values[Anum_gp_persistent_relfile_node_segment_file_num - 1]);	*relationStorageManager = (PersistentFileSysRelStorageMgr)DatumGetInt16(values[Anum_gp_persistent_relfile_node_relation_storage_manager - 1]);	*persistentState = (PersistentFileSysState)DatumGetInt16(values[Anum_gp_persistent_relfile_node_persistent_state - 1]);	*relBufpoolKind = (PersistentFileSysRelBufpoolKind)DatumGetInt32(values[Anum_gp_persistent_relfile_node_relation_bufpool_kind - 1]);	*parentXid = (TransactionId)DatumGetInt32(values[Anum_gp_persistent_relfile_node_parent_xid - 1]);	*persistentSerialNum = DatumGetInt64(values[Anum_gp_persistent_relfile_node_persistent_serial_num - 1]);	*previousFreeTid = *((ItemPointer) DatumGetPointer(values[Anum_gp_persistent_relfile_node_previous_free_tid - 1]));	*sharedStorage = true;}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:37,


示例29: caql_bootstrap_regproc

Datumcaql_bootstrap_regproc(PG_FUNCTION_ARGS){	char	   *cstr_regprocin = "boolin";	char	   *cstr_regoperin = "#>="; /* we should pick up a unique name */	char	   *cstr_regclassin = "pg_class";	char	   *cstr_regtypein = "bool";	Datum		result;	StringInfoData	buf;	initStringInfo(&buf);	SetProcessingMode(BootstrapProcessing);	/* regproc */	result = DirectFunctionCall1(regprocin, CStringGetDatum(cstr_regprocin));	appendStringInfo(&buf, "regprocin(%s) = %d/n",			cstr_regprocin, DatumGetObjectId(result));	/* regoper */	result = DirectFunctionCall1(regoperin, CStringGetDatum(cstr_regoperin));	appendStringInfo(&buf, "regoperin(%s) = %d/n",			cstr_regoperin, DatumGetObjectId(result));	/* regclass */	result = DirectFunctionCall1(regclassin, CStringGetDatum(cstr_regclassin));	appendStringInfo(&buf, "regclassin(%s) = %d/n",			cstr_regclassin, DatumGetObjectId(result));	/* regtype */	result = DirectFunctionCall1(regtypein, CStringGetDatum(cstr_regtypein));	appendStringInfo(&buf, "regtypein(%s) = %d/n",			cstr_regtypein, DatumGetObjectId(result));	SetProcessingMode(NormalProcessing);	PG_RETURN_TEXT_P(cstring_to_text(buf.data));}
开发者ID:laixiong,项目名称:incubator-hawq,代码行数:36,


示例30: CheckInMemConstraintsPgAttribute

/* * CheckInMemConstraintsPgAttribute * 		Check uniqueness constraints for pg_attribute in-memory tuples upon insert */static voidCheckInMemConstraintsPgAttribute(InMemHeapRelation relation, HeapTuple newTuple){	Assert(NULL != newTuple);	Assert(NULL != relation); 	Assert(NULL != relation->rel);	TupleDesc tupleDesc = relation->rel->rd_att;	Oid attrelidNew     = DatumGetObjectId(tuple_getattr(newTuple, tupleDesc, Anum_pg_attribute_attrelid));	char *attnameNew    = DatumGetCString(tuple_getattr(newTuple, tupleDesc, Anum_pg_attribute_attname));	AttrNumber attnoNew = DatumGetInt16((tuple_getattr(newTuple, tupleDesc, Anum_pg_attribute_attnum)));	for (int i = 0; i < relation->tupsize; i++)	{		HeapTuple tuple = relation->tuples[i].tuple;		Assert(NULL != tuple);		Oid attrelid     = DatumGetObjectId(tuple_getattr(tuple, tupleDesc, Anum_pg_attribute_attrelid));		char *attname    = DatumGetCString(tuple_getattr(tuple, tupleDesc, Anum_pg_attribute_attname));		AttrNumber attno = DatumGetInt16((tuple_getattr(tuple, tupleDesc, Anum_pg_attribute_attnum)));		size_t attnameLen = strlen(attname);		if (attrelid != attrelidNew)		{			/* attributes belong to different relations */			continue;		}		insist_log(attno != attnoNew,			"in-memory tuple with attrelid = %d and attno = %d already exists in pg_attribute.", attrelid, attno);		insist_log((attnameLen != strlen(attnameNew)) ||				   (0 != strncmp(attname, attnameNew, attnameLen)),			"in-memory tuple with attrelid = %d and attname = %s already exists in pg_attribute.", attrelid, attname);	}}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:40,



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


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