• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pq_getmsgint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tintervalrecv

/*
 *		tintervalrecv			- converts external binary format to tinterval
 */
Datum
tintervalrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	TimeInterval tinterval;
	int32		status;

	tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));

	tinterval->status = pq_getmsgint(buf, sizeof(tinterval->status));
	tinterval->data[0] = pq_getmsgint(buf, sizeof(tinterval->data[0]));
	tinterval->data[1] = pq_getmsgint(buf, sizeof(tinterval->data[1]));

	if (tinterval->data[0] == INVALID_ABSTIME ||
		tinterval->data[1] == INVALID_ABSTIME)
		status = T_INTERVAL_INVAL;		/* undefined  */
	else
		status = T_INTERVAL_VALID;

	if (status != tinterval->status)
		ereport(ERROR,
				(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
				 errmsg("invalid status in external \"tinterval\" value")));

	PG_RETURN_TIMEINTERVAL(tinterval);
}
开发者ID:GisKook,项目名称:Gis,代码行数:29,代码来源:nabstime.c


示例2: hstore_recv

Datum
hstore_recv(PG_FUNCTION_ARGS)
{
	int32		buflen;
	HStore	   *out;
	Pairs	   *pairs;
	int32		i;
	int32		pcount;
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

	pcount = pq_getmsgint(buf, 4);

	if (pcount == 0)
	{
		out = hstorePairs(NULL, 0, 0);
		PG_RETURN_POINTER(out);
	}

	if (pcount < 0 || pcount > MaxAllocSize / sizeof(Pairs))
		ereport(ERROR,
				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
			  errmsg("number of pairs (%d) exceeds the maximum allowed (%d)",
					 pcount, (int) (MaxAllocSize / sizeof(Pairs)))));
	pairs = palloc(pcount * sizeof(Pairs));

	for (i = 0; i < pcount; ++i)
	{
		int			rawlen = pq_getmsgint(buf, 4);
		int			len;

		if (rawlen < 0)
			ereport(ERROR,
					(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
					 errmsg("null value not allowed for hstore key")));

		pairs[i].key = pq_getmsgtext(buf, rawlen, &len);
		pairs[i].keylen = hstoreCheckKeyLen(len);
		pairs[i].needfree = true;

		rawlen = pq_getmsgint(buf, 4);
		if (rawlen < 0)
		{
			pairs[i].val = NULL;
			pairs[i].vallen = 0;
			pairs[i].isnull = true;
		}
		else
		{
			pairs[i].val = pq_getmsgtext(buf, rawlen, &len);
			pairs[i].vallen = hstoreCheckValLen(len);
			pairs[i].isnull = false;
		}
	}

	pcount = hstoreUniquePairs(pairs, pcount, &buflen);

	out = hstorePairs(pairs, pcount, buflen);

	PG_RETURN_POINTER(out);
}
开发者ID:HackG,项目名称:postgres,代码行数:60,代码来源:hstore_io.c


示例3: xidrecv

/*
 *		xidrecv			- converts external binary format to xid
 */
Datum
xidrecv(PG_FUNCTION_ARGS)
{
    StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

    PG_RETURN_TRANSACTIONID((TransactionId) pq_getmsgint(buf, sizeof(TransactionId)));
}
开发者ID:postgres,项目名称:postgres-old-soon-decommissioned,代码行数:10,代码来源:xid.c


示例4: int2recv

/*
 *		int2recv			- converts external binary format to int2
 */
datum_t int2recv(PG_FUNC_ARGS)
{
	struct string* buf;

	buf = (struct string*) ARG_POINTER(0);
	RET_INT16((int16) pq_getmsgint(buf, sizeof(int16)));
}
开发者ID:colinet,项目名称:sqlix,代码行数:10,代码来源:int.c


示例5: cash_recv

/*
 *		cash_recv			- converts external binary format to cash
 */
Datum
cash_recv(PG_FUNCTION_ARGS)
{
    StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

    PG_RETURN_CASH((Cash) pq_getmsgint(buf, sizeof(Cash)));
}
开发者ID:yangineer,项目名称:cscd43-1,代码行数:10,代码来源:cash.c


示例6: oidrecv

/*
 *		oidrecv			- converts external binary format to oid
 */
Datum
oidrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

	PG_RETURN_OID((Oid) pq_getmsgint(buf, sizeof(Oid)));
}
开发者ID:50wu,项目名称:gpdb,代码行数:10,代码来源:oid.c


示例7: cidrecv

/*
 *		cidrecv			- converts external binary format to cid
 */
Datum
cidrecv(PG_FUNCTION_ARGS)
{
    StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

    PG_RETURN_COMMANDID((CommandId) pq_getmsgint(buf, sizeof(CommandId)));
}
开发者ID:postgres,项目名称:postgres-old-soon-decommissioned,代码行数:10,代码来源:xid.c


示例8: int2recv

/*
 *		int2recv			- converts external binary format to int2
 */
Datum
int2recv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

	PG_RETURN_INT16((int16) pq_getmsgint(buf, sizeof(int16)));
}
开发者ID:rtzassociates,项目名称:postgresql-8.2.23,代码行数:10,代码来源:int.c


示例9: reltimerecv

/*
 *		reltimerecv			- converts external binary format to reltime
 */
Datum
reltimerecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

	PG_RETURN_RELATIVETIME((RelativeTime) pq_getmsgint(buf, sizeof(RelativeTime)));
}
开发者ID:GisKook,项目名称:Gis,代码行数:10,代码来源:nabstime.c


示例10: abstimerecv

/*
 *		abstimerecv			- converts external binary format to abstime
 */
Datum
abstimerecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);

	PG_RETURN_ABSOLUTETIME((AbsoluteTime) pq_getmsgint(buf, sizeof(AbsoluteTime)));
}
开发者ID:GisKook,项目名称:Gis,代码行数:10,代码来源:nabstime.c


示例11: logicalrep_read_tuple

/*
 * Read tuple in remote format from stream.
 *
 * The returned tuple points into the input stringinfo.
 */
static void
logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple)
{
	int			i;
	int			natts;

	/* Get number of attributes */
	natts = pq_getmsgint(in, 2);

	memset(tuple->changed, 0, sizeof(tuple->changed));

	/* Read the data */
	for (i = 0; i < natts; i++)
	{
		char		kind;

		kind = pq_getmsgbyte(in);

		switch (kind)
		{
			case 'n':			/* null */
				tuple->values[i] = NULL;
				tuple->changed[i] = true;
				break;
			case 'u':			/* unchanged column */
				/* we don't receive the value of an unchanged column */
				tuple->values[i] = NULL;
				break;
			case 't':			/* text formatted value */
				{
					int			len;

					tuple->changed[i] = true;

					len = pq_getmsgint(in, 4);	/* read length */

					/* and data */
					tuple->values[i] = palloc(len + 1);
					pq_copymsgbytes(in, tuple->values[i], len);
					tuple->values[i][len] = '\0';
				}
				break;
			default:
				elog(ERROR, "unrecognized data representation type '%c'", kind);
		}
	}
}
开发者ID:BertrandAreal,项目名称:postgres,代码行数:52,代码来源:proto.c


示例12: tidrecv

/*
 *		tidrecv			- converts external binary format to tid
 */
Datum
tidrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	ItemPointer result;
	BlockNumber blockNumber;
	OffsetNumber offsetNumber;

	blockNumber = pq_getmsgint(buf, sizeof(blockNumber));
	offsetNumber = pq_getmsgint(buf, sizeof(offsetNumber));

	result = (ItemPointer) palloc(sizeof(ItemPointerData));

	ItemPointerSet(result, blockNumber, offsetNumber);

	PG_RETURN_ITEMPOINTER(result);
}
开发者ID:myechuri,项目名称:pipelinedb,代码行数:20,代码来源:tid.c


