* PQoidValue - * a perhaps preferable form of the above which just returns * an Oid type */
| 3596 | * an Oid type |
| 3597 | */ |
| 3598 | Oid |
| 3599 | PQoidValue(const PGresult *res) |
| 3600 | { |
| 3601 | char *endptr = NULL; |
| 3602 | unsigned long result; |
| 3603 | |
| 3604 | if (!res || |
| 3605 | strncmp(res->cmdStatus, "INSERT ", 7) != 0 || |
| 3606 | res->cmdStatus[7] < '0' || |
| 3607 | res->cmdStatus[7] > '9') |
| 3608 | return InvalidOid; |
| 3609 | |
| 3610 | result = strtoul(res->cmdStatus + 7, &endptr, 10); |
| 3611 | |
| 3612 | if (!endptr || (*endptr != ' ' && *endptr != '\0')) |
| 3613 | return InvalidOid; |
| 3614 | else |
| 3615 | return (Oid) result; |
| 3616 | } |
| 3617 | |
| 3618 | |
| 3619 | /* |
no outgoing calls
no test coverage detected