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

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

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

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

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

示例1: build_hash_key

static uint32build_hash_key(const void *key, Size keysize __attribute__((unused))){    Assert(key);    BMBuildHashKey *keyData = (BMBuildHashKey*)key;	Datum *k = keyData->attributeValueArr;	bool *isNull = keyData->isNullArr;	int i;	uint32 hashkey = 0;	for(i = 0; i < cur_bmbuild->natts; i++)	{		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);        if ( isNull[i] && cur_bmbuild->hash_func_is_strict[i])        {            /* leave hashkey unmodified, equivalent to hashcode 0 */        }        else        {            hashkey ^= DatumGetUInt32(FunctionCall1(&cur_bmbuild->hash_funcs[i], k[i]));        }	}	return hashkey;}
开发者ID:AnLingm,项目名称:gpdb,代码行数:29,


示例2: signValue

/* * Add bits of given value to the signature. */voidsignValue(BloomState *state, SignType *sign, Datum value, int attno){	uint32		hashVal;	int			nBit,				j;	/*	 * init generator with "column's" number to get "hashed" seed for new	 * value. We don't want to map the same numbers from different columns	 * into the same bits!	 */	mySrand(attno);	/*	 * Init hash sequence to map our value into bits. the same values in	 * different columns will be mapped into different bits because of step	 * above	 */	hashVal = DatumGetInt32(FunctionCall1(&state->hashFn[attno], value));	mySrand(hashVal ^ myRand());	for (j = 0; j < state->opts.bitSize[attno]; j++)	{		/* prevent mutiple evaluation */		nBit = myRand() % (state->opts.bloomLength * BITSIGNTYPE);		SETBIT(sign, nBit);	}}
开发者ID:bstrie,项目名称:MollyDB,代码行数:32,


示例3: worker_hash

/* * worker_hash returns the hashed value of the given value. */Datumworker_hash(PG_FUNCTION_ARGS){	Datum valueDatum = PG_GETARG_DATUM(0);	Datum hashedValueDatum = 0;	TypeCacheEntry *typeEntry = NULL;	FmgrInfo *hashFunction = NULL;	Oid valueDataType = InvalidOid;	/* figure out hash function from the data type */	valueDataType = get_fn_expr_argtype(fcinfo->flinfo, 0);	typeEntry = lookup_type_cache(valueDataType, TYPECACHE_HASH_PROC_FINFO);	if (typeEntry->hash_proc_finfo.fn_oid == InvalidOid)	{		ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),						errmsg("cannot find a hash function for the input type"),						errhint("Cast input to a data type with a hash function.")));	}	hashFunction = palloc0(sizeof(FmgrInfo));	fmgr_info_copy(hashFunction, &(typeEntry->hash_proc_finfo), CurrentMemoryContext);	/* calculate hash value */	hashedValueDatum = FunctionCall1(hashFunction, valueDatum);	PG_RETURN_INT32(hashedValueDatum);}
开发者ID:zmyer,项目名称:citus,代码行数:31,


示例4: hlparsetext

voidhlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4 buflen){    int			type,                lenlemm;    char	   *lemm = NULL;    WParserInfo *prsobj = findprs(cfg->prs_id);    LexizeData	ldata;    TSLexeme   *norms;    ParsedLex  *lexs;    prsobj->prs = (void *) DatumGetPointer(                      FunctionCall2(                          &(prsobj->start_info),                          PointerGetDatum(buf),                          Int32GetDatum(buflen)                      )                  );    LexizeInit(&ldata, cfg);    do    {        type = DatumGetInt32(FunctionCall3(                                 &(prsobj->getlexeme_info),                                 PointerGetDatum(prsobj->prs),                                 PointerGetDatum(&lemm),                                 PointerGetDatum(&lenlemm)));        if (type > 0 && lenlemm >= MAXSTRLEN)        {#ifdef IGNORE_LONGLEXEME            ereport(NOTICE,                    (errcode(ERRCODE_SYNTAX_ERROR),                     errmsg("A word you are indexing is too long. It will be ignored.")));            continue;#else            ereport(ERROR,                    (errcode(ERRCODE_SYNTAX_ERROR),                     errmsg("A word you are indexing is too long")));#endif        }        LexizeAddLemm(&ldata, type, lemm, lenlemm);        do        {            if ((norms = LexizeExec(&ldata, &lexs)) != NULL)                addHLParsedLex(prs, query, lexs, norms);            else                addHLParsedLex(prs, query, lexs, NULL);        } while (norms);    } while (type > 0);    FunctionCall1(        &(prsobj->end_info),        PointerGetDatum(prsobj->prs)    );}
开发者ID:merlintang,项目名称:sgb,代码行数:60,


示例5: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(struct tuplehash_hash *tb, const MinimalTuple tuple){	TupleHashTable hashtable = (TupleHashTable) tb->private_data;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	uint32		hashkey = hashtable->hash_iv;	TupleTableSlot *slot;	FmgrInfo   *hashfunctions;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/*		 * Process a tuple already stored in the table.		 *		 * (this case never actually occurs due to the way simplehash.h is		 * used, as the hash-value is stored in the entries)		 */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	/*	 * The way hashes are combined above, among each other and with the IV,	 * doesn't lead to good bit perturbation. As the IV's goal is to lead to	 * achieve that, perform a round of hashing of the combined hash -	 * resulting in near perfect perturbation.	 */	return murmurhash32(hashkey);}
开发者ID:adityavs,项目名称:postgres,代码行数:72,


示例6: PLyObject_FromTransform

/* * Convert using a from-SQL transform function. */static PyObject *PLyObject_FromTransform(PLyDatumToOb *arg, Datum d){	Datum		t;	t = FunctionCall1(&arg->u.transform.typtransform, d);	return (PyObject *) DatumGetPointer(t);}
开发者ID:AmiGanguli,项目名称:postgres,代码行数:11,


示例7: brin_build_desc

/* * Build a BrinDesc used to create or scan a BRIN index */BrinDesc *brin_build_desc(Relation rel){	BrinOpcInfo **opcinfo;	BrinDesc   *bdesc;	TupleDesc	tupdesc;	int			totalstored = 0;	int			keyno;	long		totalsize;	MemoryContext cxt;	MemoryContext oldcxt;	cxt = AllocSetContextCreate(CurrentMemoryContext,								"brin desc cxt",								ALLOCSET_SMALL_INITSIZE,								ALLOCSET_SMALL_MINSIZE,								ALLOCSET_SMALL_MAXSIZE);	oldcxt = MemoryContextSwitchTo(cxt);	tupdesc = RelationGetDescr(rel);	/*	 * Obtain BrinOpcInfo for each indexed column.  While at it, accumulate	 * the number of columns stored, since the number is opclass-defined.	 */	opcinfo = (BrinOpcInfo **) palloc(sizeof(BrinOpcInfo *) * tupdesc->natts);	for (keyno = 0; keyno < tupdesc->natts; keyno++)	{		FmgrInfo   *opcInfoFn;		opcInfoFn = index_getprocinfo(rel, keyno + 1, BRIN_PROCNUM_OPCINFO);		opcinfo[keyno] = (BrinOpcInfo *)			DatumGetPointer(FunctionCall1(opcInfoFn,										  tupdesc->attrs[keyno]->atttypid));		totalstored += opcinfo[keyno]->oi_nstored;	}	/* Allocate our result struct and fill it in */	totalsize = offsetof(BrinDesc, bd_info) +		sizeof(BrinOpcInfo *) * tupdesc->natts;	bdesc = palloc(totalsize);	bdesc->bd_context = cxt;	bdesc->bd_index = rel;	bdesc->bd_tupdesc = tupdesc;	bdesc->bd_disktdesc = NULL; /* generated lazily */	bdesc->bd_totalstored = totalstored;	for (keyno = 0; keyno < tupdesc->natts; keyno++)		bdesc->bd_info[keyno] = opcinfo[keyno];	pfree(opcinfo);	MemoryContextSwitchTo(oldcxt);	return bdesc;}
开发者ID:abeglova,项目名称:postgres,代码行数:59,


示例8: index_markpos

/* ---------------- *		index_markpos  - mark a scan position * ---------------- */voidindex_markpos(IndexScanDesc scan){	FmgrInfo   *procedure;	SCAN_CHECKS;	GET_SCAN_PROCEDURE(ammarkpos);	FunctionCall1(procedure, PointerGetDatum(scan));}
开发者ID:pavanvd,项目名称:postgres-xl,代码行数:14,


示例9: _hash_datum2hashkey

/* * _hash_datum2hashkey -- given a Datum, call the index's hash procedure * * The Datum is assumed to be of the index's column type, so we can use the * "primary" hash procedure that's tracked for us by the generic index code. */uint32_hash_datum2hashkey(Relation rel, Datum key){	FmgrInfo   *procinfo;	/* XXX assumes index has only one attribute */	procinfo = index_getprocinfo(rel, 1, HASHPROC);	return DatumGetUInt32(FunctionCall1(procinfo, key));}
开发者ID:AnLingm,项目名称:gpdb,代码行数:16,


示例10: prs_setup_firstcall

static voidprs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt){	TupleDesc	tupdesc;	MemoryContext oldcontext;	PrsStorage *st;	TSParserCacheEntry *prs = lookup_ts_parser_cache(prsid);	char	   *lex = NULL;	int			llen = 0,				type = 0;	void	   *prsdata;	oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);	st = (PrsStorage *) palloc(sizeof(PrsStorage));	st->cur = 0;	st->len = 16;	st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len);	prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart,											   PointerGetDatum(VARDATA(txt)),									Int32GetDatum(VARSIZE(txt) - VARHDRSZ)));	while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken,											   PointerGetDatum(prsdata),											   PointerGetDatum(&lex),											   PointerGetDatum(&llen)))) != 0)	{		if (st->cur >= st->len)		{			st->len = 2 * st->len;			st->list = (LexemeEntry *) repalloc(st->list, sizeof(LexemeEntry) * st->len);		}		st->list[st->cur].lexeme = palloc(llen + 1);		memcpy(st->list[st->cur].lexeme, lex, llen);		st->list[st->cur].lexeme[llen] = '/0';		st->list[st->cur].type = type;		st->cur++;	}	FunctionCall1(&prs->prsend, PointerGetDatum(prsdata));	st->len = st->cur;	st->cur = 0;	funcctx->user_fctx = (void *) st;	tupdesc = CreateTemplateTupleDesc(2, false);	TupleDescInitEntry(tupdesc, (AttrNumber) 1, "tokid",					   INT4OID, -1, 0);	TupleDescInitEntry(tupdesc, (AttrNumber) 2, "token",					   TEXTOID, -1, 0);	funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);	MemoryContextSwitchTo(oldcontext);}
开发者ID:AllenDou,项目名称:postgresql,代码行数:55,


示例11: index_restrpos

/* ---------------- *		index_restrpos	- restore a scan position * * NOTE: this only restores the internal scan state of the index AM. * The current result tuple (scan->xs_ctup) doesn't change.  See comments * for ExecRestrPos(). * ---------------- */voidindex_restrpos(IndexScanDesc scan){	FmgrInfo   *procedure;	SCAN_CHECKS;	GET_SCAN_PROCEDURE(amrestrpos);	scan->kill_prior_tuple = false;		/* for safety */	FunctionCall1(procedure, PointerGetDatum(scan));}
开发者ID:nskyzh,项目名称:gpdb,代码行数:20,


示例12: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(struct tuplehash_hash *tb, const MinimalTuple tuple){	TupleHashTable hashtable = (TupleHashTable) tb->private_data;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	uint32		hashkey = hashtable->hash_iv;	TupleTableSlot *slot;	FmgrInfo   *hashfunctions;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/*		 * Process a tuple already stored in the table.		 *		 * (this case never actually occurs due to the way simplehash.h is		 * used, as the hash-value is stored in the entries)		 */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	return hashkey;}
开发者ID:dreamsxin,项目名称:postgresql-1,代码行数:66,


示例13: PLyObject_ToTransform

/* * Convert using a to-SQL transform function. */static DatumPLyObject_ToTransform(PLyObToDatum *arg, PyObject *plrv,					  bool *isnull, bool inarray){	if (plrv == Py_None)	{		*isnull = true;		return (Datum) 0;	}	*isnull = false;	return FunctionCall1(&arg->u.transform.typtransform, PointerGetDatum(plrv));}
开发者ID:AmiGanguli,项目名称:postgres,代码行数:15,


示例14: TupleHashTableHash

/* * Compute the hash value for a tuple * * The passed-in key is a pointer to TupleHashEntryData.  In an actual hash * table entry, the firstTuple field points to a tuple (in MinimalTuple * format).  LookupTupleHashEntry sets up a dummy TupleHashEntryData with a * NULL firstTuple field --- that cues us to look at the inputslot instead. * This convention avoids the need to materialize virtual input tuples unless * they actually need to get copied into the table. * * CurTupleHashTable must be set before calling this, since dynahash.c * doesn't provide any API that would let us get at the hashtable otherwise. * * Also, the caller must select an appropriate memory context for running * the hash functions. (dynahash.c doesn't change CurrentMemoryContext.) */static uint32TupleHashTableHash(const void *key, Size keysize){	MinimalTuple tuple = ((const TupleHashEntryData *) key)->firstTuple;	TupleTableSlot *slot;	TupleHashTable hashtable = CurTupleHashTable;	int			numCols = hashtable->numCols;	AttrNumber *keyColIdx = hashtable->keyColIdx;	FmgrInfo   *hashfunctions;	uint32		hashkey = 0;	int			i;	if (tuple == NULL)	{		/* Process the current input tuple for the table */		slot = hashtable->inputslot;		hashfunctions = hashtable->in_hash_funcs;	}	else	{		/* Process a tuple already stored in the table */		/* (this case never actually occurs in current dynahash.c code) */		slot = hashtable->tableslot;		ExecStoreMinimalTuple(tuple, slot, false);		hashfunctions = hashtable->tab_hash_funcs;	}	for (i = 0; i < numCols; i++)	{		AttrNumber	att = keyColIdx[i];		Datum		attr;		bool		isNull;		/* rotate hashkey left 1 bit at each step */		hashkey = (hashkey << 1) | ((hashkey & 0x80000000) ? 1 : 0);		attr = slot_getattr(slot, att, &isNull);		if (!isNull)			/* treat nulls as having hash key 0 */		{			uint32		hkey;			hkey = DatumGetUInt32(FunctionCall1(&hashfunctions[i],												attr));			hashkey ^= hkey;		}	}	return hashkey;}
开发者ID:HyukjinKwon,项目名称:pipelinedb,代码行数:66,


示例15: FindShardInterval

