このページを編集する際は、編集に関する方針に従ってください。
#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)
#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.
更新日 | 更新者 | 更新内容 |