| 1245 | } |
| 1246 | |
| 1247 | char * |
| 1248 | SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) |
| 1249 | { |
| 1250 | Datum val; |
| 1251 | bool isnull; |
| 1252 | Oid typoid, |
| 1253 | foutoid; |
| 1254 | bool typisvarlena; |
| 1255 | |
| 1256 | SPI_result = 0; |
| 1257 | |
| 1258 | if (fnumber > tupdesc->natts || fnumber == 0 || |
| 1259 | fnumber <= FirstLowInvalidHeapAttributeNumber) |
| 1260 | { |
| 1261 | SPI_result = SPI_ERROR_NOATTRIBUTE; |
| 1262 | return NULL; |
| 1263 | } |
| 1264 | |
| 1265 | val = heap_getattr(tuple, fnumber, tupdesc, &isnull); |
| 1266 | if (isnull) |
| 1267 | return NULL; |
| 1268 | |
| 1269 | if (fnumber > 0) |
| 1270 | typoid = TupleDescAttr(tupdesc, fnumber - 1)->atttypid; |
| 1271 | else |
| 1272 | typoid = (SystemAttributeDefinition(fnumber))->atttypid; |
| 1273 | |
| 1274 | getTypeOutputInfo(typoid, &foutoid, &typisvarlena); |
| 1275 | |
| 1276 | return OidOutputFunctionCall(foutoid, val); |
| 1277 | } |
| 1278 | |
| 1279 | Datum |
| 1280 | SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull) |
no test coverage detected