/* * FindShardInterval finds a single shard interval in the cache for the * given partition column value. */ShardInterval *FindShardInterval(Datum partitionColumnValue, ShardInterval **shardIntervalCache,				  int shardCount, char partitionMethod, FmgrInfo *compareFunction,				  FmgrInfo *hashFunction, bool useBinarySearch){	ShardInterval *shardInterval = NULL;	if (partitionMethod == DISTRIBUTE_BY_HASH)	{		int hashedValue = DatumGetInt32(FunctionCall1(hashFunction,													  partitionColumnValue));		if (useBinarySearch)		{			Assert(compareFunction != NULL);			shardInterval = SearchCachedShardInterval(Int32GetDatum(hashedValue),													  shardIntervalCache, shardCount,													  compareFunction);		}		else		{			uint64 hashTokenIncrement = HASH_TOKEN_COUNT / shardCount;			int shardIndex = (uint32) (hashedValue - INT32_MIN) / hashTokenIncrement;			Assert(shardIndex <= shardCount);			/*			 * If the shard count is not power of 2, the range of the last			 * shard becomes larger than others. For that extra piece of range,			 * we still need to use the last shard.			 */			if (shardIndex == shardCount)			{				shardIndex = shardCount - 1;			}			shardInterval = shardIntervalCache[shardIndex];		}	}	else	{		Assert(compareFunction != NULL);		shardInterval = SearchCachedShardInterval(partitionColumnValue,												  shardIntervalCache, shardCount,												  compareFunction);	}	return shardInterval;}
开发者ID:ConstructAgility,项目名称:citus,代码行数:54,


示例16: index_can_return

/* ---------------- *		index_can_return - does index support index-only scans? * ---------------- */boolindex_can_return(Relation indexRelation){	FmgrInfo   *procedure;	RELATION_CHECKS;	/* amcanreturn is optional; assume FALSE if not provided by AM */	if (!RegProcedureIsValid(indexRelation->rd_am->amcanreturn))		return false;	GET_REL_PROCEDURE(amcanreturn);	return DatumGetBool(FunctionCall1(procedure,									  PointerGetDatum(indexRelation)));}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:20,


示例17: index_restrpos

/* ---------------- *		index_restrpos	- restore a scan position * * NOTE: this only restores the internal scan state of the index AM. * The current result tuple (scan->xs_ctup) doesn't change.  See comments * for ExecRestrPos(). * * NOTE: in the presence of HOT chains, mark/restore only works correctly * if the scan's snapshot is MVCC-safe; that ensures that there's at most one * returnable tuple in each HOT chain, and so restoring the prior state at the * granularity of the index AM is sufficient.  Since the only current user * of mark/restore functionality is nodeMergejoin.c, this effectively means * that merge-join plans only work for MVCC snapshots.  This could be fixed * if necessary, but for now it seems unimportant. * ---------------- */voidindex_restrpos(IndexScanDesc scan){	FmgrInfo   *procedure;	Assert(IsMVCCSnapshot(scan->xs_snapshot));	SCAN_CHECKS;	GET_SCAN_PROCEDURE(amrestrpos);	scan->xs_continue_hot = false;	scan->kill_prior_tuple = false;		/* for safety */	FunctionCall1(procedure, PointerGetDatum(scan));}
开发者ID:pavanvd,项目名称:postgres-xl,代码行数:32,


示例18: initForecastModel

void initForecastModel(ModelInfo *modelInfo, MemoryContext memoryContext){	MemoryContext oldContext = NULL;			if (memoryContext != CurrentMemoryContext)		oldContext = MemoryContextSwitchTo(memoryContext);			FunctionCall1(&(modelInfo->algInfo->algInitModel), PointerGetDatum(modelInfo));		modelInfo->disAggKeyDenominator=0.0;	modelInfo->disaggkey=1;	if (oldContext != NULL)		MemoryContextSwitchTo(oldContext);}
开发者ID:Khalefa,项目名称:Miracle,代码行数:16,


示例19: json_agg_common_transfn

