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

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

51自学网 2021-06-03 08:46:58
  C++
这篇教程C++ textToQualifiedNameList函数代码示例写得很实用,希望能帮到您。

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

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

示例1: currtid_byrelname

Datumcurrtid_byrelname(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	ItemPointer tid = PG_GETARG_ITEMPOINTER(1);	ItemPointer result;	RangeVar   *relrv;	Relation	rel;	AclResult	aclresult;	Snapshot	snapshot;	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = heap_openrv(relrv, AccessShareLock);	aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),								  ACL_SELECT);	if (aclresult != ACLCHECK_OK)		aclcheck_error(aclresult, ACL_KIND_CLASS,					   RelationGetRelationName(rel));	if (rel->rd_rel->relkind == RELKIND_VIEW || rel->rd_rel->relkind == RELKIND_CONTVIEW)		return currtid_for_view(rel, tid);	result = (ItemPointer) palloc(sizeof(ItemPointerData));	ItemPointerCopy(tid, result);	snapshot = RegisterSnapshot(GetLatestSnapshot());	heap_get_latest_tid(rel, snapshot, result);	UnregisterSnapshot(snapshot);	heap_close(rel, AccessShareLock);	PG_RETURN_ITEMPOINTER(result);}
开发者ID:myechuri,项目名称:pipelinedb,代码行数:34,


示例2: get_raw_page