示例13: logicalrep_read_typ

/*
 * Read type info from the output stream.
 */
void
logicalrep_read_typ(StringInfo in, LogicalRepTyp *ltyp)
{
	ltyp->remoteid = pq_getmsgint(in, 4);

	/* Read type name from stream */
	ltyp->nspname = pstrdup(logicalrep_read_namespace(in));
	ltyp->typname = pstrdup(pq_getmsgstring(in));
}
开发者ID:BertrandAreal,项目名称:postgres,代码行数:12,代码来源:proto.c


示例14: gpxloglocrecv

/*
 *		gpxloglocrecv			- converts external binary format to xlog location
 */
Datum
gpxloglocrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	XLogRecPtr	*result;
	uint32		result_xlogid;
	uint32		result_xrecoff;

	result_xlogid = pq_getmsgint(buf, sizeof(result_xlogid));
	result_xrecoff = pq_getmsgint(buf, sizeof(result_xrecoff));

	result = (XLogRecPtr*) palloc(sizeof(XLogRecPtr));

	result->xlogid = result_xlogid;
	result->xrecoff = result_xrecoff;

	PG_RETURN_XLOGLOC(result);
}
开发者ID:50wu,项目名称:gpdb,代码行数:21,代码来源:xlogloc.c


示例15: logicalrep_read_tuple

/*
 * Read tuple in remote format from stream.
 *
 * The returned tuple points into the input stringinfo.
 */
static void
logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple)
{
	int			i;
	int			natts;

	/* Get of attributes. */
	natts = pq_getmsgint(in, 2);

	memset(tuple->changed, 0, sizeof(tuple->changed));

	/* Read the data */
	for (i = 0; i < natts; i++)
	{
		char		kind;
		int			len;

		kind = pq_getmsgbyte(in);

		switch (kind)
		{
			case 'n': /* null */
				tuple->values[i] = NULL;
				tuple->changed[i] = true;
				break;
			case 'u': /* unchanged column */
				tuple->values[i] = (char *) 0xdeadbeef; /* make bad usage more obvious */
				break;
			case 't': /* text formatted value */
				{
					tuple->changed[i] = true;

					len = pq_getmsgint(in, 4); /* read length */

					/* and data */
					tuple->values[i] = (char *) pq_getmsgbytes(in, len);
				}
				break;
			default:
				elog(ERROR, "unknown data representation type '%c'", kind);
		}
	}
}
开发者ID:dreamsxin,项目名称:postgresql-1,代码行数:48,代码来源:proto.c


示例16: svec_recv

/**
 *  svec_recv - converts external binary format to text
 */
Datum svec_recv(PG_FUNCTION_ARGS)
{
	StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
	SvecType *svec;

	SparseData sdata=makeEmptySparseData();;
	sdata->type_of_data       = pq_getmsgint(buf, sizeof(int));
	sdata->unique_value_count = pq_getmsgint(buf, sizeof(int));
	sdata->total_value_count  = pq_getmsgint(buf, sizeof(int));
	sdata->vals->len          = pq_getmsgint(buf, sizeof(int));
	sdata->index->len         = pq_getmsgint(buf, sizeof(int));
	sdata->vals->data         = (char *)pq_getmsgbytes(buf,sdata->vals->len);
	sdata->index->data        = (char *)pq_getmsgbytes(buf,sdata->index->len);
	svec = svec_from_sparsedata(sdata,true); //Note this copies the data
//	freeSparseDataAndData(sdata);
	pfree(sdata);

	PG_RETURN_SVECTYPE_P(svec);
}
开发者ID:AI-Org,项目名称:madlib,代码行数:22,代码来源:sparse_vector.c


示例17: logicalrep_read_begin

/*
 * Read transaction BEGIN from the stream.
 */
