このページを編集する際は、編集に関する方針に従ってください。
概要 †
引数 †
- tupleDesc : TupleDesc型
- values : Datum型へのポインタ
- isnull : bool型へのポインタ
- data : char型へのポインタ
- infomask : uint16型へのポインタ
- bit : bits8型へのポインタ
実装 †
void
heap_fill_tuple(TupleDesc tupleDesc,
- 以下のメンバを持つ構造体。詳細はTupleDesc/postgresql-8.1.4参照。
- nattsを、intとして定義。
- attrsを、以下のメンバを持つ構造体Form_pg_attributeへのポインタとして定義。
- attrelidを、Oid(unsigned intの別名)として定義。
- attnameを、以下のメンバを持つ構造体NameDataとして定義。
- dataを、サイズNAMEDATALENのchar配列として定義。
- alignmentDummyを、intとして定義。
- atttypidを、Oid(unsigned intの別名)として定義。
- attstattargetを、int4(int32(signed int)の別名)として定義。
- attlenを、int2(int16(signed short)の別名)として定義。
- attnumを、int2(int16(signed short)の別名)として定義。
- attndimsを、int4(int32(signed int)の別名)として定義。
- attcacheoffを、int4(int32(signed int)の別名)として定義。
- atttypmodを、int4(int32(signed int)の別名)として定義。
- attbyvalを、bool(charの別名)として定義。
- attstorageを、charとして定義。
- attalignを、charとして定義。
- attnotnullを、bool(charの別名)として定義。
- atthasdefを、bool(charの別名)として定義。
- attisdroppedを、bool(charの別名)として定義。
- attislocalを、bool(charの別名)として定義。
- attinhcountを、int4(int32(signed int)の別名)として定義。
- constrを、TupleConstrへのポインタとして定義。
- defvalを、以下のメンバを持つ構造体AttrDefaultへのポインタとして定義。
- adnumを、AttrNumber(int16(signed shortの別名)の別名))として定義。
- adbinを、charへのポインタとして定義。
- checkを、以下のメンバを持つ構造体ConstrCheckへのポインタとして定義。
- ccnameを、charへのポインタとして定義。
- ccbinを、charへのポインタとして定義。
- num_defvalを、uint16(unsigned shortの別名)として定義。
- num_checkを、uint16(unsigned shortの別名)として定義。
- has_not_nullを、bool(charの別名)として定義。
- tdtypeidを、Oid(unsigned intの別名)として定義。
- tdtypmodを、int32(signed intの別名)として定義。
- tdhasoidを、bool(charの別名)として定義。
Datum *values,
bool *isnull,
char *data,
uint16 *infomask,
bits8 *bit)
{
bits8 *bitP;
int bitmask;
int i;
int numberOfAttributes = tupleDesc->natts;
Form_pg_attribute *att = tupleDesc->attrs;
- 以下のメンバを持つ構造体へのポインタ。詳細はForm_pg_attribute/postgresql-8.1.4参照。
- attrelidを、Oid(unsigned intの別名)として定義。
- attnameを、以下のメンバを持つ構造体NameDataとして定義。
- dataを、サイズNAMEDATALENのchar配列として定義。
- alignmentDummyを、intとして定義。
- atttypidを、Oid(unsigned intの別名)として定義。
- attstattargetを、int4(int32(signed int)の別名)として定義。
- attlenを、int2(int16(signed short)の別名)として定義。
- attnumを、int2(int16(signed short)の別名)として定義。
- attndimsを、int4(int32(signed int)の別名)として定義。
- attcacheoffを、int4(int32(signed int)の別名)として定義。
- atttypmodを、int4(int32(signed int)の別名)として定義。
- attbyvalを、bool(charの別名)として定義。
- attstorageを、charとして定義。
- attalignを、charとして定義。
- attnotnullを、bool(charの別名)として定義。
- atthasdefを、bool(charの別名)として定義。
- attisdroppedを、bool(charの別名)として定義。
- attislocalを、bool(charの別名)として定義。
- attinhcountを、int4(int32(signed int)の別名)として定義。
if (bit != NULL)
{
bitP = &bit[-1];
bitmask = CSIGNBIT;
}
else
{
/* just to keep compiler quiet */
bitP = NULL;
bitmask = 0;
}
*infomask &= ~(HEAP_HASNULL | HEAP_HASVARWIDTH | HEAP_HASEXTENDED);
for (i = 0; i < numberOfAttributes; i++)
{
Size data_length;
if (bit != NULL)
{
if (bitmask != CSIGNBIT)
bitmask <<= 1;
else
{
bitP += 1;
*bitP = 0x0;
bitmask = 1;
}
if (isnull[i])
{
*infomask |= HEAP_HASNULL;
continue;
}
*bitP |= bitmask;
}
/* XXX we are aligning the pointer itself, not the offset */
data = (char *) att_align((long) data, att[i]->attalign);
- 以下の値を取得。詳細はatt_align()/postgresql-8.1.4参照。
- att[i]->attalignの値が'i'の場合、data以上であるALIGNOF_INTの倍数のうち最小値を返す。
- att[i]->attalignの値が'c'の場合、dataを(long型にキャストして)そのまま返す。
- att[i]->attalignの値が'd'の場合、data以上であるALIGNOF_DOUBLEの倍数のうち最小値を返す。
- それ以外の場合、data_length以上であるALIGNOF_SHORTの倍数のうち、最小値を返す
。ただし、USE_ASSERT_CHECKING指定してコンパイルしたバイナリの場合、attalignが's'でなければエラーメッセージを出力して終了する。
if (att[i]->attbyval)
{
/* pass-by-value */
store_att_byval(data, values[i], att[i]->attlen);
data_length = att[i]->attlen;
}
else if (att[i]->attlen == -1)
{
/* varlena */
*infomask |= HEAP_HASVARWIDTH;
if (VARATT_IS_EXTERNAL(values[i]))
- VARATT_IS_EXTERNAL()/postgresql-8.1.4?参照。
*infomask |= HEAP_HASEXTERNAL;
- HEAP_HASEXTERNAL/postgresql-8.1.4?参照。
if (VARATT_IS_COMPRESSED(values[i]))
- VARATT_IS_COMPRESSED()/postgresql-8.1.4?参照。
*infomask |= HEAP_HASCOMPRESSED;
- HEAP_HASCOMPRESSED/postgresql-8.1.4?参照。
data_length = VARATT_SIZE(DatumGetPointer(values[i]));
memcpy(data, DatumGetPointer(values[i]), data_length);
}
else if (att[i]->attlen == -2)
{
/* cstring */
*infomask |= HEAP_HASVARWIDTH;
data_length = strlen(DatumGetCString(values[i])) + 1;
memcpy(data, DatumGetPointer(values[i]), data_length);
}
else
{
/* fixed-length pass-by-reference */
Assert(att[i]->attlen > 0);
data_length = att[i]->attlen;
memcpy(data, DatumGetPointer(values[i]), data_length);
}
data += data_length;
}
}
呼出元 †
備考 †
* heap_fill_tuple
* Load data portion of a tuple from values/isnull arrays
*
* We also fill the null bitmap (if any) and set the infomask bits
* that reflect the tuple's data contents.
履歴 †
コメント †
- pFFkKwAamxpRn -- free anime sex games?
- pXWYabefiTovkJc -- rate my creampie?
- qUviHZWoIYO -- free intervideo download?
- RauBQyEkNPcWSHIZOdj -- nwbrtkpgwbg?
- RauBQyEkNPcWSHIZOdj -- nwbrtkpgwbg?
- RauBQyEkNPcWSHIZOdj -- nwbrtkpgwbg?
- jgfjKiumvfza -- freeiq?
- iAGuRCQQusgNs -- nonononon?
- CDcbMnGdOEr -- dfdsdfcedf?
- ZcXyTrXhBenir -- afvjobcgkx?
- dbVXaifwUNDL -- zmormkjkszs?