このページを編集する際は、編集に関する方針に従ってください。

概要

引数

  1. T :
  2. newdatum :
  3. attlen :

実装

SIZEOF_DATUM==8でコンパイルしたバイナリの場合

#if SIZEOF_DATUM == 8

#define store_att_byval(T,newdatum,attlen) \

	do { \
		switch (attlen) \
		{ \
			case sizeof(char): \
				*(char *) (T) = DatumGetChar(newdatum); \
				break; \
			case sizeof(int16): \
				*(int16 *) (T) = DatumGetInt16(newdatum); \
				break; \
			case sizeof(int32): \
				*(int32 *) (T) = DatumGetInt32(newdatum); \
				break; \
			case sizeof(Datum): \
				*(Datum *) (T) = (newdatum); \
				break; \
			default: \
				elog(ERROR, "unsupported byval length: %d", \
					 (int) (attlen)); \
				break; \
		} \
	} while (0)

SIZEOF_DATUM!=8でコンパイルしたバイナリの場合

#else /* SIZEOF_DATUM != 8 */

#define store_att_byval(T,newdatum,attlen) \

	do { \
		switch (attlen) \
		{ \
			case sizeof(char): \
				*(char *) (T) = DatumGetChar(newdatum); \
				break; \
			case sizeof(int16): \
				*(int16 *) (T) = DatumGetInt16(newdatum); \
				break; \
			case sizeof(int32): \
				*(int32 *) (T) = DatumGetInt32(newdatum); \
				break; \
			default: \
				elog(ERROR, "unsupported byval length: %d", \
					 (int) (attlen)); \
				break; \
		} \
	} while (0)

#endif /* SIZEOF_DATUM == 8 */

呼出元

備考

* store_att_byval is a partial inverse of fetch_att: store a given Datum
* value into a tuple data area at the specified address.  However, it only
* handles the byval case, because in typical usage the caller needs to
* distinguish by-val and by-ref cases anyway, and so a do-it-all macro
* wouldn't be convenient.

履歴

コメント



トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS