diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-08-23 20:48:47 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-08-23 20:48:47 +0000 |
commit | a970a8cb95bd3f4d3a4b924904d248c9dd322ee0 (patch) | |
tree | 4fbb5211d2a35c9e86323d1907deaf2bf63a6be2 /src/interfaces/libpq/fe-exec.c | |
parent | eef7e30cc13158cb1fde7f4b148dd14e83331a35 (diff) | |
download | postgresql-a970a8cb95bd3f4d3a4b924904d248c9dd322ee0.tar.gz postgresql-a970a8cb95bd3f4d3a4b924904d248c9dd322ee0.zip |
Back out incorrect commit.
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index e5a1e737c36..eeb4819fb00 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.172 2005/08/23 20:45:07 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.173 2005/08/23 20:48:47 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -2156,16 +2156,25 @@ PQoidValue(const PGresult *res) char *endptr = NULL; unsigned long result; - if (!res || - !res->cmdStatus || - strncmp(res->cmdStatus, "INSERT ", 7) != 0 || - res->cmdStatus[7] < '0' || - res->cmdStatus[7] > '9') + if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0) return InvalidOid; +#ifdef WIN32 + SetLastError(0); +#else + errno = 0; +#endif result = strtoul(res->cmdStatus + 7, &endptr, 10); - if (!endptr || (*endptr != ' ' && *endptr != '\0')) + if (!endptr || (*endptr != ' ' && *endptr != '\0') +#ifndef WIN32 + /* + * On WIN32, errno is not thread-safe and GetLastError() isn't set by + * strtoul(), so we can't check on this platform. + */ + || errno == ERANGE +#endif + ) return InvalidOid; else return (Oid) result; |