Datum json_agg_common_transfn( PG_FUNCTION_ARGS, bool top_object ){	StringInfo state;	char *serialized_value;	FmgrInfo	flinfo;	state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);	/* Append the value unless null. */	if (!PG_ARGISNULL(1))	{		/* On the first time through, we ignore the delimiter. */		if (state == NULL)		{			state = makeJsonAggState(fcinfo);			if( top_object )				appendStringInfoChar(state, '{');  /* begin top-level json object */			if(!PG_ARGISNULL(2)) /* output array json-name */			{				appendStringInfoQuotedString(state, PG_TEXT_DATUM_GET_CSTR( PG_GETARG_DATUM(2) ));				appendStringInfoChar(state, ':');  /* array name delimiter */			}			appendStringInfoChar(state, '[');  /* array begin */		}		else			appendStringInfoChar(state, ',');  /* delimiter */		//call to serialize_record( ... )		MemSet( &flinfo, 0, sizeof( flinfo ) );		flinfo.fn_addr = serialize_record;		flinfo.fn_nargs = 1;		flinfo.fn_mcxt = fcinfo->flinfo->fn_mcxt;		serialized_value = PG_TEXT_DATUM_GET_CSTR( FunctionCall1( &flinfo, PG_GETARG_DATUM(1) ) );		appendStringInfoString(state, serialized_value);	  /* append value */	}	/*	 * The transition type for json_agg() is declared to be "internal",	 * which is a pass-by-value type the same size as a pointer.	 */	PG_RETURN_POINTER(state);}
开发者ID:alexclear,项目名称:pg-to-json-serializer,代码行数:47,


示例20: gistcentryinit

/* * initialize a GiST entry with a compressed version of key */voidgistcentryinit(GISTSTATE *giststate, int nkey,			   GISTENTRY *e, Datum k, Relation r,			   Page pg, OffsetNumber o, bool l, bool isNull){	if (!isNull)	{		GISTENTRY  *cep;		gistentryinit(*e, k, r, pg, o, l);		cep = (GISTENTRY *)			DatumGetPointer(FunctionCall1(&giststate->compressFn[nkey],										  PointerGetDatum(e)));		/* compressFn may just return the given pointer */		if (cep != e)			gistentryinit(*e, cep->key, cep->rel, cep->page, cep->offset,						  cep->leafkey);	}	else		gistentryinit(*e, (Datum) 0, r, pg, o, l);}
开发者ID:markwkm,项目名称:postgres,代码行数:24,


示例21: finalizeForecastModel

/* * finalizeForecastModel * * no more input tuples to read */void finalizeForecastModel(ModelInfo *model){	int length = 0;	FunctionCall1(&(model->algInfo->algFinalizeForecastModel),PointerGetDatum(model->model));	length = model->model->trainingTupleCount;	//MEASURE-CHANGE//	length=20;	if (model->upperBound==0) {		if(((int)(length*0.1))<1)			model->lowerBound = 1;		else			model->lowerBound = (((int)(length*0.1)));		//XXX: CHANGE FOR MESURING		if(!model->errorArray){			if(((int)(length*0.1))<2)				model->errorArray = palloc0(2*sizeof(double));			else				model->errorArray = palloc0(((int)(length*0.1))*sizeof(double));		}		else			if(model->upperBound < ((int)(length*0.1))){				model->errorArray = repalloc(model->errorArray, ((int)(length*0.1))*sizeof(double));				model->errorArray[((int)(length*0.1))-1] = 0.0;			}		if(((int)(length*0.1))<2)			model->upperBound = 2;		else			model->upperBound = ((int)(length*0.1));	}}
开发者ID:Khalefa,项目名称:Miracle,代码行数:42,


示例22: gistdentryinit

/*** initialize a GiST entry with a decompressed version of key*/voidgistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,			   Datum k, Relation r, Page pg, OffsetNumber o,			   int b, bool l, bool isNull){	if (b && !isNull)	{		GISTENTRY  *dep;		gistentryinit(*e, k, r, pg, o, b, l);		dep = (GISTENTRY *)			DatumGetPointer(FunctionCall1(&giststate->decompressFn[nkey],										  PointerGetDatum(e)));		/* decompressFn may just return the given pointer */		if (dep != e)		{			gistentryinit(*e, dep->key, dep->rel, dep->page, dep->offset,						  dep->bytes, dep->leafkey);			pfree(dep);		}	}	else		gistentryinit(*e, (Datum) 0, r, pg, o, 0, l);}
开发者ID:berkeley-cs186,项目名称:course-fa07,代码行数:27,


示例23: index_endscan

/* ---------------- *		index_endscan - end a scan * ---------------- */voidindex_endscan(IndexScanDesc scan){	FmgrInfo   *procedure;	SCAN_CHECKS;	GET_SCAN_PROCEDURE(amendscan);	/* Release any held pin on a heap page */	if (BufferIsValid(scan->xs_cbuf))	{		ReleaseBuffer(scan->xs_cbuf);		scan->xs_cbuf = InvalidBuffer;	}	/* End the AM's scan */	FunctionCall1(procedure, PointerGetDatum(scan));	/* Release index refcount acquired by index_beginscan */	RelationDecrementReferenceCount(scan->indexRelation);	/* Release the scan data structure itself */	IndexScanEnd(scan);}
开发者ID:pavanvd,项目名称:postgres-xl,代码行数:28,


示例24: plperl_call_perl_func

static SV  *plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo){	dSP;	SV		   *retval;	int			i;	int			count;	SV		   *sv;	ENTER;	SAVETMPS;	PUSHMARK(SP);	XPUSHs(&PL_sv_undef);		/* no trigger data */	for (i = 0; i < desc->nargs; i++)	{		if (fcinfo->argnull[i])			XPUSHs(&PL_sv_undef);		else if (desc->arg_is_rowtype[i])		{			HeapTupleHeader td;			Oid			tupType;			int32		tupTypmod;			TupleDesc	tupdesc;			HeapTupleData tmptup;			SV		   *hashref;			td = DatumGetHeapTupleHeader(fcinfo->arg[i]);			/* Extract rowtype info and find a tupdesc */			tupType = HeapTupleHeaderGetTypeId(td);			tupTypmod = HeapTupleHeaderGetTypMod(td);			tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);			/* Build a temporary HeapTuple control structure */			tmptup.t_len = HeapTupleHeaderGetDatumLength(td);			tmptup.t_data = td;			hashref = plperl_hash_from_tuple(&tmptup, tupdesc);			XPUSHs(sv_2mortal(hashref));		}		else		{			char	   *tmp;			tmp = DatumGetCString(FunctionCall1(&(desc->arg_out_func[i]),												fcinfo->arg[i]));			sv = newSVpv(tmp, 0);#if PERL_BCDVERSION >= 0x5006000L			if (GetDatabaseEncoding() == PG_UTF8)				SvUTF8_on(sv);#endif			XPUSHs(sv_2mortal(sv));			pfree(tmp);		}	}	PUTBACK;	/* Do NOT use G_KEEPERR here */	count = perl_call_sv(desc->reference, G_SCALAR | G_EVAL);	SPAGAIN;	if (count != 1)	{		PUTBACK;		FREETMPS;		LEAVE;		elog(ERROR, "didn't get a return item from function");	}	if (SvTRUE(ERRSV))	{		(void) POPs;		PUTBACK;		FREETMPS;		LEAVE;		/* XXX need to find a way to assign an errcode here */		ereport(ERROR,				(errmsg("error from Perl function: %s",						strip_trailing_ws(SvPV(ERRSV, PL_na)))));	}	retval = newSVsv(POPs);	PUTBACK;	FREETMPS;	LEAVE;	return retval;}
开发者ID:shubham2094,项目名称:postgresql_8.1,代码行数:91,


示例25: parsetext

/* * Parse string and lexize words. * * prs will be filled in. */voidparsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen){	int			type,				lenlemm;	char	   *lemm = NULL;	LexizeData	ldata;	TSLexeme   *norms;	TSConfigCacheEntry *cfg;	TSParserCacheEntry *prsobj;	void	   *prsdata;	cfg = lookup_ts_config_cache(cfgId);	prsobj = lookup_ts_parser_cache(cfg->prsId);	prsdata = (void *) DatumGetPointer(FunctionCall2(&prsobj->prsstart,													 PointerGetDatum(buf),													 Int32GetDatum(buflen)));	LexizeInit(&ldata, cfg);	do	{		type = DatumGetInt32(FunctionCall3(&(prsobj->prstoken),										   PointerGetDatum(prsdata),										   PointerGetDatum(&lemm),										   PointerGetDatum(&lenlemm)));		if (type > 0 && lenlemm >= MAXSTRLEN)		{#ifdef IGNORE_LONGLEXEME			ereport(NOTICE,					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),					 errmsg("word is too long to be indexed"),					 errdetail("Words longer than %d characters are ignored.",							   MAXSTRLEN)));			continue;#else			ereport(ERROR,					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),					 errmsg("word is too long to be indexed"),					 errdetail("Words longer than %d characters are ignored.",							   MAXSTRLEN)));#endif		}		LexizeAddLemm(&ldata, type, lemm, lenlemm);		while ((norms = LexizeExec(&ldata, NULL)) != NULL)		{			TSLexeme   *ptr = norms;			prs->pos++;			/* set pos */			while (ptr->lexeme)			{				if (prs->curwords == prs->lenwords)				{					prs->lenwords *= 2;					prs->words = (ParsedWord *) repalloc((void *) prs->words, prs->lenwords * sizeof(ParsedWord));				}				if (ptr->flags & TSL_ADDPOS)					prs->pos++;				prs->words[prs->curwords].len = strlen(ptr->lexeme);				prs->words[prs->curwords].word = ptr->lexeme;				prs->words[prs->curwords].nvariant = ptr->nvariant;				prs->words[prs->curwords].flags = ptr->flags & TSL_PREFIX;				prs->words[prs->curwords].alen = 0;				prs->words[prs->curwords].pos.pos = LIMITPOS(prs->pos);				ptr++;				prs->curwords++;			}			pfree(norms);		}	} while (type > 0);	FunctionCall1(&(prsobj->prsend), PointerGetDatum(prsdata));}
开发者ID:adunstan,项目名称:pg-cvs-mirror,代码行数:84,


示例26: DeserializeTuple

//.........这里部分代码省略.........#endif				SET_VARSIZE(num, numSize + VARHDRSZ);				pq_copymsgbytes(serialTup, VARDATA(num), numSize);				skipPadding(serialTup);				pSerInfo->values[i] = NumericGetDatum(num);				break;			}			case ACLITEMOID:			{				int		aclSize, k, cnt;				char		*inputstring, *starsfree;				aclSize = stringInfoGetInt32(serialTup);				inputstring = (char*) palloc(aclSize  + 1);				starsfree = (char*) palloc(aclSize  + 1);				cnt = 0;					pq_copymsgbytes(serialTup, inputstring, aclSize);				skipPadding(serialTup);				inputstring[aclSize] = '/0';				for(k=0; k<aclSize; k++)				{										if( inputstring[k] != '*')					{						starsfree[cnt] = inputstring[k];						cnt++;					}				}				starsfree[cnt] = '/0';				pSerInfo->values[i] = DirectFunctionCall1(aclitemin, CStringGetDatum(starsfree));				pfree(inputstring);				break;			}			case 210:			{				int 		strsize;				char		*smgrstr;				strsize = stringInfoGetInt32(serialTup);				smgrstr = (char*) palloc(strsize + 1);				pq_copymsgbytes(serialTup, smgrstr, strsize);				skipPadding(serialTup);				smgrstr[strsize] = '/0';				pSerInfo->values[i] = DirectFunctionCall1(smgrin, CStringGetDatum(smgrstr));				break;			}			default:				fHandled = false;		}		if (fHandled)			continue;		attr_size = stringInfoGetInt32(serialTup);		/* reset attr_data to empty, and load raw data into it */		attr_data.len = 0;		attr_data.data[0] = '/0';		attr_data.cursor = 0;
开发者ID:50wu,项目名称:gpdb,代码行数:67,


示例27: SerializeTupleIntoChunks

//.........这里部分代码省略.........						addByteStringToChunkList(tcList, (char *) VARDATA(pText), textSize, &pSerInfo->chunkCache);						addPadding(tcList,&pSerInfo->chunkCache,textSize);						break;					}					case DATEOID:					{						DateADT date = DatumGetDateADT(attr);						addByteStringToChunkList(tcList, (char *) &date, sizeof(DateADT), &pSerInfo->chunkCache);						break;					}					case NUMERICOID:					{						/*						 * Treat the numeric as a varlena variable, and just push						 * the whole shebang to the output-buffer.	We don't care						 * about the guts of the numeric.						 */						Numeric		num = DatumGetNumeric(attr);						int32		numSize = VARSIZE(num) - VARHDRSZ;						addInt32ToChunkList(tcList, numSize, &pSerInfo->chunkCache);						addByteStringToChunkList(tcList, (char *) VARDATA(num), numSize, &pSerInfo->chunkCache);						addPadding(tcList,&pSerInfo->chunkCache,numSize);						break;					}					case ACLITEMOID:					{						AclItem		*aip = DatumGetAclItemP(attr);						char		*outputstring;						int32		aclSize ;						outputstring = DatumGetCString(DirectFunctionCall1(aclitemout,																		   PointerGetDatum(aip)));						aclSize = strlen(outputstring);						addInt32ToChunkList(tcList, aclSize, &pSerInfo->chunkCache);						addByteStringToChunkList(tcList, outputstring,aclSize, &pSerInfo->chunkCache);						addPadding(tcList,&pSerInfo->chunkCache,aclSize);						break;					}						case 210: /* storage manager */					{						char		*smgrstr;						int32		strsize;						smgrstr = DatumGetCString(DirectFunctionCall1(smgrout, 0));						strsize = strlen(smgrstr);						addInt32ToChunkList(tcList, strsize, &pSerInfo->chunkCache);						addByteStringToChunkList(tcList, smgrstr, strsize, &pSerInfo->chunkCache);						addPadding(tcList,&pSerInfo->chunkCache,strsize);						break;					}					default:						fHandled = false;				}				if (fHandled)					continue;				/*				 * the FunctionCall2 call into the send function may result in some				 * allocations which we'd like to have contained by our reset-able
开发者ID:50wu,项目名称:gpdb,代码行数:67,


示例28: hlparsetext

voidhlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int buflen){	int			type,				lenlemm;	char	   *lemm = NULL;	LexizeData	ldata;	TSLexeme   *norms;	ParsedLex  *lexs;	TSConfigCacheEntry *cfg;	TSParserCacheEntry *prsobj;	void	   *prsdata;	cfg = lookup_ts_config_cache(cfgId);	prsobj = lookup_ts_parser_cache(cfg->prsId);	prsdata = (void *) DatumGetPointer(FunctionCall2(&(prsobj->prsstart),													 PointerGetDatum(buf),													 Int32GetDatum(buflen)));	LexizeInit(&ldata, cfg);	do	{		type = DatumGetInt32(FunctionCall3(&(prsobj->prstoken),										   PointerGetDatum(prsdata),										   PointerGetDatum(&lemm),										   PointerGetDatum(&lenlemm)));		if (type > 0 && lenlemm >= MAXSTRLEN)		{#ifdef IGNORE_LONGLEXEME			ereport(NOTICE,					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),					 errmsg("word is too long to be indexed"),					 errdetail("Words longer than %d characters are ignored.",							   MAXSTRLEN)));			continue;#else			ereport(ERROR,					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),					 errmsg("word is too long to be indexed"),					 errdetail("Words longer than %d characters are ignored.",							   MAXSTRLEN)));#endif		}		LexizeAddLemm(&ldata, type, lemm, lenlemm);		do		{			if ((norms = LexizeExec(&ldata, &lexs)) != NULL)				addHLParsedLex(prs, query, lexs, norms);			else				addHLParsedLex(prs, query, lexs, NULL);		} while (norms);	} while (type > 0);	FunctionCall1(&(prsobj->prsend), PointerGetDatum(prsdata));}
开发者ID:adunstan,项目名称:pg-cvs-mirror,代码行数:61,


示例29: serialize_record

Datum serialize_record( PG_FUNCTION_ARGS ){//	FILE* log;//	log = fopen("/var/lib/postgresql/serializer.log", "a");	HeapTupleHeader rec = PG_GETARG_HEAPTUPLEHEADER(0);	HeapTupleData tuple;	bool		needComma = false;	int		 i;	Datum	  *values;	bool	   *nulls;	StringInfoData buf;	char *conversion_buf;	/* Extract type info from the tuple itself */	Oid tupType = HeapTupleHeaderGetTypeId(rec);	int32 tupTypmod = HeapTupleHeaderGetTypMod(rec);	TupleDesc tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);	int ncolumns = tupdesc->natts;	/* Build a temporary HeapTuple control structure */	tuple.t_len = HeapTupleHeaderGetDatumLength(rec);	ItemPointerSetInvalid(&(tuple.t_self));	tuple.t_tableOid = InvalidOid;	tuple.t_data = rec;//	fprintf(log, "Doing serialize_record/n");//	fflush(log);	values = (Datum *) palloc(ncolumns * sizeof(Datum));	nulls = (bool *) palloc(ncolumns * sizeof(bool));	/* Break down the tuple into fields */	heap_deform_tuple(&tuple, tupdesc, values, nulls);	/* And build the result string */	initStringInfo(&buf);	appendStringInfoChar(&buf, '{');	for (i = 0; i < ncolumns; i++)	{		Oid		 column_type = tupdesc->attrs[ i ]->atttypid;		char	   *value;		char	   *column_name;		char 		type_category;		HeapTuple 	type_tuple;		FmgrInfo flinfo;		/* Ignore dropped columns in datatype */		if (tupdesc->attrs[i]->attisdropped)			continue;		if (nulls[i])		{			/* emit nothing... */			continue;		}		if (needComma)			appendStringInfoChar(&buf, ',');		needComma = true;		/* obtain column name */		column_name = SPI_fname( tupdesc, i + 1 );		/* obtain type information from pg_catalog */		type_tuple = SearchSysCache1( TYPEOID, ObjectIdGetDatum(column_type) );		if (!HeapTupleIsValid( type_tuple ))			elog(ERROR, "cache lookup failed for relation %u", column_type);		type_category = ((Form_pg_type) GETSTRUCT( type_tuple ))->typcategory;		ReleaseSysCache( type_tuple );		/* append column name */		appendStringInfoChar(&buf, '"');		appendStringInfoString(&buf, column_name);		appendStringInfoString(&buf, "/":");		switch( type_category )		{			// http://www.postgresql.org/docs/current/static/catalog-pg-type.html#CATALOG-TYPCATEGORY-TABLE			case 'A': //array				//call to serialize_array( ... )				MemSet( &flinfo, 0, sizeof( flinfo ) );				flinfo.fn_addr = serialize_array;				flinfo.fn_nargs = 1;				flinfo.fn_mcxt = fcinfo->flinfo->fn_mcxt;				value = PG_TEXT_DATUM_GET_CSTR( FunctionCall1( &flinfo, values[ i ] ) );				appendStringInfoString(&buf, value);			break;//.........这里部分代码省略.........
开发者ID:alexclear,项目名称:pg-to-json-serializer,代码行数:101,


示例30: serialize_array

Datum serialize_array(PG_FUNCTION_ARGS){	ArrayType  *v = PG_GETARG_ARRAYTYPE_P(0);	Oid		 element_type = ARR_ELEMTYPE(v);	int16		typlen;	bool		typbyval;	char		typalign;	char		typdelim;	char	   *p, *value;	char 		type_category;	bool		needComma = false;	bits8	  *bitmap;	int		 bitmask;	int		 nitems, i;	int		 ndim, *dims;	Oid			typioparam, typiofunc;	HeapTuple 	type_tuple;	FmgrInfo	proc, flinfo;	StringInfoData buf;//	FILE* log;//	log = fopen("/var/lib/postgresql/serializer.log", "a");//	fprintf(log, "Doing serialize_array/n");//	fflush(log);	/*	 * Get info about element type, including its output conversion proc	 */	get_type_io_data(element_type, IOFunc_output,					 &typlen, &typbyval,					 &typalign, &typdelim,					 &typioparam, &typiofunc);	fmgr_info_cxt( typiofunc, &proc, fcinfo->flinfo->fn_mcxt );	ndim = ARR_NDIM(v);	dims = ARR_DIMS(v);	nitems = ArrayGetNItems(ndim, dims);	if( ndim > 1 )		elog( ERROR, "multidimensional arrays doesn't supported" );	p = ARR_DATA_PTR(v);	bitmap = ARR_NULLBITMAP(v);	bitmask = 1;	/* obtain type information from pg_catalog */	type_tuple = SearchSysCache1( TYPEOID, ObjectIdGetDatum(element_type) );	if (!HeapTupleIsValid( type_tuple ))		elog(ERROR, "cache lookup failed for relation %u", element_type);	type_category = ((Form_pg_type) GETSTRUCT( type_tuple ))->typcategory;	ReleaseSysCache( type_tuple );	/* Build the result string */	initStringInfo(&buf);	appendStringInfoChar(&buf, '[');	for (i = 0; i < nitems; i++)	{		if (needComma)			appendStringInfoChar(&buf, ',');		needComma = true;		/* Get source element, checking for NULL */		if (bitmap && (*bitmap & bitmask) == 0)		{			// append null			appendStringInfoString(&buf, "null");		}		else		{			/* get item value and advance array data pointer */			Datum itemvalue = fetch_att(p, typbyval, typlen);			p = att_addlength_pointer(p, typlen, p);			p = (char *) att_align_nominal(p, typalign);			//------------------------			switch( type_category )			{				// http://www.postgresql.org/docs/current/static/catalog-pg-type.html#CATALOG-TYPCATEGORY-TABLE				case 'A': //array - impossible case				break;				case 'C': //composite					//call to serialize_record( ... )					MemSet( &flinfo, 0, sizeof( flinfo ) );					flinfo.fn_addr = serialize_record;					flinfo.fn_nargs = 1;					flinfo.fn_mcxt = fcinfo->flinfo->fn_mcxt;					value = PG_TEXT_DATUM_GET_CSTR( FunctionCall1( &flinfo, itemvalue ) );//.........这里部分代码省略.........
开发者ID:alexclear,项目名称:pg-to-json-serializer,代码行数:101,



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


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