1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Separate general purpose functions from portal functions so they may be

used in test drivers.
This commit is contained in:
Bryan Henderson
1996-10-11 09:47:14 +00:00
parent 6d70d550e6
commit 09bb369d23
3 changed files with 111 additions and 74 deletions

View File

@@ -7,17 +7,11 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.2 1996/10/11 09:47:13 bryanh Exp $
*
*-------------------------------------------------------------------------
*/
/*
* UTILITY ROUTINES
* pqdebug - send a string to the debugging output port
* pqdebug2 - send two strings to stdout
* PQtrace - turn on pqdebug() tracing
* PQuntrace - turn off pqdebug() tracing
*
* INTERFACE ROUTINES
* PQnportals - Return the number of open portals.
* PQpnames - Return all the portal names
@@ -70,18 +64,11 @@
#include "utils/exc.h"
#include "utils/palloc.h"
/* ----------------
* exceptions
* ----------------
*/
Exception MemoryError = {"Memory Allocation Error"};
Exception PortalError = {"Invalid arguments to portal functions"};
Exception PostquelError = {"Sql Error"};
Exception ProtocolError = {"Protocol Error"};
char PQerrormsg[ERROR_MSG_LENGTH];
int PQtracep = 0; /* 1 to print out debugging messages */
FILE *debug_port = (FILE *) NULL;
/* ----------------------------------------------------------------
* Helper routines for PQ portal interface routines below
* ----------------------------------------------------------------
*/
static int
in_range(char *msg, int value, int min, int max)
@@ -108,59 +95,6 @@ valid_pointer(char *msg, void *ptr)
return(1);
}
/* ----------------------------------------------------------------
* PQ utility routines
* ----------------------------------------------------------------
*/
void
pqdebug(char *target, char *msg)
{
if (!target)
return;
if (PQtracep) {
/*
* if nothing else was suggested default to stdout
*/
if (!debug_port)
debug_port = stdout;
fprintf(debug_port, target, msg);
fprintf(debug_port, "\n");
}
}
void
pqdebug2(char *target, char *msg1, char *msg2)
{
if (!target)
return;
if (PQtracep) {
/*
* if nothing else was suggested default to stdout
*/
if (!debug_port)
debug_port = stdout;
fprintf(debug_port, target, msg1, msg2);
fprintf(debug_port, "\n");
}
}
/* --------------------------------
* PQtrace() / PQuntrace()
* --------------------------------
*/
void
PQtrace()
{
PQtracep = 1;
}
void
PQuntrace()
{
PQtracep = 0;
}
/* ----------------------------------------------------------------
* PQ portal interface routines