Datumget_raw_page(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	uint32		blkno = PG_GETARG_UINT32(1);	Relation	rel;	RangeVar   *relrv;	bytea	   *raw_page;	char	   *raw_page_data;	Buffer		buf;	if (!superuser())		ereport(ERROR,				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use raw functions"))));	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, AccessShareLock);	/* Check that this relation has storage */	if (rel->rd_rel->relkind == RELKIND_VIEW)		ereport(ERROR,				(errcode(ERRCODE_WRONG_OBJECT_TYPE),				 errmsg("cannot get raw page from view /"%s/"",						RelationGetRelationName(rel))));	if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)		ereport(ERROR,				(errcode(ERRCODE_WRONG_OBJECT_TYPE),				 errmsg("cannot get raw page from composite type /"%s/"",						RelationGetRelationName(rel))));	if (blkno >= RelationGetNumberOfBlocks(rel))		elog(ERROR, "block number %u is out of range for relation /"%s/"",			 blkno, RelationGetRelationName(rel));	/* Initialize buffer to copy to */	raw_page = (bytea *) palloc(BLCKSZ + VARHDRSZ);	SET_VARSIZE(raw_page, BLCKSZ + VARHDRSZ);	raw_page_data = VARDATA(raw_page);	/* Take a verbatim copy of the page */	buf = ReadBuffer(rel, blkno);	LockBuffer(buf, BUFFER_LOCK_SHARE);	memcpy(raw_page_data, BufferGetPage(buf), BLCKSZ);	LockBuffer(buf, BUFFER_LOCK_UNLOCK);	ReleaseBuffer(buf);	relation_close(rel, AccessShareLock);	PG_RETURN_BYTEA_P(raw_page);}
开发者ID:Khalefa,项目名称:PostgreSQL_hierarchical,代码行数:55,


示例3: gp_aovisimap_entry_name

Datumgp_aovisimap_entry_name(PG_FUNCTION_ARGS){	RangeVar		*parentrv;	text	   		*relname = PG_GETARG_TEXT_P(0);	Oid				relid;	parentrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	relid = RangeVarGetRelid(parentrv, false);	return gp_aovisimap_entry_internal(fcinfo, relid);}
开发者ID:phan-pivotal,项目名称:gpdb,代码行数:12,


示例4: text_regclass

/* * text_regclass: convert text to regclass */Datumtext_regclass(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	Oid			result;	RangeVar   *rv;	rv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	result = RangeVarGetRelid(rv, false, true /*allowHcatalog*/);	PG_RETURN_OID(result);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:15,


示例5: text_regclass

/* * text_regclass: convert text to regclass * * This could be replaced by CoerceViaIO, except that we need to treat * text-to-regclass as an implicit cast to support legacy forms of nextval() * and related functions. */Datumtext_regclass(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	Oid			result;	RangeVar   *rv;	rv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	/* We might not even have permissions on this relation; don't lock it. */	result = RangeVarGetRelid(rv, NoLock, false);	PG_RETURN_OID(result);}
开发者ID:WiserTogether,项目名称:postgres,代码行数:21,


示例6: ResolveRelationId

/* Finds the relationId from a potentially qualified relation name. */OidResolveRelationId(text *relationName){	List *relationNameList = NIL;	RangeVar *relation = NULL;	Oid relationId = InvalidOid;	bool failOK = false;        /* error if relation cannot be found */	/* resolve relationId from passed in schema and relation name */	relationNameList = textToQualifiedNameList(relationName);	relation = makeRangeVarFromNameList(relationNameList);	relationId = RangeVarGetRelid(relation, NoLock, failOK);	return relationId;}
开发者ID:amosbird,项目名称:citus,代码行数:16,


示例7: pgstattuple

Datumpgstattuple(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	RangeVar   *relrv;	Relation	rel;	Datum		result;	/* open relation */	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = heap_openrv(relrv, AccessShareLock);	result = pgstattuple_real(rel, fcinfo);	PG_RETURN_DATUM(result);}
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:16,


示例8: row_security_active_name

Datumrow_security_active_name(PG_FUNCTION_ARGS){	/* By qualified name */	text	   *tablename = PG_GETARG_TEXT_P(0);	RangeVar   *tablerel;	Oid			tableoid;	int			rls_status;	/* Look up table name.  Can't lock it - we might not have privileges. */	tablerel = makeRangeVarFromNameList(textToQualifiedNameList(tablename));	tableoid = RangeVarGetRelid(tablerel, NoLock, false);	rls_status = check_enable_rls(tableoid, InvalidOid, true);	PG_RETURN_BOOL(rls_status == RLS_ENABLED);}
开发者ID:bocap,项目名称:postgres,代码行数:16,


示例9: relation_size

Datumrelation_size(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	RangeVar   *relrv;	Relation	relation;	Oid			relnode;	int64		totalsize;	unsigned int segcount;	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,													   "relation_size"));	relation = heap_openrv(relrv, AccessShareLock);	relnode = relation->rd_rel->relfilenode;	totalsize = 0;	segcount = 0;	for (;;)	{		char	   *fullname;		struct stat statbuf;		if (segcount == 0)			fullname = psnprintf(25, "%u", (unsigned) relnode);		else			fullname = psnprintf(50, "%u.%u", (unsigned) relnode, segcount);		if (stat(fullname, &statbuf) == -1)		{			if (errno == ENOENT)				break;			else				ereport(ERROR,						(errcode_for_file_access(),						 errmsg("could not stat /"%s/": %m", fullname)));		}		totalsize += statbuf.st_size;		pfree(fullname);		segcount++;	}	heap_close(relation, AccessShareLock);	PG_RETURN_INT64(totalsize);}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:47,


示例10: pgstatindex

/* ------------------------------------------------------ * pgstatindex() * * Usage: SELECT * FROM pgstatindex('t1_pkey'); * ------------------------------------------------------ */Datumpgstatindex(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	Relation	rel;	RangeVar   *relrv;	if (!superuser())		ereport(ERROR,				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use pgstattuple functions"))));	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, AccessShareLock);	PG_RETURN_DATUM(pgstatindex_impl(rel, fcinfo));}
开发者ID:HyukjinKwon,项目名称:pipelinedb,代码行数:23,


示例11: pg_relation_size_name

Datumpg_relation_size_name(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	RangeVar   *relrv;	Relation	rel;	int64		size;	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, AccessShareLock);	size = calculate_relation_size(&(rel->rd_node));	relation_close(rel, AccessShareLock);	PG_RETURN_INT64(size);}
开发者ID:shubham2094,项目名称:postgresql_8.2,代码行数:17,


示例12: relation_size

Datumrelation_size(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	RangeVar   *relrv;	Relation	relation;	Oid			relnodeOid;	Oid         tblspcOid;	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,													   "relation_size"));	relation = relation_openrv(relrv, AccessShareLock);	tblspcOid  = relation->rd_rel->reltablespace;	relnodeOid = relation->rd_rel->relfilenode;	relation_close(relation, AccessShareLock);	PG_RETURN_INT64(calculate_relation_size(tblspcOid, relnodeOid));}
开发者ID:berkeley-cs186,项目名称:course-fa07,代码行数:20,


