mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpgtcl.h,v 1.3 1997/09/07 05:03:06 momjian Exp $
|
||||
* $Id: libpgtcl.h,v 1.4 1997/09/08 02:40:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "tcl.h"
|
||||
|
||||
extern int Pgtcl_Init(Tcl_Interp * interp);
|
||||
extern int Pgtcl_SafeInit(Tcl_Interp * interp);
|
||||
extern int Pgtcl_Init(Tcl_Interp * interp);
|
||||
extern int Pgtcl_SafeInit(Tcl_Interp * interp);
|
||||
|
||||
#endif /* LIBPGTCL_H */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.8 1997/09/07 05:03:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.9 1997/09/08 02:40:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -34,11 +34,11 @@
|
||||
static void
|
||||
Pgtcl_AtExit(ClientData cData)
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashSearch hsearch;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashSearch hsearch;
|
||||
Pg_ConnectionId *connid;
|
||||
PGconn *conn;
|
||||
PGconn *conn;
|
||||
|
||||
while ((hent = Tcl_FirstHashEntry(&(cd->dbh_hash), &hsearch)) != NULL)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ Pgtcl_Shutdown(ClientData cData, Tcl_Interp * interp)
|
||||
int
|
||||
Pgtcl_Init(Tcl_Interp * interp)
|
||||
{
|
||||
Pg_clientData *cd;
|
||||
Pg_clientData *cd;
|
||||
|
||||
/* Create and initialize the client data area */
|
||||
cd = (Pg_clientData *) ckalloc(sizeof(Pg_clientData));
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.14 1997/09/07 05:03:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.15 1997/09/08 02:40:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,9 +41,9 @@
|
||||
static inline char *
|
||||
translate_escape(char *p, int isArray)
|
||||
{
|
||||
register char c,
|
||||
*q,
|
||||
*s;
|
||||
register char c,
|
||||
*q,
|
||||
*s;
|
||||
|
||||
#ifdef TCL_ARRAYS_DEBUG_ESCAPE
|
||||
printf(" escape = '%s'\n", p);
|
||||
@@ -52,81 +52,82 @@ translate_escape(char *p, int isArray)
|
||||
s = p + 2;
|
||||
switch (c = *(p + 1))
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
c = DIGIT(c);
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
*p = c;
|
||||
break;
|
||||
case 'b':
|
||||
*p = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*p = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*p = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*p = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*p = '\t';
|
||||
break;
|
||||
case 'v':
|
||||
*p = '\v';
|
||||
break;
|
||||
case '\\':
|
||||
case '{':
|
||||
case '}':
|
||||
case '"':
|
||||
|
||||
/*
|
||||
* Backslahes, curly braces and double-quotes are left escaped if
|
||||
* they appear inside an array. They will be unescaped by Tcl in
|
||||
* Tcl_AppendElement. The buffer position is advanced by 1 so that
|
||||
* the this character is not processed again by the caller.
|
||||
*/
|
||||
if (isArray)
|
||||
{
|
||||
return p + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
c = DIGIT(c);
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
*p = c;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
break;
|
||||
case 'b':
|
||||
*p = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*p = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*p = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*p = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*p = '\t';
|
||||
break;
|
||||
case 'v':
|
||||
*p = '\v';
|
||||
break;
|
||||
case '\\':
|
||||
case '{':
|
||||
case '}':
|
||||
case '"':
|
||||
|
||||
/*
|
||||
* This means a backslash at the end of the string. It should
|
||||
* never happen but in that case replace the \ with a \0 but don't
|
||||
* shift the rest of the buffer so that the caller can see the end
|
||||
* of the string and terminate.
|
||||
*/
|
||||
*p = c;
|
||||
return p;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Backslahes, curly braces and double-quotes are left escaped
|
||||
* if they appear inside an array. They will be unescaped by
|
||||
* Tcl in Tcl_AppendElement. The buffer position is advanced
|
||||
* by 1 so that the this character is not processed again by
|
||||
* the caller.
|
||||
*/
|
||||
if (isArray)
|
||||
{
|
||||
return p + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = c;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
|
||||
/*
|
||||
* Default case, store the escaped character over the backslash
|
||||
* and shift the buffer over itself.
|
||||
*/
|
||||
*p = c;
|
||||
/*
|
||||
* This means a backslash at the end of the string. It should
|
||||
* never happen but in that case replace the \ with a \0 but
|
||||
* don't shift the rest of the buffer so that the caller can
|
||||
* see the end of the string and terminate.
|
||||
*/
|
||||
*p = c;
|
||||
return p;
|
||||
break;
|
||||
default:
|
||||
|
||||
/*
|
||||
* Default case, store the escaped character over the
|
||||
* backslash and shift the buffer over itself.
|
||||
*/
|
||||
*p = c;
|
||||
}
|
||||
/* Shift the rest of the buffer over itself after the current char */
|
||||
q = p + 1;
|
||||
@@ -149,12 +150,12 @@ translate_escape(char *p, int isArray)
|
||||
* representation of a postgres array.
|
||||
*/
|
||||
|
||||
static char *
|
||||
static char *
|
||||
tcl_value(char *value)
|
||||
{
|
||||
int literal,
|
||||
last;
|
||||
register char *p;
|
||||
int literal,
|
||||
last;
|
||||
register char *p;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
@@ -179,12 +180,12 @@ tcl_value(char *value)
|
||||
/* We are at the list level, look for ',' and '"' */
|
||||
switch (*p)
|
||||
{
|
||||
case '"': /* beginning of literal */
|
||||
literal = 1;
|
||||
break;
|
||||
case ',': /* replace the ',' with space */
|
||||
*p = ' ';
|
||||
break;
|
||||
case '"': /* beginning of literal */
|
||||
literal = 1;
|
||||
break;
|
||||
case ',': /* replace the ',' with space */
|
||||
*p = ' ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -192,16 +193,16 @@ tcl_value(char *value)
|
||||
/* We are inside a C string */
|
||||
switch (*p)
|
||||
{
|
||||
case '"': /* end of literal */
|
||||
literal = 0;
|
||||
break;
|
||||
case '\\':
|
||||
case '"': /* end of literal */
|
||||
literal = 0;
|
||||
break;
|
||||
case '\\':
|
||||
|
||||
/*
|
||||
* escape sequence, translate it
|
||||
*/
|
||||
p = translate_escape(p, 1);
|
||||
break;
|
||||
/*
|
||||
* escape sequence, translate it
|
||||
*/
|
||||
p = translate_escape(p, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*p)
|
||||
@@ -255,7 +256,7 @@ int
|
||||
Pg_conndefaults(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
|
||||
{
|
||||
PQconninfoOption *option;
|
||||
char buf[8192];
|
||||
char buf[8192];
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
for (option = PQconndefaults(); option->keyword != NULL; option++)
|
||||
@@ -292,14 +293,14 @@ Pg_conndefaults(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
|
||||
int
|
||||
Pg_connect(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
char *pghost = NULL;
|
||||
char *pgtty = NULL;
|
||||
char *pgport = NULL;
|
||||
char *pgoptions = NULL;
|
||||
char *dbName;
|
||||
int i;
|
||||
PGconn *conn;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
char *pghost = NULL;
|
||||
char *pgtty = NULL;
|
||||
char *pgport = NULL;
|
||||
char *pgoptions = NULL;
|
||||
char *dbName;
|
||||
int i;
|
||||
PGconn *conn;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
@@ -404,8 +405,8 @@ Pg_connect(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_disconnect(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
@@ -439,9 +440,9 @@ Pg_disconnect(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_exec(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -507,15 +508,15 @@ Pg_exec(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGresult *result;
|
||||
char *opt;
|
||||
int i;
|
||||
int tupno;
|
||||
char prearrayInd[MAX_MESSAGE_LEN];
|
||||
char arrayInd[MAX_MESSAGE_LEN];
|
||||
char *appendstr;
|
||||
char *arrVar;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGresult *result;
|
||||
char *opt;
|
||||
int i;
|
||||
int tupno;
|
||||
char prearrayInd[MAX_MESSAGE_LEN];
|
||||
char arrayInd[MAX_MESSAGE_LEN];
|
||||
char *appendstr;
|
||||
char *arrVar;
|
||||
|
||||
if (argc != 3 && argc != 4 && argc != 5)
|
||||
{
|
||||
@@ -669,7 +670,7 @@ Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
}
|
||||
else if (strcmp(opt, "-lAttributes") == 0)
|
||||
{
|
||||
char buf[512];
|
||||
char buf[512];
|
||||
|
||||
Tcl_ResetResult(interp);
|
||||
for (i = 0; i < PQnfields(result); i++)
|
||||
@@ -726,11 +727,11 @@ Pg_result_errReturn:
|
||||
int
|
||||
Pg_lo_open(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int lobjId;
|
||||
int mode;
|
||||
int fd;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int lobjId;
|
||||
int mode;
|
||||
int fd;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
@@ -755,33 +756,33 @@ Pg_lo_open(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
}
|
||||
switch (argv[3][0])
|
||||
{
|
||||
case 'r':
|
||||
case 'R':
|
||||
mode = INV_READ;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
mode = INV_WRITE;
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
|
||||
return TCL_ERROR;
|
||||
case 'r':
|
||||
case 'R':
|
||||
mode = INV_READ;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
mode = INV_WRITE;
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
switch (argv[3][1])
|
||||
{
|
||||
case '\0':
|
||||
break;
|
||||
case 'r':
|
||||
case 'R':
|
||||
mode = mode & INV_READ;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
mode = mode & INV_WRITE;
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
|
||||
return TCL_ERROR;
|
||||
case '\0':
|
||||
break;
|
||||
case 'r':
|
||||
case 'R':
|
||||
mode = mode & INV_READ;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
mode = mode & INV_WRITE;
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
fd = lo_open(conn, lobjId, mode);
|
||||
@@ -800,9 +801,9 @@ Pg_lo_open(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_lo_close(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -837,13 +838,13 @@ Pg_lo_close(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_lo_read(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
int nbytes = 0;
|
||||
char *buf;
|
||||
char *bufVar;
|
||||
int len;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
int nbytes = 0;
|
||||
char *buf;
|
||||
char *bufVar;
|
||||
int len;
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
@@ -892,12 +893,12 @@ Pg_lo_write
|
||||
int
|
||||
Pg_lo_write(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *buf;
|
||||
int fd;
|
||||
int nbytes = 0;
|
||||
int len;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *buf;
|
||||
int fd;
|
||||
int nbytes = 0;
|
||||
int len;
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
@@ -943,12 +944,12 @@ whence can be either
|
||||
int
|
||||
Pg_lo_lseek(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
char *whenceStr;
|
||||
int offset,
|
||||
whence;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
char *whenceStr;
|
||||
int offset,
|
||||
whence;
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
@@ -1006,11 +1007,11 @@ for now, we don't support any additional storage managers.
|
||||
int
|
||||
Pg_lo_creat(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *modeStr;
|
||||
char *modeWord;
|
||||
int mode;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *modeStr;
|
||||
char *modeWord;
|
||||
int mode;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -1086,9 +1087,9 @@ Pg_lo_tell
|
||||
int
|
||||
Pg_lo_tell(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int fd;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -1123,10 +1124,10 @@ Pg_lo_unlink
|
||||
int
|
||||
Pg_lo_unlink(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int lobjId;
|
||||
int retval;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
int lobjId;
|
||||
int retval;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -1169,10 +1170,10 @@ Pg_lo_import
|
||||
int
|
||||
Pg_lo_import(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *filename;
|
||||
Oid lobjId;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *filename;
|
||||
Oid lobjId;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@@ -1212,11 +1213,11 @@ Pg_lo_export
|
||||
int
|
||||
Pg_lo_export(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *filename;
|
||||
Oid lobjId;
|
||||
int retval;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
char *filename;
|
||||
Oid lobjId;
|
||||
int retval;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
@@ -1268,20 +1269,20 @@ Pg_lo_export(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
int r;
|
||||
size_t tupno,
|
||||
column,
|
||||
ncols;
|
||||
Tcl_DString headers;
|
||||
char buffer[2048];
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
int r;
|
||||
size_t tupno,
|
||||
column,
|
||||
ncols;
|
||||
Tcl_DString headers;
|
||||
char buffer[2048];
|
||||
struct
|
||||
{
|
||||
char *cname;
|
||||
int change;
|
||||
} *info;
|
||||
char *cname;
|
||||
int change;
|
||||
} *info;
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
@@ -1343,7 +1344,7 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
|
||||
|
||||
if (r == TCL_ERROR)
|
||||
{
|
||||
char msg[60];
|
||||
char msg[60];
|
||||
|
||||
sprintf(msg, "\n (\"pg_select\" body line %d)",
|
||||
interp->errorLine);
|
||||
@@ -1363,13 +1364,13 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
|
||||
int
|
||||
Pg_listen(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
int new;
|
||||
char *relname;
|
||||
char *callback = NULL;
|
||||
Tcl_HashEntry *entry;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
int new;
|
||||
char *relname;
|
||||
char *callback = NULL;
|
||||
Tcl_HashEntry *entry;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
|
||||
if ((argc < 3) || (argc > 4))
|
||||
{
|
||||
@@ -1404,7 +1405,7 @@ Pg_listen(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
if (new)
|
||||
{
|
||||
/* New callback, execute a listen command on the relation */
|
||||
char *cmd = (char *) ckalloc((unsigned) (strlen(argv[2]) + 8));
|
||||
char *cmd = (char *) ckalloc((unsigned) (strlen(argv[2]) + 8));
|
||||
|
||||
sprintf(cmd, "LISTEN %s", relname);
|
||||
result = PQexec(conn, cmd);
|
||||
@@ -1452,14 +1453,14 @@ Pg_listen(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
int
|
||||
Pg_notifies(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
|
||||
{
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
int count;
|
||||
char buff[12];
|
||||
char *callback;
|
||||
Tcl_HashEntry *entry;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
PGnotify *notify;
|
||||
Pg_clientData *cd = (Pg_clientData *) cData;
|
||||
int count;
|
||||
char buff[12];
|
||||
char *callback;
|
||||
Tcl_HashEntry *entry;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
PGnotify *notify;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pgtclCmds.h,v 1.7 1997/09/07 05:03:12 momjian Exp $
|
||||
* $Id: pgtclCmds.h,v 1.8 1997/09/08 02:40:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -20,28 +20,28 @@
|
||||
|
||||
typedef struct Pg_clientData_s
|
||||
{
|
||||
Tcl_HashTable dbh_hash;
|
||||
Tcl_HashTable res_hash;
|
||||
Tcl_HashTable notify_hash;
|
||||
long dbh_count;
|
||||
long res_count;
|
||||
} Pg_clientData;
|
||||
Tcl_HashTable dbh_hash;
|
||||
Tcl_HashTable res_hash;
|
||||
Tcl_HashTable notify_hash;
|
||||
long dbh_count;
|
||||
long res_count;
|
||||
} Pg_clientData;
|
||||
|
||||
|
||||
typedef struct Pg_ConnectionId_s
|
||||
{
|
||||
char id[32];
|
||||
PGconn *conn;
|
||||
Tcl_HashTable res_hash;
|
||||
} Pg_ConnectionId;
|
||||
char id[32];
|
||||
PGconn *conn;
|
||||
Tcl_HashTable res_hash;
|
||||
} Pg_ConnectionId;
|
||||
|
||||
|
||||
typedef struct Pg_ResultId_s
|
||||
{
|
||||
char id[32];
|
||||
PGresult *result;
|
||||
char id[32];
|
||||
PGresult *result;
|
||||
Pg_ConnectionId *connection;
|
||||
} Pg_ResultId;
|
||||
} Pg_ResultId;
|
||||
|
||||
|
||||
/* **************************/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.4 1997/09/07 05:03:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.5 1997/09/08 02:40:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,9 +31,9 @@
|
||||
void
|
||||
PgSetConnectionId(Pg_clientData * cd, char *id, PGconn * conn)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ConnectionId *connid;
|
||||
int hnew;
|
||||
int hnew;
|
||||
|
||||
connid = (Pg_ConnectionId *) ckalloc(sizeof(Pg_ConnectionId));
|
||||
connid->conn = conn;
|
||||
@@ -49,10 +49,10 @@ PgSetConnectionId(Pg_clientData * cd, char *id, PGconn * conn)
|
||||
/*
|
||||
* Get back the connection from the Id
|
||||
*/
|
||||
PGconn *
|
||||
PGconn *
|
||||
PgGetConnectionId(Pg_clientData * cd, char *id)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ConnectionId *connid;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->dbh_hash), id);
|
||||
@@ -73,12 +73,12 @@ PgGetConnectionId(Pg_clientData * cd, char *id)
|
||||
void
|
||||
PgDelConnectionId(Pg_clientData * cd, char *id)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent2;
|
||||
Tcl_HashEntry *hent3;
|
||||
Tcl_HashSearch hsearch;
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent2;
|
||||
Tcl_HashEntry *hent3;
|
||||
Tcl_HashSearch hsearch;
|
||||
Pg_ConnectionId *connid;
|
||||
Pg_ResultId *resid;
|
||||
Pg_ResultId *resid;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->dbh_hash), id);
|
||||
if (hent == NULL)
|
||||
@@ -113,10 +113,10 @@ PgDelConnectionId(Pg_clientData * cd, char *id)
|
||||
void
|
||||
PgSetResultId(Pg_clientData * cd, char *id, char *connid_c, PGresult * res)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ConnectionId *connid;
|
||||
Pg_ResultId *resid;
|
||||
int hnew;
|
||||
Pg_ResultId *resid;
|
||||
int hnew;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->dbh_hash), connid_c);
|
||||
if (hent == NULL)
|
||||
@@ -148,11 +148,11 @@ PgSetResultId(Pg_clientData * cd, char *id, char *connid_c, PGresult * res)
|
||||
/*
|
||||
* Get back the result pointer from the Id
|
||||
*/
|
||||
PGresult *
|
||||
PGresult *
|
||||
PgGetResultId(Pg_clientData * cd, char *id)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ResultId *resid;
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ResultId *resid;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->res_hash), id);
|
||||
if (hent == NULL)
|
||||
@@ -171,9 +171,9 @@ PgGetResultId(Pg_clientData * cd, char *id)
|
||||
void
|
||||
PgDelResultId(Pg_clientData * cd, char *id)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent2;
|
||||
Pg_ResultId *resid;
|
||||
Tcl_HashEntry *hent;
|
||||
Tcl_HashEntry *hent2;
|
||||
Pg_ResultId *resid;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->res_hash), id);
|
||||
if (hent == NULL)
|
||||
@@ -202,8 +202,8 @@ PgDelResultId(Pg_clientData * cd, char *id)
|
||||
void
|
||||
PgGetConnByResultId(Pg_clientData * cd, char *id, char *resid_c)
|
||||
{
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ResultId *resid;
|
||||
Tcl_HashEntry *hent;
|
||||
Pg_ResultId *resid;
|
||||
|
||||
hent = Tcl_FindHashEntry(&(cd->res_hash), id);
|
||||
if (hent == NULL)
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pgtclId.h,v 1.3 1997/09/07 05:03:14 momjian Exp $
|
||||
* $Id: pgtclId.h,v 1.4 1997/09/08 02:40:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void PgSetConnectionId(Pg_clientData * cd, char *id, PGconn * conn);
|
||||
extern PGconn *PgGetConnectionId(Pg_clientData * cd, char *id);
|
||||
extern void PgDelConnectionId(Pg_clientData * cd, char *id);
|
||||
extern void PgSetResultId(Pg_clientData * cd, char *id, char *connid, PGresult * res);
|
||||
extern void PgSetConnectionId(Pg_clientData * cd, char *id, PGconn * conn);
|
||||
extern PGconn *PgGetConnectionId(Pg_clientData * cd, char *id);
|
||||
extern void PgDelConnectionId(Pg_clientData * cd, char *id);
|
||||
extern void PgSetResultId(Pg_clientData * cd, char *id, char *connid, PGresult * res);
|
||||
extern PGresult *PgGetResultId(Pg_clientData * cd, char *id);
|
||||
extern void PgDelResultId(Pg_clientData * cd, char *id);
|
||||
extern void PgGetConnByResultId(Pg_clientData * cd, char *id, char *resid);
|
||||
extern void PgDelResultId(Pg_clientData * cd, char *id);
|
||||
extern void PgGetConnByResultId(Pg_clientData * cd, char *id, char *resid);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.9 1997/09/07 05:03:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.10 1997/09/08 02:40:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,9 +49,9 @@
|
||||
|
||||
struct authsvc
|
||||
{
|
||||
char name[16]; /* service nickname (for command line) */
|
||||
MsgType msgtype; /* startup packet header type */
|
||||
int allowed; /* initially allowed (before command line
|
||||
char name[16]; /* service nickname (for command line) */
|
||||
MsgType msgtype; /* startup packet header type */
|
||||
int allowed; /* initially allowed (before command line
|
||||
* option parsing)? */
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ static struct authsvc authsvcs[] = {
|
||||
{"password", STARTUP_PASSWORD_MSG, 0}
|
||||
};
|
||||
|
||||
static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
|
||||
static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
|
||||
|
||||
#ifdef KRB4
|
||||
/*----------------------------------------------------------------
|
||||
@@ -95,7 +95,7 @@ static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
|
||||
#include "krb.h"
|
||||
|
||||
/* for some reason, this is not defined in krb.h ... */
|
||||
extern char *tkt_string(void);
|
||||
extern char *tkt_string(void);
|
||||
|
||||
/*
|
||||
* pg_krb4_init -- initialization performed before any Kerberos calls are made
|
||||
@@ -107,8 +107,8 @@ extern char *tkt_string(void);
|
||||
static void
|
||||
pg_krb4_init()
|
||||
{
|
||||
char *realm;
|
||||
static init_done = 0;
|
||||
char *realm;
|
||||
static init_done = 0;
|
||||
|
||||
if (init_done)
|
||||
return;
|
||||
@@ -120,7 +120,7 @@ pg_krb4_init()
|
||||
*/
|
||||
if (realm = getenv("PGREALM"))
|
||||
{
|
||||
char tktbuf[MAXPATHLEN];
|
||||
char tktbuf[MAXPATHLEN];
|
||||
|
||||
(void) sprintf(tktbuf, "%s@%s", tkt_string(), realm);
|
||||
krb_set_tkt_string(tktbuf);
|
||||
@@ -133,13 +133,13 @@ pg_krb4_init()
|
||||
*
|
||||
* We obtain this information by digging around in the ticket file.
|
||||
*/
|
||||
static char *
|
||||
static char *
|
||||
pg_krb4_authname(char *PQerrormsg)
|
||||
{
|
||||
char instance[INST_SZ];
|
||||
char realm[REALM_SZ];
|
||||
int status;
|
||||
static char name[SNAME_SZ + 1] = "";
|
||||
char instance[INST_SZ];
|
||||
char realm[REALM_SZ];
|
||||
int status;
|
||||
static char name[SNAME_SZ + 1] = "";
|
||||
|
||||
if (name[0])
|
||||
return (name);
|
||||
@@ -178,11 +178,11 @@ pg_krb4_sendauth(const char *PQerrormsg, int sock,
|
||||
struct sockaddr_in * raddr,
|
||||
const char *hostname)
|
||||
{
|
||||
long krbopts = 0;/* one-way authentication */
|
||||
KTEXT_ST clttkt;
|
||||
int status;
|
||||
char hostbuf[MAXHOSTNAMELEN];
|
||||
const char *realm = getenv("PGREALM"); /* NULL == current realm */
|
||||
long krbopts = 0; /* one-way authentication */
|
||||
KTEXT_ST clttkt;
|
||||
int status;
|
||||
char hostbuf[MAXHOSTNAMELEN];
|
||||
const char *realm = getenv("PGREALM"); /* NULL == current realm */
|
||||
|
||||
if (!hostname || !(*hostname))
|
||||
{
|
||||
@@ -239,10 +239,10 @@ pg_krb4_sendauth(const char *PQerrormsg, int sock,
|
||||
* krb5_an_to_ln, except that it punts if multiple components are found,
|
||||
* and we can't afford to punt.
|
||||
*/
|
||||
static char *
|
||||
static char *
|
||||
pg_an_to_ln(const char *aname)
|
||||
{
|
||||
char *p;
|
||||
char *p;
|
||||
|
||||
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
|
||||
*p = '\0';
|
||||
@@ -259,13 +259,13 @@ pg_an_to_ln(const char *aname)
|
||||
*
|
||||
*/
|
||||
static int
|
||||
krb5_ccache
|
||||
krb5_ccache
|
||||
pg_krb5_init(void)
|
||||
{
|
||||
krb5_error_code code;
|
||||
char *realm,
|
||||
*defname;
|
||||
char tktbuf[MAXPATHLEN];
|
||||
char *realm,
|
||||
*defname;
|
||||
char tktbuf[MAXPATHLEN];
|
||||
static krb5_ccache ccache = (krb5_ccache) NULL;
|
||||
|
||||
if (ccache)
|
||||
@@ -308,10 +308,10 @@ pg_krb5_init(void)
|
||||
static const char *
|
||||
pg_krb5_authname(const char *PQerrormsg)
|
||||
{
|
||||
krb5_ccache ccache;
|
||||
krb5_principal principal;
|
||||
krb5_ccache ccache;
|
||||
krb5_principal principal;
|
||||
krb5_error_code code;
|
||||
static char *authname = (char *) NULL;
|
||||
static char *authname = (char *) NULL;
|
||||
|
||||
if (authname)
|
||||
return (authname);
|
||||
@@ -360,15 +360,15 @@ pg_krb5_sendauth(const char *PQerrormsg, int sock,
|
||||
struct sockaddr_in * raddr,
|
||||
const char *hostname)
|
||||
{
|
||||
char servbuf[MAXHOSTNAMELEN + 1 +
|
||||
sizeof(PG_KRB_SRVNAM)];
|
||||
const char *hostp;
|
||||
const char *realm;
|
||||
char servbuf[MAXHOSTNAMELEN + 1 +
|
||||
sizeof(PG_KRB_SRVNAM)];
|
||||
const char *hostp;
|
||||
const char *realm;
|
||||
krb5_error_code code;
|
||||
krb5_principal client,
|
||||
server;
|
||||
krb5_ccache ccache;
|
||||
krb5_error *error = (krb5_error *) NULL;
|
||||
krb5_principal client,
|
||||
server;
|
||||
krb5_ccache ccache;
|
||||
krb5_error *error = (krb5_error *) NULL;
|
||||
|
||||
ccache = pg_krb5_init(); /* don't free this */
|
||||
|
||||
@@ -459,8 +459,8 @@ pg_krb5_sendauth(const char *PQerrormsg, int sock,
|
||||
static int
|
||||
pg_password_sendauth(Port * port, const char *user, const char *password)
|
||||
{
|
||||
PacketBuf buf;
|
||||
char *tmp;
|
||||
PacketBuf buf;
|
||||
char *tmp;
|
||||
|
||||
buf.len = htonl(sizeof(PacketBuf));
|
||||
buf.msgtype = STARTUP_PASSWORD_MSG;
|
||||
@@ -484,36 +484,36 @@ fe_sendauth(MsgType msgtype, Port * port, const char *hostname,
|
||||
switch (msgtype)
|
||||
{
|
||||
#ifdef KRB4
|
||||
case STARTUP_KRB4_MSG:
|
||||
if (pg_krb4_sendauth(PQerrormsg, port->sock, &port->laddr,
|
||||
&port->raddr,
|
||||
hostname) != STATUS_OK)
|
||||
{
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_sendauth: krb4 authentication failed\n");
|
||||
case STARTUP_KRB4_MSG:
|
||||
if (pg_krb4_sendauth(PQerrormsg, port->sock, &port->laddr,
|
||||
&port->raddr,
|
||||
hostname) != STATUS_OK)
|
||||
{
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_sendauth: krb4 authentication failed\n");
|
||||
/* fputs(PQerrormsg, stderr); */
|
||||
return (STATUS_ERROR);
|
||||
}
|
||||
break;
|
||||
return (STATUS_ERROR);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef KRB5
|
||||
case STARTUP_KRB5_MSG:
|
||||
if (pg_krb5_sendauth(PQerrormsg, port->sock, &port->laddr,
|
||||
&port->raddr,
|
||||
hostname) != STATUS_OK)
|
||||
{
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_sendauth: krb5 authentication failed\n");
|
||||
return (STATUS_ERROR);
|
||||
}
|
||||
break;
|
||||
case STARTUP_KRB5_MSG:
|
||||
if (pg_krb5_sendauth(PQerrormsg, port->sock, &port->laddr,
|
||||
&port->raddr,
|
||||
hostname) != STATUS_OK)
|
||||
{
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_sendauth: krb5 authentication failed\n");
|
||||
return (STATUS_ERROR);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case STARTUP_MSG:
|
||||
break;
|
||||
case STARTUP_PASSWORD_MSG:
|
||||
pg_password_sendauth(port, user, password);
|
||||
default:
|
||||
break;
|
||||
case STARTUP_MSG:
|
||||
break;
|
||||
case STARTUP_PASSWORD_MSG:
|
||||
pg_password_sendauth(port, user, password);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (STATUS_OK);
|
||||
}
|
||||
@@ -525,12 +525,12 @@ fe_sendauth(MsgType msgtype, Port * port, const char *hostname,
|
||||
* Set/return the authentication service currently selected for use by the
|
||||
* frontend. (You can only use one in the frontend, obviously.)
|
||||
*/
|
||||
static pg_authsvc = -1;
|
||||
static pg_authsvc = -1;
|
||||
|
||||
void
|
||||
fe_setauthsvc(const char *name, char *PQerrormsg)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_authsvcs; ++i)
|
||||
if (!strcmp(name, authsvcs[i].name))
|
||||
@@ -560,39 +560,39 @@ fe_getauthsvc(char *PQerrormsg)
|
||||
* name the user has authenticated to the system
|
||||
* if there is an error, return the error message in PQerrormsg
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
fe_getauthname(char *PQerrormsg)
|
||||
{
|
||||
char *name = (char *) NULL;
|
||||
char *authn = (char *) NULL;
|
||||
MsgType authsvc;
|
||||
char *name = (char *) NULL;
|
||||
char *authn = (char *) NULL;
|
||||
MsgType authsvc;
|
||||
|
||||
authsvc = fe_getauthsvc(PQerrormsg);
|
||||
switch ((int) authsvc)
|
||||
{
|
||||
#ifdef KRB4
|
||||
case STARTUP_KRB4_MSG:
|
||||
name = pg_krb4_authname(PQerrormsg);
|
||||
break;
|
||||
case STARTUP_KRB4_MSG:
|
||||
name = pg_krb4_authname(PQerrormsg);
|
||||
break;
|
||||
#endif
|
||||
#ifdef KRB5
|
||||
case STARTUP_KRB5_MSG:
|
||||
name = pg_krb5_authname(PQerrormsg);
|
||||
break;
|
||||
case STARTUP_KRB5_MSG:
|
||||
name = pg_krb5_authname(PQerrormsg);
|
||||
break;
|
||||
#endif
|
||||
case STARTUP_MSG:
|
||||
{
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
case STARTUP_MSG:
|
||||
{
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
|
||||
if (pw)
|
||||
name = pw->pw_name;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(void) sprintf(PQerrormsg,
|
||||
if (pw)
|
||||
name = pw->pw_name;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_getauthname: invalid authentication system: %d\n",
|
||||
authsvc);
|
||||
break;
|
||||
authsvc);
|
||||
break;
|
||||
}
|
||||
|
||||
if (name && (authn = (char *) malloc(strlen(name) + 1)))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: fe-auth.h,v 1.4 1997/09/07 05:03:21 momjian Exp $
|
||||
* $Id: fe-auth.h,v 1.5 1997/09/08 02:40:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ extern int
|
||||
fe_sendauth(MsgType msgtype, Port * port, const char *hostname,
|
||||
const char *user, const char *password,
|
||||
const char *PQerromsg);
|
||||
extern void fe_setauthsvc(const char *name, char *PQerrormsg);
|
||||
extern void fe_setauthsvc(const char *name, char *PQerrormsg);
|
||||
|
||||
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
|
||||
#define PG_KRB5_VERSION "PGVER5.1"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.39 1997/09/07 05:03:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.40 1997/09/08 02:40:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,12 +41,12 @@
|
||||
/* use a local version instead of the one found in pqpacket.c */
|
||||
static ConnStatusType connectDB(PGconn * conn);
|
||||
|
||||
static void startup2PacketBuf(StartupInfo * s, PacketBuf * res);
|
||||
static void freePGconn(PGconn * conn);
|
||||
static void closePGconn(PGconn * conn);
|
||||
static int conninfo_parse(const char *conninfo, char *errorMessage);
|
||||
static char *conninfo_getval(char *keyword);
|
||||
static void conninfo_free(void);
|
||||
static void startup2PacketBuf(StartupInfo * s, PacketBuf * res);
|
||||
static void freePGconn(PGconn * conn);
|
||||
static void closePGconn(PGconn * conn);
|
||||
static int conninfo_parse(const char *conninfo, char *errorMessage);
|
||||
static char *conninfo_getval(char *keyword);
|
||||
static void conninfo_free(void);
|
||||
|
||||
#define NOTIFYLIST_INITIAL_SIZE 10
|
||||
#define NOTIFYLIST_GROWBY 10
|
||||
@@ -104,9 +104,9 @@ static PQconninfoOption PQconninfoOptions[] = {
|
||||
|
||||
struct EnvironmentOptions
|
||||
{
|
||||
const char *envName,
|
||||
*pgName;
|
||||
} EnvironmentOptions[] =
|
||||
const char *envName,
|
||||
*pgName;
|
||||
} EnvironmentOptions[] =
|
||||
|
||||
{
|
||||
{
|
||||
@@ -136,12 +136,12 @@ struct EnvironmentOptions
|
||||
* then some fields may be null'ed out instead of having valid values
|
||||
* ----------------
|
||||
*/
|
||||
PGconn *
|
||||
PGconn *
|
||||
PQconnectdb(const char *conninfo)
|
||||
{
|
||||
PGconn *conn;
|
||||
PGconn *conn;
|
||||
PQconninfoOption *option;
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
|
||||
/* ----------
|
||||
* Allocate memory for the conn structure
|
||||
@@ -240,7 +240,7 @@ PQconnectdb(const char *conninfo)
|
||||
conn->status = connectDB(conn);
|
||||
if (conn->status == CONNECTION_OK)
|
||||
{
|
||||
PGresult *res;
|
||||
PGresult *res;
|
||||
|
||||
/*
|
||||
* Send a blank query to make sure everything works; in
|
||||
@@ -270,7 +270,7 @@ PQconnectdb(const char *conninfo)
|
||||
PQconninfoOption *
|
||||
PQconndefaults(void)
|
||||
{
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
|
||||
conninfo_parse("", errorMessage);
|
||||
return PQconninfoOptions;
|
||||
@@ -311,18 +311,18 @@ PQconndefaults(void)
|
||||
*
|
||||
* ----------------
|
||||
*/
|
||||
PGconn *
|
||||
PGconn *
|
||||
PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName)
|
||||
{
|
||||
PGconn *conn;
|
||||
char *tmp;
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
PGconn *conn;
|
||||
char *tmp;
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
|
||||
/* An error message from some service we call. */
|
||||
bool error;
|
||||
bool error;
|
||||
|
||||
/* We encountered an error that prevents successful completion */
|
||||
int i;
|
||||
int i;
|
||||
|
||||
conn = (PGconn *) malloc(sizeof(PGconn));
|
||||
|
||||
@@ -436,7 +436,7 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
|
||||
/* Puts message in conn->errorMessage */
|
||||
if (conn->status == CONNECTION_OK)
|
||||
{
|
||||
PGresult *res;
|
||||
PGresult *res;
|
||||
|
||||
/*
|
||||
* Send a blank query to make sure everything works; in
|
||||
@@ -462,18 +462,18 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
|
||||
* return CONNECTION_OK if successful, CONNECTION_BAD if not.
|
||||
*
|
||||
*/
|
||||
static ConnStatusType
|
||||
static ConnStatusType
|
||||
connectDB(PGconn * conn)
|
||||
{
|
||||
struct hostent *hp;
|
||||
|
||||
StartupInfo startup;
|
||||
PacketBuf pacBuf;
|
||||
int status;
|
||||
MsgType msgtype;
|
||||
int laddrlen = sizeof(struct sockaddr);
|
||||
Port *port = conn->port;
|
||||
int portno;
|
||||
StartupInfo startup;
|
||||
PacketBuf pacBuf;
|
||||
int status;
|
||||
MsgType msgtype;
|
||||
int laddrlen = sizeof(struct sockaddr);
|
||||
Port *port = conn->port;
|
||||
int portno;
|
||||
|
||||
/*
|
||||
* Initialize the startup packet.
|
||||
@@ -534,7 +534,7 @@ connectDB(PGconn * conn)
|
||||
}
|
||||
{
|
||||
struct protoent *pe;
|
||||
int on = 1;
|
||||
int on = 1;
|
||||
|
||||
pe = getprotobyname("TCP");
|
||||
if (pe == NULL)
|
||||
@@ -609,15 +609,15 @@ connectDB(PGconn * conn)
|
||||
|
||||
{
|
||||
struct EnvironmentOptions *eo;
|
||||
char setQuery[80]; /* mjl: size okay? XXX */
|
||||
char setQuery[80]; /* mjl: size okay? XXX */
|
||||
|
||||
for (eo = EnvironmentOptions; eo->envName; eo++)
|
||||
{
|
||||
const char *val;
|
||||
const char *val;
|
||||
|
||||
if ((val = getenv(eo->envName)))
|
||||
{
|
||||
PGresult *res;
|
||||
PGresult *res;
|
||||
|
||||
sprintf(setQuery, "SET %s TO '%.60s'", eo->pgName, val);
|
||||
res = PQexec(conn, setQuery);
|
||||
@@ -699,7 +699,7 @@ closePGconn(PGconn * conn)
|
||||
fflush(conn->Pfout);
|
||||
sigaction(SIGPIPE, &oldaction, NULL);
|
||||
#else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fputs("X\0", conn->Pfout);
|
||||
fflush(conn->Pfout);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
@@ -773,8 +773,8 @@ packetSend(Port * port,
|
||||
PacketLen len,
|
||||
bool nonBlocking)
|
||||
{
|
||||
PacketLen totalLen;
|
||||
int addrLen = sizeof(struct sockaddr_in);
|
||||
PacketLen totalLen;
|
||||
int addrLen = sizeof(struct sockaddr_in);
|
||||
|
||||
totalLen = len;
|
||||
|
||||
@@ -800,7 +800,7 @@ packetSend(Port * port,
|
||||
static void
|
||||
startup2PacketBuf(StartupInfo * s, PacketBuf * res)
|
||||
{
|
||||
char *tmp;
|
||||
char *tmp;
|
||||
|
||||
/* res = (PacketBuf*)malloc(sizeof(PacketBuf)); */
|
||||
res->len = htonl(sizeof(PacketBuf));
|
||||
@@ -827,14 +827,14 @@ startup2PacketBuf(StartupInfo * s, PacketBuf * res)
|
||||
static int
|
||||
conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
{
|
||||
char *pname;
|
||||
char *pval;
|
||||
char *buf;
|
||||
char *tmp;
|
||||
char *cp;
|
||||
char *cp2;
|
||||
char *pname;
|
||||
char *pval;
|
||||
char *buf;
|
||||
char *tmp;
|
||||
char *cp;
|
||||
char *cp2;
|
||||
PQconninfoOption *option;
|
||||
char errortmp[ERROR_MSG_LENGTH];
|
||||
char errortmp[ERROR_MSG_LENGTH];
|
||||
|
||||
conninfo_free();
|
||||
|
||||
@@ -1054,7 +1054,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
static char *
|
||||
conninfo_getval(char *keyword)
|
||||
{
|
||||
PQconninfoOption *option;
|
||||
@@ -1087,7 +1087,7 @@ conninfo_free()
|
||||
}
|
||||
|
||||
/* =========== accessor functions for PGconn ========= */
|
||||
char *
|
||||
char *
|
||||
PQdb(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1098,7 +1098,7 @@ PQdb(PGconn * conn)
|
||||
return conn->dbName;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQuser(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1109,7 +1109,7 @@ PQuser(PGconn * conn)
|
||||
return conn->pguser;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQhost(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1121,7 +1121,7 @@ PQhost(PGconn * conn)
|
||||
return conn->pghost;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQoptions(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1132,7 +1132,7 @@ PQoptions(PGconn * conn)
|
||||
return conn->pgoptions;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQtty(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1143,7 +1143,7 @@ PQtty(PGconn * conn)
|
||||
return conn->pgtty;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQport(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
@@ -1165,7 +1165,7 @@ PQstatus(PGconn * conn)
|
||||
return conn->status;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
PQerrorMessage(PGconn * conn)
|
||||
{
|
||||
if (!conn)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: fe-connect.h,v 1.2 1997/09/07 05:03:26 momjian Exp $
|
||||
* $Id: fe-connect.h,v 1.3 1997/09/08 02:40:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -18,12 +18,12 @@
|
||||
*----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern int packetSend(Port * port, PacketBuf * buf, PacketLen len, bool nonBlocking);
|
||||
extern int packetSend(Port * port, PacketBuf * buf, PacketLen len, bool nonBlocking);
|
||||
|
||||
#endif /* FE_CONNECT_H */
|
||||
#ifndef FE_CONNECT_H
|
||||
#define FE_CONNECT_H
|
||||
|
||||
int packetSend(Port * port, PacketBuf * buf, PacketLen len, bool nonBlocking);
|
||||
int packetSend(Port * port, PacketBuf * buf, PacketLen len, bool nonBlocking);
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.8 1997/09/07 05:03:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.9 1997/09/08 02:40:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#define LO_BUFSIZE 1024
|
||||
|
||||
static int lo_initialize(PGconn * conn);
|
||||
static int lo_initialize(PGconn * conn);
|
||||
|
||||
/*
|
||||
* lo_open
|
||||
@@ -35,10 +35,10 @@ static int lo_initialize(PGconn * conn);
|
||||
int
|
||||
lo_open(PGconn * conn, Oid lobjId, int mode)
|
||||
{
|
||||
int fd;
|
||||
int result_len;
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
int fd;
|
||||
int result_len;
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
|
||||
argv[0].isint = 1;
|
||||
argv[0].len = 4;
|
||||
@@ -81,10 +81,10 @@ lo_open(PGconn * conn, Oid lobjId, int mode)
|
||||
int
|
||||
lo_close(PGconn * conn, int fd)
|
||||
{
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -119,9 +119,9 @@ lo_close(PGconn * conn, int fd)
|
||||
int
|
||||
lo_read(PGconn * conn, int fd, char *buf, int len)
|
||||
{
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -158,10 +158,10 @@ lo_read(PGconn * conn, int fd, char *buf, int len)
|
||||
int
|
||||
lo_write(PGconn * conn, int fd, char *buf, int len)
|
||||
{
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
int retval;
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
int retval;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -203,10 +203,10 @@ lo_write(PGconn * conn, int fd, char *buf, int len)
|
||||
int
|
||||
lo_lseek(PGconn * conn, int fd, int offset, int whence)
|
||||
{
|
||||
PQArgBlock argv[3];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
PQArgBlock argv[3];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -251,10 +251,10 @@ lo_lseek(PGconn * conn, int fd, int offset, int whence)
|
||||
Oid
|
||||
lo_creat(PGconn * conn, int mode)
|
||||
{
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int retval;
|
||||
int result_len;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -288,10 +288,10 @@ lo_creat(PGconn * conn, int mode)
|
||||
int
|
||||
lo_tell(PGconn * conn, int fd)
|
||||
{
|
||||
int retval;
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
int retval;
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -325,10 +325,10 @@ lo_tell(PGconn * conn, int fd)
|
||||
int
|
||||
lo_unlink(PGconn * conn, Oid lobjId)
|
||||
{
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
int retval;
|
||||
PQArgBlock argv[1];
|
||||
PGresult *res;
|
||||
int result_len;
|
||||
int retval;
|
||||
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
@@ -364,12 +364,12 @@ lo_unlink(PGconn * conn, Oid lobjId)
|
||||
Oid
|
||||
lo_import(PGconn * conn, char *filename)
|
||||
{
|
||||
int fd;
|
||||
int nbytes,
|
||||
tmp;
|
||||
char buf[LO_BUFSIZE];
|
||||
Oid lobjOid;
|
||||
int lobj;
|
||||
int fd;
|
||||
int nbytes,
|
||||
tmp;
|
||||
char buf[LO_BUFSIZE];
|
||||
Oid lobjOid;
|
||||
int lobj;
|
||||
|
||||
/*
|
||||
* open the file to be read in
|
||||
@@ -429,11 +429,11 @@ lo_import(PGconn * conn, char *filename)
|
||||
int
|
||||
lo_export(PGconn * conn, Oid lobjId, char *filename)
|
||||
{
|
||||
int fd;
|
||||
int nbytes,
|
||||
tmp;
|
||||
char buf[LO_BUFSIZE];
|
||||
int lobj;
|
||||
int fd;
|
||||
int nbytes,
|
||||
tmp;
|
||||
char buf[LO_BUFSIZE];
|
||||
int lobj;
|
||||
|
||||
/*
|
||||
* create an inversion "object"
|
||||
@@ -490,11 +490,11 @@ lo_export(PGconn * conn, Oid lobjId, char *filename)
|
||||
static int
|
||||
lo_initialize(PGconn * conn)
|
||||
{
|
||||
PGresult *res;
|
||||
PGlobjfuncs *lobjfuncs;
|
||||
int n;
|
||||
char *fname;
|
||||
Oid foid;
|
||||
PGresult *res;
|
||||
PGlobjfuncs *lobjfuncs;
|
||||
int n;
|
||||
char *fname;
|
||||
Oid foid;
|
||||
|
||||
/* ----------------
|
||||
* Allocate the structure to hold the functions OID's
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.6 1997/09/07 05:03:35 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.7 1997/09/08 02:40:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -32,7 +32,7 @@
|
||||
int
|
||||
pqGetc(FILE * fin, FILE * debug)
|
||||
{
|
||||
int c;
|
||||
int c;
|
||||
|
||||
c = getc(fin);
|
||||
|
||||
@@ -70,7 +70,7 @@ pqPutnchar(const char *s, int len, FILE * f, FILE * debug)
|
||||
int
|
||||
pqGetnchar(char *s, int len, FILE * f, FILE * debug)
|
||||
{
|
||||
int cnt;
|
||||
int cnt;
|
||||
|
||||
if (f == NULL)
|
||||
return 1;
|
||||
@@ -92,8 +92,8 @@ pqGetnchar(char *s, int len, FILE * f, FILE * debug)
|
||||
int
|
||||
pqGets(char *s, int len, FILE * f, FILE * debug)
|
||||
{
|
||||
int c;
|
||||
const char *str = s;
|
||||
int c;
|
||||
const char *str = s;
|
||||
|
||||
if (f == NULL)
|
||||
return 1;
|
||||
@@ -118,19 +118,19 @@ pqGets(char *s, int len, FILE * f, FILE * debug)
|
||||
int
|
||||
pqPutInt(const int integer, int bytes, FILE * f, FILE * debug)
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
switch (bytes)
|
||||
{
|
||||
case 2:
|
||||
retval = pqPutShort(integer, f);
|
||||
break;
|
||||
case 4:
|
||||
retval = pqPutLong(integer, f);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "** int size %d not supported\n", bytes);
|
||||
retval = 1;
|
||||
case 2:
|
||||
retval = pqPutShort(integer, f);
|
||||
break;
|
||||
case 4:
|
||||
retval = pqPutLong(integer, f);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "** int size %d not supported\n", bytes);
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
@@ -148,19 +148,19 @@ pqPutInt(const int integer, int bytes, FILE * f, FILE * debug)
|
||||
int
|
||||
pqGetInt(int *result, int bytes, FILE * f, FILE * debug)
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
switch (bytes)
|
||||
{
|
||||
case 2:
|
||||
retval = pqGetShort(result, f);
|
||||
break;
|
||||
case 4:
|
||||
retval = pqGetLong(result, f);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "** int size %d not supported\n", bytes);
|
||||
retval = 1;
|
||||
case 2:
|
||||
retval = pqGetShort(result, f);
|
||||
break;
|
||||
case 4:
|
||||
retval = pqGetLong(result, f);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "** int size %d not supported\n", bytes);
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpq-fe.h,v 1.21 1997/09/07 05:03:36 momjian Exp $
|
||||
* $Id: libpq-fe.h,v 1.22 1997/09/08 02:40:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -15,7 +15,7 @@
|
||||
#define LIBPQ_FE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C"
|
||||
{
|
||||
CONNECTION_OK,
|
||||
CONNECTION_BAD
|
||||
} ConnStatusType;
|
||||
} ConnStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -49,7 +49,7 @@ extern "C"
|
||||
PGRES_NONFATAL_ERROR,
|
||||
PGRES_FATAL_ERROR
|
||||
|
||||
} ExecStatusType;
|
||||
} ExecStatusType;
|
||||
|
||||
/* string descriptions of the ExecStatusTypes */
|
||||
extern const char *pgresStatus[];
|
||||
@@ -72,21 +72,21 @@ extern "C"
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int len;
|
||||
int isint;
|
||||
int len;
|
||||
int isint;
|
||||
union
|
||||
{
|
||||
int *ptr;/* can't use void (dec compiler barfs) */
|
||||
int integer;
|
||||
} u;
|
||||
} PQArgBlock;
|
||||
int *ptr; /* can't use void (dec compiler barfs) */
|
||||
int integer;
|
||||
} u;
|
||||
} PQArgBlock;
|
||||
|
||||
typedef struct pgresAttDesc
|
||||
{
|
||||
char *name; /* type name */
|
||||
Oid adtid; /* type id */
|
||||
short adtsize;/* type size */
|
||||
} PGresAttDesc;
|
||||
char *name; /* type name */
|
||||
Oid adtid; /* type id */
|
||||
short adtsize; /* type size */
|
||||
} PGresAttDesc;
|
||||
|
||||
/* use char* for Attribute values,
|
||||
ASCII tuples are guaranteed to be null-terminated
|
||||
@@ -98,60 +98,56 @@ extern "C"
|
||||
|
||||
typedef struct pgresAttValue
|
||||
{
|
||||
int len; /* length in bytes of the value */
|
||||
char *value; /* actual value */
|
||||
} PGresAttValue;
|
||||
int len; /* length in bytes of the value */
|
||||
char *value; /* actual value */
|
||||
} PGresAttValue;
|
||||
|
||||
typedef struct pgNotify
|
||||
{
|
||||
char relname[NAMEDATALEN]; /* name of relation
|
||||
char relname[NAMEDATALEN]; /* name of relation
|
||||
* containing data */
|
||||
int be_pid; /* process id of backend */
|
||||
} PGnotify;
|
||||
int be_pid; /* process id of backend */
|
||||
} PGnotify;
|
||||
|
||||
typedef struct pgLobjfuncs
|
||||
{
|
||||
Oid fn_lo_open; /* OID of backend function lo_open */
|
||||
Oid fn_lo_close; /* OID of backend function
|
||||
* lo_close */
|
||||
Oid fn_lo_creat; /* OID of backend function
|
||||
* lo_creat */
|
||||
Oid fn_lo_unlink; /* OID of backend function
|
||||
Oid fn_lo_open; /* OID of backend function lo_open */
|
||||
Oid fn_lo_close;/* OID of backend function lo_close */
|
||||
Oid fn_lo_creat;/* OID of backend function lo_creat */
|
||||
Oid fn_lo_unlink; /* OID of backend function
|
||||
* lo_unlink */
|
||||
Oid fn_lo_lseek; /* OID of backend function
|
||||
* lo_lseek */
|
||||
Oid fn_lo_tell; /* OID of backend function lo_tell */
|
||||
Oid fn_lo_read; /* OID of backend function LOread */
|
||||
Oid fn_lo_write; /* OID of backend function LOwrite */
|
||||
} PGlobjfuncs;
|
||||
Oid fn_lo_lseek;/* OID of backend function lo_lseek */
|
||||
Oid fn_lo_tell; /* OID of backend function lo_tell */
|
||||
Oid fn_lo_read; /* OID of backend function LOread */
|
||||
Oid fn_lo_write;/* OID of backend function LOwrite */
|
||||
} PGlobjfuncs;
|
||||
|
||||
/* PGconn encapsulates a connection to the backend */
|
||||
typedef struct pg_conn
|
||||
{
|
||||
char *pghost; /* the machine on which the server is
|
||||
char *pghost; /* the machine on which the server is
|
||||
* running */
|
||||
char *pgtty; /* tty on which the backend messages is
|
||||
char *pgtty; /* tty on which the backend messages is
|
||||
* displayed */
|
||||
char *pgport; /* the communication port with the backend */
|
||||
char *pgoptions; /* options to start the backend
|
||||
* with */
|
||||
char *dbName; /* database name */
|
||||
ConnStatusType status;
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
char *pgport; /* the communication port with the backend */
|
||||
char *pgoptions; /* options to start the backend with */
|
||||
char *dbName; /* database name */
|
||||
ConnStatusType status;
|
||||
char errorMessage[ERROR_MSG_LENGTH];
|
||||
/* pipes for be/fe communication */
|
||||
FILE *Pfin;
|
||||
FILE *Pfout;
|
||||
FILE *Pfdebug;
|
||||
void *port; /* really a Port* */
|
||||
int asyncNotifyWaiting;
|
||||
Dllist *notifyList;
|
||||
char *pguser; /* Postgres username of user who is
|
||||
FILE *Pfin;
|
||||
FILE *Pfout;
|
||||
FILE *Pfdebug;
|
||||
void *port; /* really a Port* */
|
||||
int asyncNotifyWaiting;
|
||||
Dllist *notifyList;
|
||||
char *pguser; /* Postgres username of user who is
|
||||
* connected */
|
||||
char *pgpass;
|
||||
char *pgauth;
|
||||
PGlobjfuncs *lobjfuncs; /* Backend function OID's for
|
||||
* large object access */
|
||||
} PGconn;
|
||||
char *pgpass;
|
||||
char *pgauth;
|
||||
PGlobjfuncs *lobjfuncs; /* Backend function OID's for large object
|
||||
* access */
|
||||
} PGconn;
|
||||
|
||||
#define CMDSTATUS_LEN 40
|
||||
|
||||
@@ -159,21 +155,21 @@ extern "C"
|
||||
/* unlike the old libpq, we assume that queries only return in one group */
|
||||
typedef struct pg_result
|
||||
{
|
||||
int ntups;
|
||||
int numAttributes;
|
||||
PGresAttDesc *attDescs;
|
||||
PGresAttValue **tuples;/* each PGresTuple is an array of
|
||||
int ntups;
|
||||
int numAttributes;
|
||||
PGresAttDesc *attDescs;
|
||||
PGresAttValue **tuples; /* each PGresTuple is an array of
|
||||
* PGresAttValue's */
|
||||
int tupArrSize; /* size of tuples array allocated */
|
||||
ExecStatusType resultStatus;
|
||||
char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the
|
||||
* last insert query */
|
||||
int binary; /* binary tuple values if binary == 1,
|
||||
int tupArrSize; /* size of tuples array allocated */
|
||||
ExecStatusType resultStatus;
|
||||
char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the
|
||||
* last insert query */
|
||||
int binary; /* binary tuple values if binary == 1,
|
||||
* otherwise ASCII */
|
||||
PGconn *conn;
|
||||
} PGresult;
|
||||
PGconn *conn;
|
||||
} PGresult;
|
||||
|
||||
typedef char pqbool;
|
||||
typedef char pqbool;
|
||||
|
||||
/*
|
||||
* We can't use the conventional "bool", because we are designed to be
|
||||
@@ -183,18 +179,18 @@ extern "C"
|
||||
|
||||
struct _PQprintOpt
|
||||
{
|
||||
pqbool header; /* print output field headings and row
|
||||
pqbool header; /* print output field headings and row
|
||||
* count */
|
||||
pqbool align; /* fill align the fields */
|
||||
pqbool standard; /* old brain dead format */
|
||||
pqbool html3; /* output html tables */
|
||||
pqbool expanded; /* expand tables */
|
||||
pqbool pager; /* use pager for output if needed */
|
||||
char *fieldSep; /* field separator */
|
||||
char *tableOpt; /* insert to HTML <table ...> */
|
||||
char *caption;/* HTML <caption> */
|
||||
char **fieldName; /* null terminated array of
|
||||
* repalcement field names */
|
||||
pqbool align; /* fill align the fields */
|
||||
pqbool standard; /* old brain dead format */
|
||||
pqbool html3; /* output html tables */
|
||||
pqbool expanded; /* expand tables */
|
||||
pqbool pager; /* use pager for output if needed */
|
||||
char *fieldSep; /* field separator */
|
||||
char *tableOpt; /* insert to HTML <table ...> */
|
||||
char *caption; /* HTML <caption> */
|
||||
char **fieldName; /* null terminated array of repalcement
|
||||
* field names */
|
||||
};
|
||||
|
||||
typedef struct _PQprintOpt PQprintOpt;
|
||||
@@ -205,134 +201,131 @@ extern "C"
|
||||
*/
|
||||
struct _PQconninfoOption
|
||||
{
|
||||
char *keyword;/* The keyword of the option */
|
||||
char *environ;/* Fallback environment variable name */
|
||||
char *compiled; /* Fallback compiled in default
|
||||
* value */
|
||||
char *val; /* Options value */
|
||||
char *label; /* Label for field in connect dialog */
|
||||
char *dispchar; /* Character to display for this
|
||||
* field */
|
||||
char *keyword; /* The keyword of the option */
|
||||
char *environ; /* Fallback environment variable name */
|
||||
char *compiled; /* Fallback compiled in default value */
|
||||
char *val; /* Options value */
|
||||
char *label; /* Label for field in connect dialog */
|
||||
char *dispchar; /* Character to display for this field */
|
||||
/* in a connect dialog. Values are: */
|
||||
/* "" Display entered value as is */
|
||||
/* "*" Password field - hide value */
|
||||
/* "D" Debug options - don't */
|
||||
/* create a field by default */
|
||||
int dispsize; /* Field size in characters for
|
||||
* dialog */
|
||||
int dispsize; /* Field size in characters for dialog */
|
||||
};
|
||||
|
||||
typedef struct _PQconninfoOption PQconninfoOption;
|
||||
|
||||
/* === in fe-connect.c === */
|
||||
/* make a new client connection to the backend */
|
||||
extern PGconn *PQconnectdb(const char *conninfo);
|
||||
extern PGconn *PQconnectdb(const char *conninfo);
|
||||
extern PQconninfoOption *PQconndefaults(void);
|
||||
extern PGconn *PQsetdb(const char *pghost, const char *pgport, const char *pgoptions,
|
||||
extern PGconn *PQsetdb(const char *pghost, const char *pgport, const char *pgoptions,
|
||||
const char *pgtty, const char *dbName);
|
||||
/* close the current connection and free the PGconn data structure */
|
||||
extern void PQfinish(PGconn * conn);
|
||||
extern void PQfinish(PGconn * conn);
|
||||
|
||||
/*
|
||||
* close the current connection and restablish a new one with the same
|
||||
* parameters
|
||||
*/
|
||||
extern void PQreset(PGconn * conn);
|
||||
extern void PQreset(PGconn * conn);
|
||||
|
||||
extern char *PQdb(PGconn * conn);
|
||||
extern char *PQuser(PGconn * conn);
|
||||
extern char *PQhost(PGconn * conn);
|
||||
extern char *PQoptions(PGconn * conn);
|
||||
extern char *PQport(PGconn * conn);
|
||||
extern char *PQtty(PGconn * conn);
|
||||
extern char *PQdb(PGconn * conn);
|
||||
extern char *PQuser(PGconn * conn);
|
||||
extern char *PQhost(PGconn * conn);
|
||||
extern char *PQoptions(PGconn * conn);
|
||||
extern char *PQport(PGconn * conn);
|
||||
extern char *PQtty(PGconn * conn);
|
||||
extern ConnStatusType PQstatus(PGconn * conn);
|
||||
extern char *PQerrorMessage(PGconn * conn);
|
||||
extern void PQtrace(PGconn * conn, FILE * debug_port);
|
||||
extern void PQuntrace(PGconn * conn);
|
||||
extern char *PQerrorMessage(PGconn * conn);
|
||||
extern void PQtrace(PGconn * conn, FILE * debug_port);
|
||||
extern void PQuntrace(PGconn * conn);
|
||||
|
||||
/* === in fe-exec.c === */
|
||||
extern PGresult *PQexec(PGconn * conn, const char *query);
|
||||
extern int PQgetline(PGconn * conn, char *string, int length);
|
||||
extern int PQendcopy(PGconn * conn);
|
||||
extern void PQputline(PGconn * conn, const char *string);
|
||||
extern int PQgetline(PGconn * conn, char *string, int length);
|
||||
extern int PQendcopy(PGconn * conn);
|
||||
extern void PQputline(PGconn * conn, const char *string);
|
||||
extern ExecStatusType PQresultStatus(PGresult * res);
|
||||
extern int PQntuples(PGresult * res);
|
||||
extern int PQnfields(PGresult * res);
|
||||
extern char *PQfname(PGresult * res, int field_num);
|
||||
extern int PQfnumber(PGresult * res, const char *field_name);
|
||||
extern Oid PQftype(PGresult * res, int field_num);
|
||||
extern short PQfsize(PGresult * res, int field_num);
|
||||
extern char *PQcmdStatus(PGresult * res);
|
||||
extern int PQntuples(PGresult * res);
|
||||
extern int PQnfields(PGresult * res);
|
||||
extern char *PQfname(PGresult * res, int field_num);
|
||||
extern int PQfnumber(PGresult * res, const char *field_name);
|
||||
extern Oid PQftype(PGresult * res, int field_num);
|
||||
extern short PQfsize(PGresult * res, int field_num);
|
||||
extern char *PQcmdStatus(PGresult * res);
|
||||
extern const char *PQoidStatus(PGresult * res);
|
||||
extern const char *PQcmdTuples(PGresult * res);
|
||||
extern char *PQgetvalue(PGresult * res, int tup_num, int field_num);
|
||||
extern int PQgetlength(PGresult * res, int tup_num, int field_num);
|
||||
extern int PQgetisnull(PGresult * res, int tup_num, int field_num);
|
||||
extern void PQclear(PGresult * res);
|
||||
extern char *PQgetvalue(PGresult * res, int tup_num, int field_num);
|
||||
extern int PQgetlength(PGresult * res, int tup_num, int field_num);
|
||||
extern int PQgetisnull(PGresult * res, int tup_num, int field_num);
|
||||
extern void PQclear(PGresult * res);
|
||||
/* PQdisplayTuples() is a better version of PQprintTuples() */
|
||||
extern void PQdisplayTuples(PGresult * res,
|
||||
FILE * fp, /* where to send the
|
||||
* output */
|
||||
int fillAlign, /* pad the fields with
|
||||
* spaces */
|
||||
const char *fieldSep, /* field separator */
|
||||
int printHeader, /* display headers? */
|
||||
int quiet);
|
||||
extern void PQprintTuples(PGresult * res,
|
||||
FILE * fout, /* output stream */
|
||||
int printAttName, /* print attribute names
|
||||
* or not */
|
||||
int terseOutput, /* delimiter bars or
|
||||
* not? */
|
||||
int width /* width of column, if
|
||||
* 0, use variable width */
|
||||
extern void PQdisplayTuples(PGresult * res,
|
||||
FILE * fp, /* where to send the
|
||||
* output */
|
||||
int fillAlign, /* pad the fields with
|
||||
* spaces */
|
||||
const char *fieldSep, /* field separator */
|
||||
int printHeader, /* display headers? */
|
||||
int quiet);
|
||||
extern void PQprintTuples(PGresult * res,
|
||||
FILE * fout, /* output stream */
|
||||
int printAttName, /* print attribute names
|
||||
* or not */
|
||||
int terseOutput, /* delimiter bars or
|
||||
* not? */
|
||||
int width /* width of column, if
|
||||
* 0, use variable width */
|
||||
);
|
||||
extern void PQprint(FILE * fout, /* output stream */
|
||||
PGresult * res,
|
||||
PQprintOpt * ps /* option structure */
|
||||
extern void PQprint(FILE * fout, /* output stream */
|
||||
PGresult * res,
|
||||
PQprintOpt * ps /* option structure */
|
||||
);
|
||||
extern PGnotify *PQnotifies(PGconn * conn);
|
||||
extern PGresult *PQfn(PGconn * conn,
|
||||
int fnid,
|
||||
int *result_buf,
|
||||
int *result_len,
|
||||
int result_is_int,
|
||||
PQArgBlock * args,
|
||||
int nargs);
|
||||
int fnid,
|
||||
int *result_buf,
|
||||
int *result_len,
|
||||
int result_is_int,
|
||||
PQArgBlock * args,
|
||||
int nargs);
|
||||
/* === in fe-auth.c === */
|
||||
extern MsgType fe_getauthsvc(char *PQerrormsg);
|
||||
extern void fe_setauthsvc(const char *name, char *PQerrormsg);
|
||||
extern char *fe_getauthname(char *PQerrormsg);
|
||||
extern MsgType fe_getauthsvc(char *PQerrormsg);
|
||||
extern void fe_setauthsvc(const char *name, char *PQerrormsg);
|
||||
extern char *fe_getauthname(char *PQerrormsg);
|
||||
|
||||
/* === in fe-misc.c === */
|
||||
/* pqGets and pqPuts gets and sends strings to the file stream
|
||||
returns 0 if successful
|
||||
if debug is non-null, debugging output is sent to that stream
|
||||
*/
|
||||
extern int pqGets(char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqGetnchar(char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqPutnchar(const char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqPuts(const char *s, FILE * stream, FILE * debug);
|
||||
extern int pqGetc(FILE * stream, FILE * debug);
|
||||
extern int pqGets(char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqGetnchar(char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqPutnchar(const char *s, int maxlen, FILE * stream, FILE * debug);
|
||||
extern int pqPuts(const char *s, FILE * stream, FILE * debug);
|
||||
extern int pqGetc(FILE * stream, FILE * debug);
|
||||
/* get a n-byte integer from the stream into result */
|
||||
/* returns 0 if successful */
|
||||
extern int pqGetInt(int *result, int bytes, FILE * stream, FILE * debug);
|
||||
extern int pqGetInt(int *result, int bytes, FILE * stream, FILE * debug);
|
||||
/* put a n-byte integer into the stream */
|
||||
/* returns 0 if successful */
|
||||
extern int pqPutInt(const int n, int bytes, FILE * stream, FILE * debug);
|
||||
extern void pqFlush(FILE * stream, FILE * debug);
|
||||
extern int pqPutInt(const int n, int bytes, FILE * stream, FILE * debug);
|
||||
extern void pqFlush(FILE * stream, FILE * debug);
|
||||
|
||||
/* === in fe-lobj.c === */
|
||||
int lo_open(PGconn * conn, Oid lobjId, int mode);
|
||||
int lo_close(PGconn * conn, int fd);
|
||||
int lo_read(PGconn * conn, int fd, char *buf, int len);
|
||||
int lo_write(PGconn * conn, int fd, char *buf, int len);
|
||||
int lo_lseek(PGconn * conn, int fd, int offset, int whence);
|
||||
Oid lo_creat(PGconn * conn, int mode);
|
||||
int lo_tell(PGconn * conn, int fd);
|
||||
int lo_unlink(PGconn * conn, Oid lobjId);
|
||||
Oid lo_import(PGconn * conn, char *filename);
|
||||
int lo_export(PGconn * conn, Oid lobjId, char *filename);
|
||||
int lo_open(PGconn * conn, Oid lobjId, int mode);
|
||||
int lo_close(PGconn * conn, int fd);
|
||||
int lo_read(PGconn * conn, int fd, char *buf, int len);
|
||||
int lo_write(PGconn * conn, int fd, char *buf, int len);
|
||||
int lo_lseek(PGconn * conn, int fd, int offset, int whence);
|
||||
Oid lo_creat(PGconn * conn, int mode);
|
||||
int lo_tell(PGconn * conn, int fd);
|
||||
int lo_unlink(PGconn * conn, Oid lobjId);
|
||||
Oid lo_import(PGconn * conn, char *filename);
|
||||
int lo_export(PGconn * conn, Oid lobjId, char *filename);
|
||||
/* max length of message to send */
|
||||
#define MAX_MESSAGE_LEN 8193
|
||||
|
||||
@@ -349,12 +342,12 @@ extern "C"
|
||||
#define DefaultPassword ""
|
||||
|
||||
|
||||
typedef void *TUPLE;
|
||||
typedef void *TUPLE;
|
||||
#define palloc malloc
|
||||
#define pfree free
|
||||
|
||||
#if defined(sunos4)
|
||||
extern char *sys_errlist[];
|
||||
extern char *sys_errlist[];
|
||||
#define strerror(A) (sys_errlist[(A)])
|
||||
#endif /* sunos4 */
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.4 1997/09/07 05:03:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.5 1997/09/08 02:40:37 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This shouldn't be in libpq, but the monitor and some other
|
||||
@@ -29,7 +29,7 @@ pqsignal(int signo, pqsigfunc func)
|
||||
return signal(signo, func);
|
||||
#else
|
||||
struct sigaction act,
|
||||
oact;
|
||||
oact;
|
||||
|
||||
act.sa_handler = func;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pqsignal.h,v 1.3 1997/09/07 05:03:39 momjian Exp $
|
||||
* $Id: pqsignal.h,v 1.4 1997/09/08 02:40:38 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This shouldn't be in libpq, but the monitor and some other
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "c.h"
|
||||
|
||||
typedef void (*pqsigfunc) (int);
|
||||
typedef void (*pqsigfunc) (int);
|
||||
|
||||
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user