2 * Description: This module contains functions for setting the data
3 * for individual fields (TupleField structure) of a
6 * Important Note: These functions are ONLY used in building manual
7 * result sets for info functions (SQLTables,
17 void set_tuplefield_null(TupleField
* tuple_field
)
20 tuple_field
->value
= NULL
; /* strdup(""); */
24 void set_tuplefield_string(TupleField
* tuple_field
, const char *string
)
28 tuple_field
->len
= (Int4
) strlen(string
); /* PG restriction */
29 tuple_field
->value
= malloc(strlen(string
) + 1);
30 strcpy((char *)tuple_field
->value
, string
);
32 set_tuplefield_null(tuple_field
);
36 void set_tuplefield_int2(TupleField
* tuple_field
, Int2 value
)
40 sprintf(buffer
, "%d", value
);
42 tuple_field
->len
= (Int4
) (strlen(buffer
) + 1);
43 /* +1 ... is this correct (better be on the save side-...) */
44 tuple_field
->value
= strdup(buffer
);
48 void set_tuplefield_int4(TupleField
* tuple_field
, Int4 value
)
52 sprintf(buffer
, "%d", value
);
54 tuple_field
->len
= (Int4
) (strlen(buffer
) + 1);
55 /* +1 ... is this correct (better be on the save side-...) */
56 tuple_field
->value
= strdup(buffer
);