示例13: nextval

/* * Note: nextval with a text argument is no longer exported as a pg_proc * entry, but we keep it around to ease porting of C code that may have * called the function directly. */Datumnextval(PG_FUNCTION_ARGS){	text	   *seqin = PG_GETARG_TEXT_P(0);	RangeVar   *sequence;	Oid			relid;	sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin));	/*	 * XXX: This is not safe in the presence of concurrent DDL, but acquiring	 * a lock here is more expensive than letting nextval_internal do it,	 * since the latter maintains a cache that keeps us from hitting the lock	 * manager more than once per transaction.  It's not clear whether the	 * performance penalty is material in practice, but for now, we do it this	 * way.	 */	relid = RangeVarGetRelid(sequence, NoLock, false);	PG_RETURN_INT64(nextval_internal(relid));}
开发者ID:EccentricLoggers,项目名称:peloton,代码行数:26,


示例14: ts_token_type_byname

Datumts_token_type_byname(PG_FUNCTION_ARGS){	FuncCallContext *funcctx;	Datum		result;	if (SRF_IS_FIRSTCALL())	{		text	   *prsname = PG_GETARG_TEXT_P(0);		Oid			prsId;		funcctx = SRF_FIRSTCALL_INIT();		prsId = get_ts_parser_oid(textToQualifiedNameList(prsname), false);		tt_setup_firstcall(funcctx, prsId);	}	funcctx = SRF_PERCALL_SETUP();	if ((result = tt_process_call(funcctx)) != (Datum) 0)		SRF_RETURN_NEXT(funcctx, result);	SRF_RETURN_DONE(funcctx);}
开发者ID:AllenDou,项目名称:postgresql,代码行数:22,


示例15: pg_relpages

/* -------------------------------------------------------- * pg_relpages() * * Get a number of pages of the table/index. * * Usage: SELECT pg_relpages('t1'); *		  SELECT pg_relpages('t1_pkey'); * -------------------------------------------------------- */Datumpg_relpages(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	Relation	rel;	RangeVar   *relrv;	int4		relpages;	if (!superuser())		ereport(ERROR,				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use pgstattuple functions"))));	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, AccessShareLock);	relpages = RelationGetNumberOfBlocks(rel);	relation_close(rel, AccessShareLock);	PG_RETURN_INT32(relpages);}
开发者ID:AnLingm,项目名称:gpdb,代码行数:32,


示例16: currtid_byrelname

Datumcurrtid_byrelname(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	ItemPointer tid = PG_GETARG_ITEMPOINTER(1);	ItemPointer result;	RangeVar   *relrv;	Relation	rel;	AclResult	aclresult;	/*	 * Immediately inform client that the function is not supported	 */	elog(ERROR, "Function currtid2 is not supported by GPDB");	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));	rel = heap_openrv(relrv, AccessShareLock);	aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),								  ACL_SELECT);	if (aclresult != ACLCHECK_OK)		aclcheck_error(aclresult, ACL_KIND_CLASS,					   RelationGetRelationName(rel));	if (rel->rd_rel->relkind == RELKIND_VIEW)		return currtid_for_view(rel, tid);	result = (ItemPointer) palloc(sizeof(ItemPointerData));	ItemPointerCopy(tid, result);	heap_get_latest_tid(rel, SnapshotNow, result);	heap_close(rel, AccessShareLock);	PG_RETURN_ITEMPOINTER(result);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:37,


示例17: currtid_byrelname

Datumcurrtid_byrelname(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	ItemPointer tid = PG_GETARG_ITEMPOINTER(1);	ItemPointer result;	RangeVar   *relrv;	Relation	rel;	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,												   "currtid_byrelname"));	rel = heap_openrv(relrv, AccessShareLock);	if (rel->rd_rel->relkind == RELKIND_VIEW)		return currtid_for_view(rel, tid);	result = (ItemPointer) palloc(sizeof(ItemPointerData));	ItemPointerCopy(tid, result);	heap_get_latest_tid(rel, SnapshotNow, result);	heap_close(rel, AccessShareLock);	PG_RETURN_ITEMPOINTER(result);}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:24,


示例18: pg_relation_size_name

