1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Remove Ops parameter from STATRELID cache lookup, for Tom Lane and

optimizer.
This commit is contained in:
Bruce Momjian
2000-01-24 02:12:58 +00:00
parent 4d564c5b12
commit da5aba105f
8 changed files with 61 additions and 73 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.114 2000/01/23 01:27:39 petere Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.115 2000/01/24 02:12:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -391,7 +391,6 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
PGconn *conn;
char *tmp; /* An error message from some service we call. */
bool error = FALSE; /* We encountered an error. */
int i;
conn = makeEmptyPGconn();
if (conn == NULL)
@@ -585,6 +584,30 @@ update_db_info(PGconn *conn)
return 0;
}
/* ----------
* connectMakeNonblocking -
* Make a connection non-blocking.
* Returns 1 if successful, 0 if not.
* ----------
*/
static int
connectMakeNonblocking(PGconn *conn)
{
#ifndef WIN32
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
#else
if (ioctlsocket(conn->sock, FIONBIO, &on) != 0)
#endif
{
printfPQExpBuffer(&conn->errorMessage,
"connectMakeNonblocking -- fcntl() failed: errno=%d\n%s\n",
errno, strerror(errno));
return 0;
}
return 1;
}
/* ----------
* connectNoDelay -
* Sets the TCP_NODELAY socket option.
@@ -755,7 +778,7 @@ connectDBStart(PGconn *conn)
* Ewan Mellor <eem21@cam.ac.uk>.
* ---------- */
#if (!defined(WIN32) || defined(WIN32_NON_BLOCKING_CONNECTIONS)) && !defined(USE_SSL)
if (PQsetnonblocking(conn, TRUE) != 0)
if (connectMakeNonblocking(conn) == 0)
goto connect_errReturn;
#endif
@@ -868,7 +891,7 @@ connectDBStart(PGconn *conn)
/* This makes the connection non-blocking, for all those cases which forced us
not to do it above. */
#if (defined(WIN32) && !defined(WIN32_NON_BLOCKING_CONNECTIONS)) || defined(USE_SSL)
if (PQsetnonblocking(conn, TRUE) != 0)
if (connectMakeNonblocking(conn) == 0)
goto connect_errReturn;
#endif
@@ -1786,6 +1809,13 @@ closePGconn(PGconn *conn)
(void) pqFlush(conn);
}
/*
* must reset the blocking status so a possible reconnect will work
* don't call PQsetnonblocking() because it will fail if it's unable
* to flush the connection.
*/
conn->nonblocking = FALSE;
/*
* Close the connection, reset all transient state, flush I/O buffers.
*/

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.87 2000/01/18 06:09:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.88 2000/01/24 02:12:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2116,7 +2116,6 @@ PQgetisnull(const PGresult *res, int tup_num, int field_num)
int
PQsetnonblocking(PGconn *conn, int arg)
{
int fcntlarg;
arg = (arg == TRUE) ? 1 : 0;
/* early out if the socket is already in the state requested */
@@ -2131,45 +2130,11 @@ PQsetnonblocking(PGconn *conn, int arg)
* _from_ or _to_ blocking mode, either way we can block them.
*/
/* if we are going from blocking to non-blocking flush here */
if (!pqIsnonblocking(conn) && pqFlush(conn))
if (pqFlush(conn))
return (-1);
#ifdef USE_SSL
if (conn->ssl)
{
printfPQExpBuffer(&conn->errorMessage,
"PQsetnonblocking() -- not supported when using SSL\n");
return (-1);
}
#endif /* USE_SSL */
#ifndef WIN32
fcntlarg = fcntl(conn->sock, F_GETFL, 0);
if (fcntlarg == -1)
return (-1);
if ((arg == TRUE &&
fcntl(conn->sock, F_SETFL, fcntlarg | O_NONBLOCK) == -1) ||
(arg == FALSE &&
fcntl(conn->sock, F_SETFL, fcntlarg & ~O_NONBLOCK) == -1))
#else
fcntlarg = arg;
if (ioctlsocket(conn->sock, FIONBIO, &fcntlarg) != 0)
#endif
{
printfPQExpBuffer(&conn->errorMessage,
"PQsetblocking() -- unable to set nonblocking status to %s\n",
arg == TRUE ? "TRUE" : "FALSE");
return (-1);
}
conn->nonblocking = arg;
/* if we are going from non-blocking to blocking flush here */
if (pqIsnonblocking(conn) && pqFlush(conn))
return (-1);
return (0);
}