| 6983 | } |
| 6984 | |
| 6985 | char * |
| 6986 | PQerrorMessage(const PGconn *conn) |
| 6987 | { |
| 6988 | if (!conn) |
| 6989 | return libpq_gettext("connection pointer is NULL\n"); |
| 6990 | |
| 6991 | /* |
| 6992 | * The errorMessage buffer might be marked "broken" due to having |
| 6993 | * previously failed to allocate enough memory for the message. In that |
| 6994 | * case, tell the application we ran out of memory. |
| 6995 | */ |
| 6996 | if (PQExpBufferBroken(&conn->errorMessage)) |
| 6997 | return libpq_gettext("out of memory\n"); |
| 6998 | |
| 6999 | return conn->errorMessage.data; |
| 7000 | } |
| 7001 | |
| 7002 | /* |
| 7003 | * In Windows, socket values are unsigned, and an invalid socket value |