Datumpg_relation_size_name(PG_FUNCTION_ARGS){	text	   *relname = PG_GETARG_TEXT_P(0);	RangeVar   *relrv;	Relation	rel;	int64		size;		if (GP_ROLE_EXECUTE == Gp_role)	{		ereport(ERROR,				(errcode(ERRCODE_GP_COMMAND_ERROR),						errmsg("pg_relation_size: cannot be executed in segment")));	}	relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));		rel = try_relation_openrv(relrv, AccessShareLock, false);		/*	 * While we scan pg_class with an MVCC snapshot,	 * someone else might drop the table. It's better to return NULL for	 * already-dropped tables than throw an error and abort the whole query.	 */	if (!RelationIsValid(rel))  		PG_RETURN_NULL();		if (rel->rd_node.relNode == 0)		size = 0;	else		size = calculate_relation_size(rel); 		relation_close(rel, AccessShareLock);	PG_RETURN_INT64(size);}
开发者ID:BALDELab,项目名称:incubator-hawq,代码行数:36,


示例19: bt_page_stats

/* ----------------------------------------------- * bt_page() * * Usage: SELECT * FROM bt_page('t1_pkey', 1); * ----------------------------------------------- */datum_tbt_page_stats(PG_FUNC_ARGS){	text	   *relname = ARG_TEXT_P(0);	uint32		blkno = ARG_UINT32(1);	buf_id_t		buffer;	struct relation *	rel;	range_var_n   *relrv;	datum_t		result;	struct heap_tuple *	tuple;	struct tuple *tupleDesc;	int		j;	char	   *values[11];	BTPageStat	stat;	if (!superuser())		ereport(ERROR,				(errcode(E_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use pageinspect functions"))));	relrv = nl_to_range_var(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, ACCESS_SHR_LOCK);	if (!IS_INDEX(rel) || !IS_BTREE(rel))		elog(ERROR, "relation /"%s/" is not a btree index",			 REL_NAME(rel));	/*	 * Reject attempts to read non-local temporary relations; we would be	 * likely to get wrong data since we have no visibility into the owning	 * session's local buffers.	 */	if (REL_IS_OTHER_TMP(rel))		ereport(ERROR,				(errcode(E_FEATURE_NOT_SUPPORTED),				 errmsg("cannot access temporary tables of other sessions")));	if (blkno == 0)		elog(ERROR, "block 0 is a meta page");	CHECK_RELATION_BLOCK_RANGE(rel, blkno);	buffer = read_buf(rel, blkno);	/* keep compiler quiet */	stat.btpo_prev = stat.btpo_next = INVALID_BLK_NR;	stat.btpo_flags = stat.free_size = stat.avg_item_size = 0;	GetBTPageStatistics(blkno, buffer, &stat);	/* Build a tuple descriptor for our result type */	if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)		elog(ERROR, "return type must be a row type");	j = 0;	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.blkno);	values[j] = palloc(32);	snprintf(values[j++], 32, "%c", stat.type);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.live_items);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.dead_items);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.avg_item_size);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.page_size);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.free_size);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.btpo_prev);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.btpo_next);	values[j] = palloc(32);	if (stat.type == 'd')		snprintf(values[j++], 32, "%d", stat.btpo.xact);	else		snprintf(values[j++], 32, "%d", stat.btpo.level);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", stat.btpo_flags);	tuple = build_tuple_from_cstrings(TupleDescGetAttInMetadata(tupleDesc),								   values);	result = HeapTupleGetDatum(tuple);	release_buf(buffer);	relation_close(rel, ACCESS_SHR_LOCK);	RET_DATUM(result);}
开发者ID:colinet,项目名称:sqlix,代码行数:98,


示例20: kafka_consume_begin_tr

Datumkafka_consume_begin_tr(PG_FUNCTION_ARGS){	text *topic;	text *qualified_name;	RangeVar *relname;	Relation rel;	Relation consumers;	Oid id;	bool result;	text *format;	text *delimiter;	text *quote;	text *escape;	int batchsize;	int parallelism;	int64 offset;	KafkaConsumer consumer;	if (PG_ARGISNULL(0))		elog(ERROR, "topic cannot be null");	if (PG_ARGISNULL(1))		elog(ERROR, "relation cannot be null");	if (PG_ARGISNULL(2))		elog(ERROR, "format cannot be null");	topic = PG_GETARG_TEXT_P(0);	qualified_name = PG_GETARG_TEXT_P(1);	format = PG_GETARG_TEXT_P(2);	if (PG_ARGISNULL(3))		delimiter = NULL;	else		delimiter = PG_GETARG_TEXT_P(3);	if (PG_ARGISNULL(4))		quote = NULL;	else		quote = PG_GETARG_TEXT_P(4);	if (PG_ARGISNULL(5))		escape = NULL;	else		escape = PG_GETARG_TEXT_P(5);	if (PG_ARGISNULL(6))		batchsize = 1000;	else		batchsize = PG_GETARG_INT32(6);	if (PG_ARGISNULL(7))		parallelism = 1;	else		parallelism = PG_GETARG_INT32(7);	if (PG_ARGISNULL(8))		offset = RD_KAFKA_OFFSET_NULL;	else		offset = PG_GETARG_INT64(8);	/* there's no point in progressing if there aren't any brokers */	if (!get_all_brokers())		elog(ERROR, "add at least one broker with kafka_add_broker");	/* verify that the target relation actually exists */	relname = makeRangeVarFromNameList(textToQualifiedNameList(qualified_name));	rel = heap_openrv(relname, NoLock);	if (IsInferredStream(RelationGetRelid(rel)))		ereport(ERROR,				(errmsg("target stream must be static"),				errhint("Use CREATE STREAM to create a stream that can consume a Kafka topic.")));	heap_close(rel, NoLock);	consumers = open_pipeline_kafka_consumers();	id = create_or_update_consumer(consumers, qualified_name, topic, format,			delimiter, quote, escape, batchsize, parallelism);	load_consumer_state(id, &consumer);	result = launch_consumer_group(consumers, &consumer, offset);	heap_close(consumers, NoLock);	if (result)		RETURN_SUCCESS();	else		RETURN_FAILURE();}
开发者ID:huiyuanlu,项目名称:pipelinedb,代码行数:87,


示例21: load_consumer_state

/* * load_consumer_state * * Read consumer state from pipeline_kafka_consumers into the given struct */static voidload_consumer_state(Oid worker_id, KafkaConsumer *consumer){	ScanKeyData skey[1];	HeapTuple tup = NULL;	HeapScanDesc scan;	Relation consumers = open_pipeline_kafka_consumers();	TupleTableSlot *slot = MakeSingleTupleTableSlot(RelationGetDescr(consumers));	Datum d;	bool isnull;	text *qualified;	MemoryContext old;	MemSet(consumer, 0, sizeof(KafkaConsumer));	ScanKeyInit(&skey[0], -2, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(worker_id));	scan = heap_beginscan(consumers, GetTransactionSnapshot(), 1, skey);	tup = heap_getnext(scan, ForwardScanDirection);	if (!HeapTupleIsValid(tup))		elog(ERROR, "kafka consumer %d not found", worker_id);	ExecStoreTuple(tup, slot, InvalidBuffer, false);	consumer->id = HeapTupleGetOid(tup);	d = slot_getattr(slot, CONSUMER_ATTR_RELATION, &isnull);	/* we don't want anything that's palloc'd to get freed when we commit */	old = MemoryContextSwitchTo(CacheMemoryContext);	/* target relation */	qualified = (text *) DatumGetPointer(d);	consumer->rel = makeRangeVarFromNameList(textToQualifiedNameList(qualified));	/* topic */	d = slot_getattr(slot, CONSUMER_ATTR_TOPIC, &isnull);	consumer->topic = TextDatumGetCString(d);	/* format */	d = slot_getattr(slot, CONSUMER_ATTR_FORMAT, &isnull);	consumer->format = TextDatumGetCString(d);	/* delimiter */	d = slot_getattr(slot, CONSUMER_ATTR_DELIMITER, &isnull);	if (!isnull)		consumer->delimiter = TextDatumGetCString(d);	else		consumer->delimiter = NULL;	/* quote character */	d = slot_getattr(slot, CONSUMER_ATTR_QUOTE, &isnull);	if (!isnull)		consumer->quote = TextDatumGetCString(d);	else		consumer->quote = NULL;	/* escape character */	d = slot_getattr(slot, CONSUMER_ATTR_ESCAPE, &isnull);	if (!isnull)		consumer->escape = TextDatumGetCString(d);	else		consumer->escape = NULL;	/* now load all brokers */	consumer->brokers = get_all_brokers();	MemoryContextSwitchTo(old);	d = slot_getattr(slot, CONSUMER_ATTR_PARALLELISM, &isnull);	consumer->parallelism = DatumGetInt32(d);	/* batch size */	d = slot_getattr(slot, CONSUMER_ATTR_BATCH_SIZE, &isnull);	consumer->batch_size = DatumGetInt32(d);	ExecDropSingleTupleTableSlot(slot);	heap_endscan(scan);	heap_close(consumers, NoLock);}
开发者ID:huiyuanlu,项目名称:pipelinedb,代码行数:83,


示例22: bt_metap

/* ------------------------------------------------ * bt_metap() * * Get a btree's meta-page information * * Usage: SELECT * FROM bt_metap('t1_pkey') * ------------------------------------------------ */datum_tbt_metap(PG_FUNC_ARGS){	text	   *relname = ARG_TEXT_P(0);	datum_t		result;	struct relation *	rel;	range_var_n   *relrv;	struct bt_meta_page *metad;	struct tuple *	tupleDesc;	int			j;	char	   *values[6];	buf_id_t		buffer;	page_p		page;	struct heap_tuple *	tuple;	if (!superuser())		ereport(ERROR,				(errcode(E_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use pageinspect functions"))));	relrv = nl_to_range_var(textToQualifiedNameList(relname));	rel = relation_openrv(relrv, ACCESS_SHR_LOCK);	if (!IS_INDEX(rel) || !IS_BTREE(rel))		elog(ERROR, "relation /"%s/" is not a btree index",			 REL_NAME(rel));	/*	 * Reject attempts to read non-local temporary relations; we would be	 * likely to get wrong data since we have no visibility into the owning	 * session's local buffers.	 */	if (REL_IS_OTHER_TMP(rel))		ereport(ERROR,				(errcode(E_FEATURE_NOT_SUPPORTED),				 errmsg("cannot access temporary tables of other sessions")));	buffer = read_buf(rel, 0);	page = BUF_PAGE(buffer);	metad = BT_PAGE_META(page);	/* Build a tuple descriptor for our result type */	if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)		elog(ERROR, "return type must be a row type");	j = 0;	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_magic);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_version);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_root);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_level);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_fastroot);	values[j] = palloc(32);	snprintf(values[j++], 32, "%d", metad->btm_fastlevel);	tuple = build_tuple_from_cstrings(TupleDescGetAttInMetadata(tupleDesc),								   values);	result = HeapTupleGetDatum(tuple);	release_buf(buffer);	relation_close(rel, ACCESS_SHR_LOCK);	RET_DATUM(result);}
开发者ID:colinet,项目名称:sqlix,代码行数:78,


示例23: bt_page_items

datum_tbt_page_items(PG_FUNC_ARGS){	text	   *relname = ARG_TEXT_P(0);	uint32		blkno = ARG_UINT32(1);	datum_t		result;	char	   *values[6];	struct heap_tuple *	tuple;	struct fcall_ctx *fctx;	struct mctx * mctx;	struct user_args *uargs;	if (!superuser())		ereport(ERROR,				(errcode(E_INSUFFICIENT_PRIVILEGE),				 (errmsg("must be superuser to use pageinspect functions"))));	if (SRF_IS_FIRSTCALL())	{		range_var_n   *relrv;		struct relation *	rel;		buf_id_t		buffer;		struct bt_page_opaque * opaque;		struct tuple *	tupleDesc;		fctx = SRF_FIRSTCALL_INIT();		relrv = nl_to_range_var(textToQualifiedNameList(relname));		rel = relation_openrv(relrv, ACCESS_SHR_LOCK);		if (!IS_INDEX(rel) || !IS_BTREE(rel))			elog(ERROR, "relation /"%s/" is not a btree index",				 REL_NAME(rel));		/*		 * Reject attempts to read non-local temporary relations; we would be		 * likely to get wrong data since we have no visibility into the		 * owning session's local buffers.		 */		if (REL_IS_OTHER_TMP(rel))			ereport(ERROR,					(errcode(E_FEATURE_NOT_SUPPORTED),				errmsg("cannot access temporary tables of other sessions")));		if (blkno == 0)			elog(ERROR, "block 0 is a meta page");		CHECK_RELATION_BLOCK_RANGE(rel, blkno);		buffer = read_buf(rel, blkno);		/*		 * We copy the page into local storage to avoid holding pin on the		 * buffer longer than we must, and possibly failing to release it at		 * all if the calling query doesn't fetch all rows.		 */		mctx = mctx_switch(fctx->multi_call_memory_ctx);		uargs = palloc(sizeof(struct user_args));		uargs->page = palloc(BLK_SZ);		memcpy(uargs->page, BUF_PAGE(buffer), BLK_SZ);		release_buf(buffer);		relation_close(rel, ACCESS_SHR_LOCK);		uargs->offset = FIRST_ITEM_ID;		opaque = (struct bt_page_opaque *) PAGE_SPECIAL_PTR(uargs->page);		if (P_ISDELETED(opaque))			elog(NOTICE, "page is deleted");		fctx->max_calls = PAGE_MAX_ITEM_ID(uargs->page);		/* Build a tuple descriptor for our result type */		if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)			elog(ERROR, "return type must be a row type");		fctx->attinmeta = TupleDescGetAttInMetadata(tupleDesc);		fctx->user_fctx = uargs;		mctx_switch(mctx);	}	fctx = SRF_PERCALL_SETUP();	uargs = fctx->user_fctx;	if (fctx->call_cntr < fctx->max_calls)	{		struct item_id *		id;		struct index_tuple *	itup;		int			j;		int			off;		int			dlen;		char	   *dump;		char	   *ptr;		id = PAGE_ITEM_ID(uargs->page, uargs->offset);//.........这里部分代码省略.........
开发者ID:colinet,项目名称:sqlix,代码行数:101,


示例24: pipeline_stream_insert

Datumpipeline_stream_insert(PG_FUNCTION_ARGS){	TriggerData *trigdata = (TriggerData *) fcinfo->context;	Trigger *trig = trigdata->tg_trigger;	HeapTuple tup;	List *fdw_private;	int i;	ResultRelInfo rinfo;	if (trig->tgnargs < 1)		elog(ERROR, "pipeline_stream_insert: must be provided a stream name");	/* make sure it's called as a trigger */	if (!CALLED_AS_TRIGGER(fcinfo))		ereport(ERROR,				(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),				 errmsg("pipeline_stream_insert: must be called as trigger")));	/* and that it's called on update or insert */	if (!TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event) && !TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))		ereport(ERROR,				(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),				 errmsg("pipeline_stream_insert: must be called on insert or update")));	/* and that it's called for each row */	if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))		ereport(ERROR,				(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),				 errmsg("pipeline_stream_insert: must be called for each row")));	/* and that it's called after insert or update */	if (!TRIGGER_FIRED_AFTER(trigdata->tg_event))		ereport(ERROR,				(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),				 errmsg("pipeline_stream_insert: must be called after insert or update")));	if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))		tup = trigdata->tg_newtuple;	else		tup = trigdata->tg_trigtuple;	fdw_private = list_make1(RelationGetDescr(trigdata->tg_relation));	MemSet(&rinfo, 0, sizeof(ResultRelInfo));	rinfo.ri_RangeTableIndex = 1; /* dummy */	rinfo.ri_TrigDesc = NULL;	for (i = 0; i < trig->tgnargs; i++)	{		RangeVar *stream;		Relation rel;		StreamInsertState *sis;		stream = makeRangeVarFromNameList(textToQualifiedNameList(cstring_to_text(trig->tgargs[i])));		rel = heap_openrv(stream, AccessShareLock);		rinfo.ri_RelationDesc = rel;		BeginStreamModify(NULL, &rinfo, fdw_private, 0, 0);		sis = (StreamInsertState *) rinfo.ri_FdwState;		Assert(sis);		if (sis->queries)		{			TupleTableSlot *slot = MakeSingleTupleTableSlot(RelationGetDescr(rel));			ExecStoreTuple(tup, slot, InvalidBuffer, false);			ExecStreamInsert(NULL, &rinfo, slot, NULL);			ExecClearTuple(slot);			ExecDropSingleTupleTableSlot(slot);			pgstat_report_streamstat(true);		}		EndStreamModify(NULL, &rinfo);		heap_close(rel, AccessShareLock);	}	return PointerGetDatum(tup);}
开发者ID:usmanm,项目名称:pipelinedb,代码行数:81,



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


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