void
logicalrep_read_begin(StringInfo in, LogicalRepBeginData *begin_data)
{
	/* read fields */
	begin_data->final_lsn = pq_getmsgint64(in);
	if (begin_data->final_lsn == InvalidXLogRecPtr)
		elog(ERROR, "final_lsn not set in begin message");
	begin_data->committime = pq_getmsgint64(in);
	begin_data->xid = pq_getmsgint(in, 4);
}
开发者ID:BertrandAreal,项目名称:postgres,代码行数:13,代码来源:proto.c


示例18: oidvectorrecv

/*
 *		oidvectorrecv			- converts external binary format to oidvector
 */
Datum
oidvectorrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	Oid		   *result = (Oid *) palloc(sizeof(Oid[INDEX_MAX_KEYS]));
	int			slot;

	for (slot = 0; slot < INDEX_MAX_KEYS; slot++)
		result[slot] = (Oid) pq_getmsgint(buf, sizeof(Oid));
	PG_RETURN_POINTER(result);
}
开发者ID:berkeley-cs186,项目名称:course-fa07,代码行数:14,代码来源:oid.c


示例19: txid_snapshot_recv

/*
 * txid_snapshot_recv(internal) returns txid_snapshot
 *
 *		binary input function for type txid_snapshot
 *
 *		format: int4 nxip, int8 xmin, int8 xmax, int8 xip
 */
Datum
txid_snapshot_recv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	TxidSnapshot *snap;
	txid		last = 0;
	int			nxip;
	int			i;
	txid		xmin,
				xmax;

	/* load and validate nxip */
	nxip = pq_getmsgint(buf, 4);
	if (nxip < 0 || nxip > TXID_SNAPSHOT_MAX_NXIP)
		goto bad_format;

	xmin = pq_getmsgint64(buf);
	xmax = pq_getmsgint64(buf);
	if (xmin == 0 || xmax == 0 || xmin > xmax || xmax > MAX_TXID)
		goto bad_format;

	snap = palloc(TXID_SNAPSHOT_SIZE(nxip));
	snap->xmin = xmin;
	snap->xmax = xmax;

	for (i = 0; i < nxip; i++)
	{
		txid		cur = pq_getmsgint64(buf);

		if (cur < last || cur < xmin || cur >= xmax)
			goto bad_format;

		/* skip duplicate xips */
		if (cur == last)
		{
			i--;
			nxip--;
			continue;
		}

		snap->xip[i] = cur;
		last = cur;
	}
	snap->nxip = nxip;
	SET_VARSIZE(snap, TXID_SNAPSHOT_SIZE(nxip));
	PG_RETURN_POINTER(snap);

bad_format:
	ereport(ERROR,
			(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
			 errmsg("invalid external txid_snapshot data")));
	PG_RETURN_POINTER(NULL);	/* keep compiler quiet */
}
开发者ID:jarulraj,项目名称:postgres-cpp,代码行数:60,代码来源:txid.c


示例20: tintervalrecv

/*
 *		tintervalrecv			- converts external binary format to tinterval
 */
Datum
tintervalrecv(PG_FUNCTION_ARGS)
{
	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
	TimeInterval tinterval;

	tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));

	tinterval->status = pq_getmsgint(buf, sizeof(tinterval->status));

	if (!(tinterval->status == T_INTERVAL_INVAL ||
		  tinterval->status == T_INTERVAL_VALID))
		ereport(ERROR,
				(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
				 errmsg("invalid status in external \"tinterval\" value"),
						   errOmitLocation(true)));

	tinterval->data[0] = pq_getmsgint(buf, sizeof(tinterval->data[0]));
	tinterval->data[1] = pq_getmsgint(buf, sizeof(tinterval->data[1]));

	PG_RETURN_TIMEINTERVAL(tinterval);
}
开发者ID:laixiong,项目名称:incubator-hawq,代码行数:25,代码来源:nabstime.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pq_sendint函数代码示例发布时间:2022-05-30
下一篇:
C++ pq_endmessage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap