mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
New pgindent run with fixes suggested by Tom. Patch manually reviewed,
initdb/regression tests pass.
This commit is contained in:
@@ -62,4 +62,4 @@
|
||||
/* NOTICE: BlankPortalAssignName: portal * already exists */
|
||||
#define ECPG_NOTICE_PORTAL_EXISTS -605
|
||||
|
||||
#endif /* !_ECPG_ERROR_H */
|
||||
#endif /* !_ECPG_ERROR_H */
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool char
|
||||
#endif /* ndef bool */
|
||||
#endif /* ndef bool */
|
||||
|
||||
#ifndef true
|
||||
#define true ((bool) 1)
|
||||
#endif /* ndef true */
|
||||
#endif /* ndef true */
|
||||
#ifndef false
|
||||
#define false ((bool) 0)
|
||||
#endif /* ndef false */
|
||||
#endif /* not C++ */
|
||||
#endif /* ndef false */
|
||||
#endif /* not C++ */
|
||||
#else /* __BEOS__ */
|
||||
#include <SupportDefs.h>
|
||||
#endif /* __BEOS__ */
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif /* TRUE */
|
||||
#endif /* TRUE */
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif /* FALSE */
|
||||
#endif /* FALSE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#define DLLIMPORT __declspec (dllimport)
|
||||
#else
|
||||
#define DLLIMPORT
|
||||
#endif /* __CYGWIN__ */
|
||||
#endif /* DLLIMPORT */
|
||||
#endif /* __CYGWIN__ */
|
||||
#endif /* DLLIMPORT */
|
||||
|
||||
#define SQLERRMC_LEN 70
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.17 2001/10/05 17:37:07 meskes Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.18 2001/11/05 17:46:37 momjian Exp $ */
|
||||
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@@ -70,7 +70,7 @@ get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
case ECPGt_unsigned_long_long:
|
||||
((unsigned long long int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
case ECPGt_NO_INDICATOR:
|
||||
if (PQgetisnull(results, act_tuple, act_field))
|
||||
{
|
||||
@@ -176,7 +176,7 @@ get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
((long long int *) var)[act_tuple] = (long long) 0;
|
||||
|
||||
break;
|
||||
#endif /* HAVE_STRTOLL */
|
||||
#endif /* HAVE_STRTOLL */
|
||||
#ifdef HAVE_STRTOULL
|
||||
case ECPGt_unsigned_long_long:
|
||||
if (pval)
|
||||
@@ -193,8 +193,8 @@ get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
((unsigned long long int *) var)[act_tuple] = (long long) 0;
|
||||
|
||||
break;
|
||||
#endif /* HAVE_STRTOULL */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
#endif /* HAVE_STRTOULL */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
|
||||
case ECPGt_float:
|
||||
case ECPGt_double:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* dynamic SQL support routines
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.17 2001/10/25 05:50:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.18 2001/11/05 17:46:37 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres_fe.h"
|
||||
@@ -86,7 +86,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
|
||||
case ECPGt_unsigned_long_long:
|
||||
*(unsigned long long int *) var = (unsigned long long int) value;
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
case ECPGt_float:
|
||||
*(float *) var = (float) value;
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.30 2001/10/28 06:26:11 momjian Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.31 2001/11/05 17:46:37 momjian Exp $ */
|
||||
|
||||
/*
|
||||
* The aim is to get a simpler inteface to the database routines.
|
||||
@@ -76,7 +76,7 @@ static struct auto_mem
|
||||
{
|
||||
void *pointer;
|
||||
struct auto_mem *next;
|
||||
} *auto_allocs = NULL;
|
||||
} *auto_allocs = NULL;
|
||||
|
||||
static void
|
||||
add_mem(void *ptr, int lineno)
|
||||
@@ -503,7 +503,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
||||
if (*(long long int *) var->ind_value < (long long) 0)
|
||||
*tobeinserted_p = "null";
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -673,7 +673,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
||||
*tobeinserted_p = mallocedval;
|
||||
*malloced_p = true;
|
||||
break;
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
#endif /* HAVE_LONG_LONG_INT_64 */
|
||||
case ECPGt_float:
|
||||
if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
|
||||
return false;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_type.h,v 1.4 2001/10/28 06:26:11 momjian Exp $
|
||||
* $Id: pg_type.h,v 1.5 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
@@ -69,4 +69,4 @@
|
||||
#define VARBITOID 1562
|
||||
#define NUMERICOID 1700
|
||||
|
||||
#endif /* PG_TYPE_H */
|
||||
#endif /* PG_TYPE_H */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/prepare.c,v 1.9 2001/10/28 06:26:11 momjian Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/prepare.c,v 1.10 2001/11/05 17:46:37 momjian Exp $ */
|
||||
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@@ -15,7 +15,7 @@ static struct prepared_statement
|
||||
char *name;
|
||||
struct statement *stmt;
|
||||
struct prepared_statement *next;
|
||||
} *prep_stmts = NULL;
|
||||
} *prep_stmts = NULL;
|
||||
|
||||
static bool
|
||||
isvarchar(unsigned char c)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpgtcl.h,v 1.13 2001/10/28 06:26:11 momjian Exp $
|
||||
* $Id: libpgtcl.h,v 1.14 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -21,4 +21,4 @@
|
||||
extern int Pgtcl_Init(Tcl_Interp *interp);
|
||||
extern int Pgtcl_SafeInit(Tcl_Interp *interp);
|
||||
|
||||
#endif /* LIBPGTCL_H */
|
||||
#endif /* LIBPGTCL_H */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.58 2001/10/25 05:50:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.59 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ tcl_value(char *value)
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
#endif /* TCL_ARRAYS */
|
||||
#endif /* TCL_ARRAYS */
|
||||
|
||||
|
||||
/**********************************
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pgtclCmds.h,v 1.24 2001/10/28 06:26:11 momjian Exp $
|
||||
* $Id: pgtclCmds.h,v 1.25 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ typedef struct Pg_TclNotifies_s
|
||||
* got round to deleting the Pg_TclNotifies structure.
|
||||
*/
|
||||
Tcl_HashTable notify_hash; /* Active pg_listen requests */
|
||||
} Pg_TclNotifies;
|
||||
} Pg_TclNotifies;
|
||||
|
||||
typedef struct Pg_ConnectionId_s
|
||||
{
|
||||
@@ -70,7 +70,7 @@ typedef struct Pg_ConnectionId_s
|
||||
#else
|
||||
int notifier_socket; /* PQsocket on which notifier is listening */
|
||||
#endif
|
||||
} Pg_ConnectionId;
|
||||
} Pg_ConnectionId;
|
||||
|
||||
/* Values of res_copyStatus */
|
||||
#define RES_COPY_NONE 0
|
||||
@@ -129,4 +129,4 @@ extern int Pg_lo_export(
|
||||
extern int Pg_listen(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
||||
|
||||
#endif /* PGTCLCMDS_H */
|
||||
#endif /* PGTCLCMDS_H */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.28 2001/10/25 05:50:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.29 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -497,7 +497,7 @@ typedef struct
|
||||
Tcl_Event header; /* Standard Tcl event info */
|
||||
PGnotify info; /* Notify name from SQL server */
|
||||
Pg_ConnectionId *connid; /* Connection for server */
|
||||
} NotifyEvent;
|
||||
} NotifyEvent;
|
||||
|
||||
/* Dispatch a NotifyEvent that has reached the front of the event queue */
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.62 2001/10/25 05:50:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.63 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -86,17 +86,17 @@ static const struct authsvc authsvcs[] = {
|
||||
#ifdef KRB4
|
||||
{"krb4", STARTUP_KRB4_MSG, 1},
|
||||
{"kerberos", STARTUP_KRB4_MSG, 1},
|
||||
#endif /* KRB4 */
|
||||
#endif /* KRB4 */
|
||||
#ifdef KRB5
|
||||
{"krb5", STARTUP_KRB5_MSG, 1},
|
||||
{"kerberos", STARTUP_KRB5_MSG, 1},
|
||||
#endif /* KRB5 */
|
||||
#endif /* KRB5 */
|
||||
{UNAUTHNAME, STARTUP_MSG,
|
||||
#if defined(KRB4) || defined(KRB5)
|
||||
0
|
||||
#else /* !(KRB4 || KRB5) */
|
||||
1
|
||||
#endif /* !(KRB4 || KRB5) */
|
||||
#endif /* !(KRB4 || KRB5) */
|
||||
},
|
||||
{"password", STARTUP_PASSWORD_MSG, 0}
|
||||
};
|
||||
@@ -231,7 +231,7 @@ pg_krb4_sendauth(char *PQerrormsg, int sock,
|
||||
}
|
||||
return STATUS_OK;
|
||||
}
|
||||
#endif /* KRB4 */
|
||||
#endif /* KRB4 */
|
||||
|
||||
#ifdef KRB5
|
||||
/*
|
||||
@@ -431,7 +431,7 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* KRB5 */
|
||||
#endif /* KRB5 */
|
||||
|
||||
static int
|
||||
pg_local_sendauth(char *PQerrormsg, PGconn *conn)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: fe-auth.h,v 1.14 2001/10/28 06:26:12 momjian Exp $
|
||||
* $Id: fe-auth.h,v 1.15 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,7 +31,7 @@
|
||||
#define DEFAULT_CLIENT_AUTHSVC UNAUTHNAME
|
||||
#else /* KRB4 || KRB5 */
|
||||
#define DEFAULT_CLIENT_AUTHSVC "kerberos"
|
||||
#endif /* KRB4 || KRB5 */
|
||||
#endif /* KRB4 || KRB5 */
|
||||
|
||||
extern int fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
|
||||
const char *password, char *PQerrormsg);
|
||||
@@ -42,4 +42,4 @@ extern char *fe_getauthname(char *PQerrormsg);
|
||||
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
|
||||
#define PG_KRB5_VERSION "PGVER5.1"
|
||||
|
||||
#endif /* FE_AUTH_H */
|
||||
#endif /* FE_AUTH_H */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.179 2001/10/28 06:26:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.180 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -147,7 +147,7 @@ static const struct EnvironmentOptions
|
||||
{
|
||||
const char *envName,
|
||||
*pgName;
|
||||
} EnvironmentOptions[] =
|
||||
} EnvironmentOptions[] =
|
||||
|
||||
{
|
||||
/* common user-interface settings */
|
||||
@@ -672,7 +672,7 @@ update_db_info(PGconn *conn)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NOT_USED */
|
||||
#endif /* NOT_USED */
|
||||
|
||||
|
||||
/* ----------
|
||||
@@ -1822,7 +1822,7 @@ PQsetenv(PGconn *conn)
|
||||
flag = PQsetenvPoll(conn);
|
||||
}
|
||||
}
|
||||
#endif /* NOT_USED */
|
||||
#endif /* NOT_USED */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.59 2001/10/28 06:26:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.60 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -830,7 +830,7 @@ PQenv2encoding(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
@@ -847,7 +847,7 @@ libpq_gettext(const char *msgid)
|
||||
|
||||
return dgettext("libpq", msgid);
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpq-fe.h,v 1.78 2001/11/02 20:51:27 tgl Exp $
|
||||
* $Id: libpq-fe.h,v 1.79 2001/11/05 17:46:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,68 +35,68 @@ extern "C"
|
||||
|
||||
/* Application-visible enum types */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/*
|
||||
* Although you may decide to change this list in some way, values
|
||||
* which become unused should never be removed, nor should
|
||||
* constants be redefined - that would break compatibility with
|
||||
* existing code.
|
||||
*/
|
||||
CONNECTION_OK,
|
||||
CONNECTION_BAD,
|
||||
/* Non-blocking mode only below here */
|
||||
typedef enum
|
||||
{
|
||||
/*
|
||||
* Although you may decide to change this list in some way, values
|
||||
* which become unused should never be removed, nor should
|
||||
* constants be redefined - that would break compatibility with
|
||||
* existing code.
|
||||
*/
|
||||
CONNECTION_OK,
|
||||
CONNECTION_BAD,
|
||||
/* Non-blocking mode only below here */
|
||||
|
||||
/*
|
||||
* The existence of these should never be relied upon - they
|
||||
* should only be used for user feedback or similar purposes.
|
||||
*/
|
||||
CONNECTION_STARTED, /* Waiting for connection to be made. */
|
||||
CONNECTION_MADE, /* Connection OK; waiting to send. */
|
||||
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
|
||||
* postmaster. */
|
||||
CONNECTION_AUTH_OK, /* Received authentication; waiting for
|
||||
* backend startup. */
|
||||
CONNECTION_SETENV /* Negotiating environment. */
|
||||
} ConnStatusType;
|
||||
/*
|
||||
* The existence of these should never be relied upon - they
|
||||
* should only be used for user feedback or similar purposes.
|
||||
*/
|
||||
CONNECTION_STARTED, /* Waiting for connection to be made. */
|
||||
CONNECTION_MADE, /* Connection OK; waiting to send. */
|
||||
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
|
||||
* postmaster. */
|
||||
CONNECTION_AUTH_OK, /* Received authentication; waiting for
|
||||
* backend startup. */
|
||||
CONNECTION_SETENV /* Negotiating environment. */
|
||||
} ConnStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PGRES_POLLING_FAILED = 0,
|
||||
PGRES_POLLING_READING, /* These two indicate that one may */
|
||||
PGRES_POLLING_WRITING, /* use select before polling again. */
|
||||
PGRES_POLLING_OK,
|
||||
PGRES_POLLING_ACTIVE /* Can call poll function immediately. */
|
||||
} PostgresPollingStatusType;
|
||||
typedef enum
|
||||
{
|
||||
PGRES_POLLING_FAILED = 0,
|
||||
PGRES_POLLING_READING, /* These two indicate that one may */
|
||||
PGRES_POLLING_WRITING, /* use select before polling again. */
|
||||
PGRES_POLLING_OK,
|
||||
PGRES_POLLING_ACTIVE /* Can call poll function immediately. */
|
||||
} PostgresPollingStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PGRES_EMPTY_QUERY = 0,
|
||||
PGRES_COMMAND_OK, /* a query command that doesn't return
|
||||
* anything was executed properly by the
|
||||
* backend */
|
||||
PGRES_TUPLES_OK, /* a query command that returns tuples was
|
||||
* executed properly by the backend,
|
||||
* PGresult contains the result tuples */
|
||||
PGRES_COPY_OUT, /* Copy Out data transfer in progress */
|
||||
PGRES_COPY_IN, /* Copy In data transfer in progress */
|
||||
PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from
|
||||
* the backend */
|
||||
PGRES_NONFATAL_ERROR,
|
||||
PGRES_FATAL_ERROR
|
||||
} ExecStatusType;
|
||||
typedef enum
|
||||
{
|
||||
PGRES_EMPTY_QUERY = 0,
|
||||
PGRES_COMMAND_OK, /* a query command that doesn't return
|
||||
* anything was executed properly by the
|
||||
* backend */
|
||||
PGRES_TUPLES_OK, /* a query command that returns tuples was
|
||||
* executed properly by the backend,
|
||||
* PGresult contains the result tuples */
|
||||
PGRES_COPY_OUT, /* Copy Out data transfer in progress */
|
||||
PGRES_COPY_IN, /* Copy In data transfer in progress */
|
||||
PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from
|
||||
* the backend */
|
||||
PGRES_NONFATAL_ERROR,
|
||||
PGRES_FATAL_ERROR
|
||||
} ExecStatusType;
|
||||
|
||||
/* PGconn encapsulates a connection to the backend.
|
||||
* The contents of this struct are not supposed to be known to applications.
|
||||
*/
|
||||
typedef struct pg_conn PGconn;
|
||||
typedef struct pg_conn PGconn;
|
||||
|
||||
/* PGresult encapsulates the result of a query (or more precisely, of a single
|
||||
* SQL command --- a query string given to PQsendQuery can contain multiple
|
||||
* commands and thus return multiple PGresult objects).
|
||||
* The contents of this struct are not supposed to be known to applications.
|
||||
*/
|
||||
typedef struct pg_result PGresult;
|
||||
typedef struct pg_result PGresult;
|
||||
|
||||
/* PGnotify represents the occurrence of a NOTIFY message.
|
||||
* Ideally this would be an opaque typedef, but it's so simple that it's
|
||||
@@ -104,35 +104,35 @@ typedef struct pg_result PGresult;
|
||||
* NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
|
||||
* whereas in earlier versions it was always your own backend's PID.
|
||||
*/
|
||||
typedef struct pgNotify
|
||||
{
|
||||
char relname[NAMEDATALEN]; /* name of relation
|
||||
* containing data */
|
||||
int be_pid; /* process id of backend */
|
||||
} PGnotify;
|
||||
typedef struct pgNotify
|
||||
{
|
||||
char relname[NAMEDATALEN]; /* name of relation
|
||||
* containing data */
|
||||
int be_pid; /* process id of backend */
|
||||
} PGnotify;
|
||||
|
||||
/* PQnoticeProcessor is the function type for the notice-message callback.
|
||||
*/
|
||||
typedef void (*PQnoticeProcessor) (void *arg, const char *message);
|
||||
typedef void (*PQnoticeProcessor) (void *arg, const char *message);
|
||||
|
||||
/* Print options for PQprint() */
|
||||
typedef char pqbool;
|
||||
typedef char pqbool;
|
||||
|
||||
typedef struct _PQprintOpt
|
||||
{
|
||||
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 */
|
||||
} PQprintOpt;
|
||||
typedef struct _PQprintOpt
|
||||
{
|
||||
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 */
|
||||
} PQprintOpt;
|
||||
|
||||
/* ----------------
|
||||
* Structure for the conninfo parameter definitions returned by PQconndefaults
|
||||
@@ -142,35 +142,35 @@ typedef struct _PQprintOpt
|
||||
* will release both the val strings and the PQconninfoOption array itself.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct _PQconninfoOption
|
||||
{
|
||||
char *keyword; /* The keyword of the option */
|
||||
char *envvar; /* Fallback environment variable name */
|
||||
char *compiled; /* Fallback compiled in default value */
|
||||
char *val; /* Option's current value, or NULL */
|
||||
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
|
||||
* option - don't show by default */
|
||||
int dispsize; /* Field size in characters for dialog */
|
||||
} PQconninfoOption;
|
||||
typedef struct _PQconninfoOption
|
||||
{
|
||||
char *keyword; /* The keyword of the option */
|
||||
char *envvar; /* Fallback environment variable name */
|
||||
char *compiled; /* Fallback compiled in default value */
|
||||
char *val; /* Option's current value, or NULL */
|
||||
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
|
||||
* option - don't show by default */
|
||||
int dispsize; /* Field size in characters for dialog */
|
||||
} PQconninfoOption;
|
||||
|
||||
/* ----------------
|
||||
* PQArgBlock -- structure for PQfn() arguments
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int len;
|
||||
int isint;
|
||||
union
|
||||
typedef struct
|
||||
{
|
||||
int *ptr; /* can't use void (dec compiler barfs) */
|
||||
int integer;
|
||||
} u;
|
||||
} PQArgBlock;
|
||||
int len;
|
||||
int isint;
|
||||
union
|
||||
{
|
||||
int *ptr; /* can't use void (dec compiler barfs) */
|
||||
int integer;
|
||||
} u;
|
||||
} PQArgBlock;
|
||||
|
||||
/* ----------------
|
||||
* Exported functions of libpq
|
||||
@@ -181,197 +181,198 @@ typedef struct
|
||||
|
||||
/* make a new client connection to the backend */
|
||||
/* Asynchronous (non-blocking) */
|
||||
extern PGconn *PQconnectStart(const char *conninfo);
|
||||
extern PostgresPollingStatusType PQconnectPoll(PGconn *conn);
|
||||
extern PGconn *PQconnectStart(const char *conninfo);
|
||||
extern PostgresPollingStatusType PQconnectPoll(PGconn *conn);
|
||||
|
||||
/* Synchronous (blocking) */
|
||||
extern PGconn *PQconnectdb(const char *conninfo);
|
||||
extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
|
||||
const char *pgoptions, const char *pgtty,
|
||||
const char *dbName,
|
||||
const char *login, const char *pwd);
|
||||
extern PGconn *PQconnectdb(const char *conninfo);
|
||||
extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
|
||||
const char *pgoptions, const char *pgtty,
|
||||
const char *dbName,
|
||||
const char *login, const char *pwd);
|
||||
|
||||
#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
|
||||
PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
|
||||
|
||||
/* close the current connection and free the PGconn data structure */
|
||||
extern void PQfinish(PGconn *conn);
|
||||
extern void PQfinish(PGconn *conn);
|
||||
|
||||
/* get info about connection options known to PQconnectdb */
|
||||
extern PQconninfoOption *PQconndefaults(void);
|
||||
extern PQconninfoOption *PQconndefaults(void);
|
||||
|
||||
/* free the data structure returned by PQconndefaults() */
|
||||
extern void PQconninfoFree(PQconninfoOption *connOptions);
|
||||
extern void PQconninfoFree(PQconninfoOption *connOptions);
|
||||
|
||||
/*
|
||||
* close the current connection and restablish a new one with the same
|
||||
* parameters
|
||||
*/
|
||||
/* Asynchronous (non-blocking) */
|
||||
extern int PQresetStart(PGconn *conn);
|
||||
extern PostgresPollingStatusType PQresetPoll(PGconn *conn);
|
||||
extern int PQresetStart(PGconn *conn);
|
||||
extern PostgresPollingStatusType PQresetPoll(PGconn *conn);
|
||||
|
||||
/* Synchronous (blocking) */
|
||||
extern void PQreset(PGconn *conn);
|
||||
extern void PQreset(PGconn *conn);
|
||||
|
||||
/* issue a cancel request */
|
||||
extern int PQrequestCancel(PGconn *conn);
|
||||
extern int PQrequestCancel(PGconn *conn);
|
||||
|
||||
/* Accessor functions for PGconn objects */
|
||||
extern char *PQdb(const PGconn *conn);
|
||||
extern char *PQuser(const PGconn *conn);
|
||||
extern char *PQpass(const PGconn *conn);
|
||||
extern char *PQhost(const PGconn *conn);
|
||||
extern char *PQport(const PGconn *conn);
|
||||
extern char *PQtty(const PGconn *conn);
|
||||
extern char *PQoptions(const PGconn *conn);
|
||||
extern ConnStatusType PQstatus(const PGconn *conn);
|
||||
extern char *PQerrorMessage(const PGconn *conn);
|
||||
extern int PQsocket(const PGconn *conn);
|
||||
extern int PQbackendPID(const PGconn *conn);
|
||||
extern int PQclientEncoding(const PGconn *conn);
|
||||
extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
|
||||
extern char *PQdb(const PGconn *conn);
|
||||
extern char *PQuser(const PGconn *conn);
|
||||
extern char *PQpass(const PGconn *conn);
|
||||
extern char *PQhost(const PGconn *conn);
|
||||
extern char *PQport(const PGconn *conn);
|
||||
extern char *PQtty(const PGconn *conn);
|
||||
extern char *PQoptions(const PGconn *conn);
|
||||
extern ConnStatusType PQstatus(const PGconn *conn);
|
||||
extern char *PQerrorMessage(const PGconn *conn);
|
||||
extern int PQsocket(const PGconn *conn);
|
||||
extern int PQbackendPID(const PGconn *conn);
|
||||
extern int PQclientEncoding(const PGconn *conn);
|
||||
extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
|
||||
|
||||
#ifdef USE_SSL
|
||||
/* Get the SSL structure associated with a connection */
|
||||
extern SSL *PQgetssl(PGconn *conn);
|
||||
extern SSL *PQgetssl(PGconn *conn);
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable/disable tracing */
|
||||
extern void PQtrace(PGconn *conn, FILE *debug_port);
|
||||
extern void PQuntrace(PGconn *conn);
|
||||
extern void PQtrace(PGconn *conn, FILE *debug_port);
|
||||
extern void PQuntrace(PGconn *conn);
|
||||
|
||||
/* Override default notice processor */
|
||||
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
|
||||
PQnoticeProcessor proc,
|
||||
void *arg);
|
||||
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
|
||||
PQnoticeProcessor proc,
|
||||
void *arg);
|
||||
|
||||
/* === in fe-exec.c === */
|
||||
|
||||
/* Quoting strings before inclusion in queries. */
|
||||
extern size_t PQescapeString(char *to, const char *from, size_t length);
|
||||
extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
|
||||
size_t *bytealen);
|
||||
extern size_t PQescapeString(char *to, const char *from, size_t length);
|
||||
extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
|
||||
size_t *bytealen);
|
||||
|
||||
/* Simple synchronous query */
|
||||
extern PGresult *PQexec(PGconn *conn, const char *query);
|
||||
extern PGnotify *PQnotifies(PGconn *conn);
|
||||
extern void PQfreeNotify(PGnotify *notify);
|
||||
extern PGresult *PQexec(PGconn *conn, const char *query);
|
||||
extern PGnotify *PQnotifies(PGconn *conn);
|
||||
extern void PQfreeNotify(PGnotify *notify);
|
||||
|
||||
/* Interface for multiple-result or asynchronous queries */
|
||||
extern int PQsendQuery(PGconn *conn, const char *query);
|
||||
extern PGresult *PQgetResult(PGconn *conn);
|
||||
extern int PQsendQuery(PGconn *conn, const char *query);
|
||||
extern PGresult *PQgetResult(PGconn *conn);
|
||||
|
||||
/* Routines for managing an asychronous query */
|
||||
extern int PQisBusy(PGconn *conn);
|
||||
extern int PQconsumeInput(PGconn *conn);
|
||||
extern int PQisBusy(PGconn *conn);
|
||||
extern int PQconsumeInput(PGconn *conn);
|
||||
|
||||
/* Routines for copy in/out */
|
||||
extern int PQgetline(PGconn *conn, char *string, int length);
|
||||
extern int PQputline(PGconn *conn, const char *string);
|
||||
extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
|
||||
extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
|
||||
extern int PQendcopy(PGconn *conn);
|
||||
extern int PQgetline(PGconn *conn, char *string, int length);
|
||||
extern int PQputline(PGconn *conn, const char *string);
|
||||
extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
|
||||
extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
|
||||
extern int PQendcopy(PGconn *conn);
|
||||
|
||||
/* Set blocking/nonblocking connection to the backend */
|
||||
extern int PQsetnonblocking(PGconn *conn, int arg);
|
||||
extern int PQisnonblocking(const PGconn *conn);
|
||||
extern int PQsetnonblocking(PGconn *conn, int arg);
|
||||
extern int PQisnonblocking(const PGconn *conn);
|
||||
|
||||
/* Force the write buffer to be written (or at least try) */
|
||||
extern int PQflush(PGconn *conn);
|
||||
extern int PQflush(PGconn *conn);
|
||||
|
||||
/*
|
||||
* "Fast path" interface --- not really recommended for application
|
||||
* use
|
||||
*/
|
||||
extern PGresult *PQfn(PGconn *conn,
|
||||
int fnid,
|
||||
int *result_buf,
|
||||
int *result_len,
|
||||
int result_is_int,
|
||||
const PQArgBlock *args,
|
||||
int nargs);
|
||||
extern PGresult *PQfn(PGconn *conn,
|
||||
int fnid,
|
||||
int *result_buf,
|
||||
int *result_len,
|
||||
int result_is_int,
|
||||
const PQArgBlock *args,
|
||||
int nargs);
|
||||
|
||||
/* Accessor functions for PGresult objects */
|
||||
extern ExecStatusType PQresultStatus(const PGresult *res);
|
||||
extern char *PQresStatus(ExecStatusType status);
|
||||
extern char *PQresultErrorMessage(const PGresult *res);
|
||||
extern int PQntuples(const PGresult *res);
|
||||
extern int PQnfields(const PGresult *res);
|
||||
extern int PQbinaryTuples(const PGresult *res);
|
||||
extern char *PQfname(const PGresult *res, int field_num);
|
||||
extern int PQfnumber(const PGresult *res, const char *field_name);
|
||||
extern Oid PQftype(const PGresult *res, int field_num);
|
||||
extern int PQfsize(const PGresult *res, int field_num);
|
||||
extern int PQfmod(const PGresult *res, int field_num);
|
||||
extern char *PQcmdStatus(PGresult *res);
|
||||
extern char *PQoidStatus(const PGresult *res); /* old and ugly */
|
||||
extern Oid PQoidValue(const PGresult *res); /* new and improved */
|
||||
extern char *PQcmdTuples(PGresult *res);
|
||||
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
|
||||
extern ExecStatusType PQresultStatus(const PGresult *res);
|
||||
extern char *PQresStatus(ExecStatusType status);
|
||||
extern char *PQresultErrorMessage(const PGresult *res);
|
||||
extern int PQntuples(const PGresult *res);
|
||||
extern int PQnfields(const PGresult *res);
|
||||
extern int PQbinaryTuples(const PGresult *res);
|
||||
extern char *PQfname(const PGresult *res, int field_num);
|
||||
extern int PQfnumber(const PGresult *res, const char *field_name);
|
||||
extern Oid PQftype(const PGresult *res, int field_num);
|
||||
extern int PQfsize(const PGresult *res, int field_num);
|
||||
extern int PQfmod(const PGresult *res, int field_num);
|
||||
extern char *PQcmdStatus(PGresult *res);
|
||||
extern char *PQoidStatus(const PGresult *res); /* old and ugly */
|
||||
extern Oid PQoidValue(const PGresult *res); /* new and improved */
|
||||
extern char *PQcmdTuples(PGresult *res);
|
||||
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
|
||||
|
||||
/* Delete a PGresult */
|
||||
extern void PQclear(PGresult *res);
|
||||
extern void PQclear(PGresult *res);
|
||||
|
||||
/*
|
||||
* Make an empty PGresult with given status (some apps find this
|
||||
* useful). If conn is not NULL and status indicates an error, the
|
||||
* conn's errorMessage is copied.
|
||||
*/
|
||||
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
|
||||
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
|
||||
|
||||
/* === in fe-print.c === */
|
||||
|
||||
extern void PQprint(FILE *fout, /* output stream */
|
||||
const PGresult *res,
|
||||
const PQprintOpt *ps); /* option structure */
|
||||
extern void PQprint(FILE *fout, /* output stream */
|
||||
const PGresult *res,
|
||||
const PQprintOpt *ps); /* option structure */
|
||||
|
||||
/*
|
||||
* really old printing routines
|
||||
*/
|
||||
extern void PQdisplayTuples(const 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 PQdisplayTuples(const 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(const PGresult *res,
|
||||
FILE *fout, /* output stream */
|
||||
int printAttName, /* print attribute names */
|
||||
int terseOutput, /* delimiter bars */
|
||||
int width); /* width of column, if
|
||||
* 0, use variable width */
|
||||
extern void PQprintTuples(const PGresult *res,
|
||||
FILE *fout, /* output stream */
|
||||
int printAttName, /* print attribute names */
|
||||
int terseOutput, /* delimiter bars */
|
||||
int width); /* width of column, if
|
||||
* 0, use variable width */
|
||||
|
||||
|
||||
/* === in fe-lobj.c === */
|
||||
|
||||
/* Large-object access routines */
|
||||
extern int lo_open(PGconn *conn, Oid lobjId, int mode);
|
||||
extern int lo_close(PGconn *conn, int fd);
|
||||
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
|
||||
extern Oid lo_creat(PGconn *conn, int mode);
|
||||
extern int lo_tell(PGconn *conn, int fd);
|
||||
extern int lo_unlink(PGconn *conn, Oid lobjId);
|
||||
extern Oid lo_import(PGconn *conn, const char *filename);
|
||||
extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
|
||||
extern int lo_open(PGconn *conn, Oid lobjId, int mode);
|
||||
extern int lo_close(PGconn *conn, int fd);
|
||||
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
|
||||
extern Oid lo_creat(PGconn *conn, int mode);
|
||||
extern int lo_tell(PGconn *conn, int fd);
|
||||
extern int lo_unlink(PGconn *conn, Oid lobjId);
|
||||
extern Oid lo_import(PGconn *conn, const char *filename);
|
||||
extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
|
||||
|
||||
/* === in fe-misc.c === */
|
||||
|
||||
/* Determine length of multibyte encoded char at *s */
|
||||
extern int PQmblen(const unsigned char *s, int encoding);
|
||||
extern int PQmblen(const unsigned char *s, int encoding);
|
||||
|
||||
/* Get encoding id from environment variable PGCLIENTENCODING */
|
||||
extern int PQenv2encoding(void);
|
||||
extern int PQenv2encoding(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBPQ_FE_H */
|
||||
#endif /* LIBPQ_FE_H */
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpq-int.h,v 1.43 2001/11/02 20:51:27 tgl Exp $
|
||||
* $Id: libpq-int.h,v 1.44 2001/11/05 17:46:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ typedef struct pgresAttDesc
|
||||
Oid typid; /* type id */
|
||||
int typlen; /* type size */
|
||||
int atttypmod; /* type-specific modifier info */
|
||||
} PGresAttDesc;
|
||||
} PGresAttDesc;
|
||||
|
||||
/* Data for a single attribute of a single tuple */
|
||||
|
||||
@@ -108,7 +108,7 @@ typedef struct pgresAttValue
|
||||
int len; /* length in bytes of the value */
|
||||
char *value; /* actual value, plus terminating zero
|
||||
* byte */
|
||||
} PGresAttValue;
|
||||
} PGresAttValue;
|
||||
|
||||
struct pg_result
|
||||
{
|
||||
@@ -165,7 +165,7 @@ typedef enum
|
||||
PGASYNC_READY, /* result ready for PQgetResult */
|
||||
PGASYNC_COPY_IN, /* Copy In data transfer in progress */
|
||||
PGASYNC_COPY_OUT /* Copy Out data transfer in progress */
|
||||
} PGAsyncStatusType;
|
||||
} PGAsyncStatusType;
|
||||
|
||||
/* PGSetenvStatusType defines the state of the PQSetenv state machine */
|
||||
typedef enum
|
||||
@@ -176,7 +176,7 @@ typedef enum
|
||||
SETENV_STATE_ENCODINGS_SEND, /* About to send an "encodings" query */
|
||||
SETENV_STATE_ENCODINGS_WAIT, /* Waiting for query to complete */
|
||||
SETENV_STATE_IDLE
|
||||
} PGSetenvStatusType;
|
||||
} PGSetenvStatusType;
|
||||
|
||||
/* large-object-access data ... allocated only if large-object code is used. */
|
||||
typedef struct pgLobjfuncs
|
||||
@@ -189,7 +189,7 @@ typedef struct pgLobjfuncs
|
||||
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;
|
||||
} PGlobjfuncs;
|
||||
|
||||
/* PGconn stores all the state data associated with a single connection
|
||||
* to a backend.
|
||||
@@ -365,4 +365,4 @@ __attribute__((format_arg(1)));
|
||||
#define SOCK_STRERROR strerror
|
||||
#endif
|
||||
|
||||
#endif /* LIBPQ_INT_H */
|
||||
#endif /* LIBPQ_INT_H */
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pqexpbuffer.h,v 1.9 2001/10/28 06:26:12 momjian Exp $
|
||||
* $Id: pqexpbuffer.h,v 1.10 2001/11/05 17:46:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -161,4 +161,4 @@ extern void appendPQExpBufferChar(PQExpBuffer str, char ch);
|
||||
extern void appendBinaryPQExpBuffer(PQExpBuffer str,
|
||||
const char *data, size_t datalen);
|
||||
|
||||
#endif /* PQEXPBUFFER_H */
|
||||
#endif /* PQEXPBUFFER_H */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.13 2001/01/24 19:43:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.14 2001/11/05 17:46:38 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This shouldn't be in libpq, but the monitor and some other
|
||||
@@ -39,5 +39,5 @@ pqsignal(int signo, pqsigfunc func)
|
||||
if (sigaction(signo, &act, &oact) < 0)
|
||||
return SIG_ERR;
|
||||
return oact.sa_handler;
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pqsignal.h,v 1.12 2001/10/28 06:26:12 momjian Exp $
|
||||
* $Id: pqsignal.h,v 1.13 2001/11/05 17:46:38 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This shouldn't be in libpq, but the monitor and some other
|
||||
@@ -24,4 +24,4 @@ typedef void (*pqsigfunc) (int);
|
||||
|
||||
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
|
||||
|
||||
#endif /* PQSIGNAL_H */
|
||||
#endif /* PQSIGNAL_H */
|
||||
|
||||
@@ -22,7 +22,7 @@ struct BindInfoClass_
|
||||
char *buffer; /* pointer to the buffer */
|
||||
Int4 *used; /* used space in the buffer (for strings
|
||||
* not counting the '\0') */
|
||||
char *ttlbuf; /* to save the large result */
|
||||
char *ttlbuf; /* to save the large result */
|
||||
Int4 ttlbuflen; /* the buffer length */
|
||||
Int2 returntype; /* kind of conversion to be applied when
|
||||
* returning (SQL_C_DEFAULT,
|
||||
|
||||
@@ -251,7 +251,7 @@ CC_Constructor()
|
||||
memset(&rv->connInfo, 0, sizeof(ConnInfo));
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
rv->connInfo.updatable_cursors = 1;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
memcpy(&(rv->connInfo.drivers), &globals, sizeof(globals));
|
||||
rv->sock = SOCK_Constructor(rv);
|
||||
if (!rv->sock)
|
||||
@@ -282,7 +282,7 @@ CC_Constructor()
|
||||
#ifdef MULTIBYTE
|
||||
rv->client_encoding = NULL;
|
||||
rv->server_encoding = NULL;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
|
||||
/* Initialize statement options to defaults */
|
||||
@@ -313,7 +313,7 @@ CC_Destructor(ConnectionClass *self)
|
||||
free(self->client_encoding);
|
||||
if (self->server_encoding)
|
||||
free(self->server_encoding);
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
/* Free up statement holders */
|
||||
if (self->stmts)
|
||||
{
|
||||
@@ -525,7 +525,7 @@ CC_connect(ConnectionClass *self, char do_password)
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
char *encoding;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
mylog("%s: entering...\n", func);
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ struct ConnectionClass_
|
||||
#ifdef MULTIBYTE
|
||||
char *client_encoding;
|
||||
char *server_encoding;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include "pgapifunc.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define TIMEZONE_GLOBAL _timezone
|
||||
#define TIMEZONE_GLOBAL _timezone
|
||||
#elif defined(WIN32) || defined(HAVE_INT_TIMEZONE)
|
||||
#define TIMEZONE_GLOBAL timezone
|
||||
#define TIMEZONE_GLOBAL timezone
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -141,17 +141,20 @@ static char *conv_to_octal(unsigned char val);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* TIMESTAMP <-----> SIMPLE_TIME
|
||||
* precision support since 7.2.
|
||||
* time zone support is unavailable(the stuff is unreliable)
|
||||
*/
|
||||
static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
|
||||
static BOOL
|
||||
timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
|
||||
{
|
||||
char rest[64], *ptr;
|
||||
int scnt, i;
|
||||
char rest[64],
|
||||
*ptr;
|
||||
int scnt,
|
||||
i;
|
||||
long timediff;
|
||||
BOOL withZone = *bZone;
|
||||
BOOL withZone = *bZone;
|
||||
|
||||
*bZone = FALSE;
|
||||
*zone = 0;
|
||||
@@ -194,7 +197,7 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int
|
||||
st->fr = atoi(&rest[1]);
|
||||
break;
|
||||
default:
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
if (!withZone || !*bZone || st->y < 1970)
|
||||
return TRUE;
|
||||
@@ -205,11 +208,12 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int
|
||||
return TRUE;
|
||||
}
|
||||
timediff = TIMEZONE_GLOBAL + (*zone) * 3600;
|
||||
if (!daylight && timediff == 0) /* the same timezone */
|
||||
if (!daylight && timediff == 0) /* the same timezone */
|
||||
return TRUE;
|
||||
else
|
||||
{
|
||||
struct tm tm, *tm2;
|
||||
struct tm tm,
|
||||
*tm2;
|
||||
time_t time0;
|
||||
|
||||
*bZone = FALSE;
|
||||
@@ -225,7 +229,7 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int
|
||||
return TRUE;
|
||||
if (tm.tm_isdst > 0)
|
||||
timediff -= 3600;
|
||||
if (timediff == 0) /* the same time zone */
|
||||
if (timediff == 0) /* the same time zone */
|
||||
return TRUE;
|
||||
time0 -= timediff;
|
||||
if (time0 >= 0 && (tm2 = localtime(&time0)) != NULL)
|
||||
@@ -233,20 +237,22 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int
|
||||
st->y = tm2->tm_year + 1900;
|
||||
st->m = tm2->tm_mon + 1;
|
||||
st->d = tm2->tm_mday;
|
||||
st->hh= tm2->tm_hour;
|
||||
st->mm= tm2->tm_min;
|
||||
st->ss= tm2->tm_sec;
|
||||
st->hh = tm2->tm_hour;
|
||||
st->mm = tm2->tm_min;
|
||||
st->ss = tm2->tm_sec;
|
||||
*bZone = TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
return TRUE;
|
||||
#endif /* WIN32 */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL precision)
|
||||
static BOOL
|
||||
stime2timestamp(const SIMPLE_TIME *st, char *str, BOOL bZone, BOOL precision)
|
||||
{
|
||||
char precstr[16], zonestr[16];
|
||||
int i;
|
||||
char precstr[16],
|
||||
zonestr[16];
|
||||
int i;
|
||||
|
||||
precstr[0] = '\0';
|
||||
if (precision && st->fr)
|
||||
@@ -263,13 +269,13 @@ static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL
|
||||
#if defined(WIN32) || defined(HAVE_INT_TIMEZONE)
|
||||
if (bZone && tzname[0] && tzname[0][0] && st->y >= 1970)
|
||||
{
|
||||
long zoneint;
|
||||
long zoneint;
|
||||
struct tm tm;
|
||||
time_t time0;
|
||||
|
||||
zoneint = TIMEZONE_GLOBAL;
|
||||
if (daylight && st->y >=1900)
|
||||
{
|
||||
if (daylight && st->y >= 1900)
|
||||
{
|
||||
tm.tm_year = st->y - 1900;
|
||||
tm.tm_mon = st->m - 1;
|
||||
tm.tm_mday = st->d;
|
||||
@@ -282,13 +288,13 @@ static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL
|
||||
zoneint -= 3600;
|
||||
}
|
||||
if (zoneint > 0)
|
||||
sprintf(zonestr, "-%02d", (int)zoneint / 3600);
|
||||
sprintf(zonestr, "-%02d", (int) zoneint / 3600);
|
||||
else
|
||||
sprintf(zonestr, "+%02d", -(int)zoneint / 3600);
|
||||
sprintf(zonestr, "+%02d", -(int) zoneint / 3600);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
sprintf(str, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d%s%s", st->y, st->m, st->d, st->hh, st->mm, st->ss, precstr, zonestr);
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This is called by SQLFetch() */
|
||||
@@ -323,14 +329,15 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
const char *neut_str = value;
|
||||
char midtemp[2][32];
|
||||
int mtemp_cnt = 0;
|
||||
static BindInfoClass sbic;
|
||||
BindInfoClass *pbic;
|
||||
static BindInfoClass sbic;
|
||||
BindInfoClass *pbic;
|
||||
|
||||
if (stmt->current_col >= 0)
|
||||
{
|
||||
pbic = &stmt->bindings[stmt->current_col];
|
||||
if (pbic->data_left == -2)
|
||||
pbic->data_left = (cbValueMax > 0) ? 0 : -1; /* This seems to be * needed for ADO ? */
|
||||
pbic->data_left = (cbValueMax > 0) ? 0 : -1; /* This seems to be *
|
||||
* needed for ADO ? */
|
||||
if (pbic->data_left == 0)
|
||||
{
|
||||
if (pbic->ttlbuf != NULL)
|
||||
@@ -339,8 +346,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
pbic->ttlbuf = NULL;
|
||||
pbic->ttlbuflen = 0;
|
||||
}
|
||||
pbic->data_left = -2; /* needed by ADO ? */
|
||||
return COPY_NO_DATA_FOUND;
|
||||
pbic->data_left = -2; /* needed by ADO ? */
|
||||
return COPY_NO_DATA_FOUND;
|
||||
}
|
||||
}
|
||||
/*---------
|
||||
@@ -416,10 +423,14 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
st.fr = 0;
|
||||
if (strnicmp(value, "invalid", 7) != 0)
|
||||
{
|
||||
BOOL bZone = (field_type != PG_TYPE_TIMESTAMP_NO_TMZONE && PG_VERSION_GE(SC_get_conn(stmt), 7.2));
|
||||
int zone;
|
||||
/*sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);*/
|
||||
bZone = FALSE; /* time zone stuff is unreliable */
|
||||
BOOL bZone = (field_type != PG_TYPE_TIMESTAMP_NO_TMZONE && PG_VERSION_GE(SC_get_conn(stmt), 7.2));
|
||||
int zone;
|
||||
|
||||
/*
|
||||
* sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m,
|
||||
* &st.d, &st.hh, &st.mm, &st.ss);
|
||||
*/
|
||||
bZone = FALSE; /* time zone stuff is unreliable */
|
||||
timestamp2stime(value, &st, &bZone, &zone);
|
||||
}
|
||||
else
|
||||
@@ -710,7 +721,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
{
|
||||
case SQL_C_DATE:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_DATE: /* 91 */
|
||||
case SQL_C_TYPE_DATE: /* 91 */
|
||||
#endif
|
||||
len = 6;
|
||||
{
|
||||
@@ -728,7 +739,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
|
||||
case SQL_C_TIME:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_TIME: /* 92 */
|
||||
case SQL_C_TYPE_TIME: /* 92 */
|
||||
#endif
|
||||
len = 6;
|
||||
{
|
||||
@@ -746,7 +757,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
|
||||
case SQL_C_TIMESTAMP:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_TIMESTAMP: /* 93 */
|
||||
case SQL_C_TYPE_TIMESTAMP: /* 93 */
|
||||
#endif
|
||||
len = 16;
|
||||
{
|
||||
@@ -923,7 +934,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
||||
if (pcbValue)
|
||||
*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
|
||||
|
||||
if (result == COPY_OK && stmt->current_col >=0)
|
||||
if (result == COPY_OK && stmt->current_col >= 0)
|
||||
stmt->bindings[stmt->current_col].data_left = 0;
|
||||
return result;
|
||||
|
||||
@@ -1180,7 +1191,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
BOOL search_from_pos = FALSE;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
if (ci->disallow_premature)
|
||||
prepare_dummy_cursor = stmt->pre_executing;
|
||||
|
||||
@@ -1217,7 +1228,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
else
|
||||
search_from_pos = TRUE;
|
||||
}
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
|
||||
/* If the application hasn't set a cursor name, then generate one */
|
||||
if (stmt->cursor_name[0] == '\0')
|
||||
@@ -1346,7 +1357,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
if (multibyte_strchr(&old_statement[opos], '('))
|
||||
#else
|
||||
if (strchr(&old_statement[opos], '('))
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
proc_no_param = FALSE;
|
||||
continue;
|
||||
}
|
||||
@@ -1417,7 +1428,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
npos -= 5;
|
||||
CVT_APPEND_STR(", CTID, OID from");
|
||||
}
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
}
|
||||
if (token_len == 3)
|
||||
{
|
||||
@@ -1591,7 +1602,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_C_DATE:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_DATE: /* 91 */
|
||||
case SQL_C_TYPE_DATE: /* 91 */
|
||||
#endif
|
||||
{
|
||||
DATE_STRUCT *ds = (DATE_STRUCT *) buffer;
|
||||
@@ -1605,7 +1616,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_C_TIME:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_TIME: /* 92 */
|
||||
case SQL_C_TYPE_TIME: /* 92 */
|
||||
#endif
|
||||
{
|
||||
TIME_STRUCT *ts = (TIME_STRUCT *) buffer;
|
||||
@@ -1619,7 +1630,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_C_TIMESTAMP:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_C_TYPE_TIMESTAMP: /* 93 */
|
||||
case SQL_C_TYPE_TIMESTAMP: /* 93 */
|
||||
#endif
|
||||
{
|
||||
TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer;
|
||||
@@ -1682,7 +1693,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_DATE:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_TYPE_DATE: /* 91 */
|
||||
case SQL_TYPE_DATE: /* 91 */
|
||||
#endif
|
||||
if (buf)
|
||||
{ /* copy char data to time */
|
||||
@@ -1697,7 +1708,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_TIME:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_TYPE_TIME: /* 92 */
|
||||
case SQL_TYPE_TIME: /* 92 */
|
||||
#endif
|
||||
if (buf)
|
||||
{ /* copy char data to time */
|
||||
@@ -1712,7 +1723,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
|
||||
case SQL_TIMESTAMP:
|
||||
#if (ODBCVER >= 0x0300)
|
||||
case SQL_TYPE_TIMESTAMP: /* 93 */
|
||||
case SQL_TYPE_TIMESTAMP: /* 93 */
|
||||
#endif
|
||||
|
||||
if (buf)
|
||||
@@ -1721,8 +1732,10 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
parse_datetime(cbuf, &st);
|
||||
}
|
||||
|
||||
/* sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'",
|
||||
st.y, st.m, st.d, st.hh, st.mm, st.ss);*/
|
||||
/*
|
||||
* sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'", st.y,
|
||||
* st.m, st.d, st.hh, st.mm, st.ss);
|
||||
*/
|
||||
tmp[0] = '\'';
|
||||
/* Time zone stuff is unreliable */
|
||||
stime2timestamp(&st, tmp + 1, FALSE, PG_VERSION_GE(conn, 7.2));
|
||||
@@ -1916,7 +1929,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
if (search_from_pos)
|
||||
stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
if (prepare_dummy_cursor && SC_is_pre_executable(stmt))
|
||||
{
|
||||
char fetchstr[128];
|
||||
@@ -2414,10 +2427,12 @@ static const char *hextbl = "0123456789ABCDEF";
|
||||
static int
|
||||
pg_bin2hex(UCHAR *src, UCHAR *dst, int length)
|
||||
{
|
||||
UCHAR chr, *src_wk, *dst_wk;
|
||||
BOOL backwards;
|
||||
int i;
|
||||
|
||||
UCHAR chr,
|
||||
*src_wk,
|
||||
*dst_wk;
|
||||
BOOL backwards;
|
||||
int i;
|
||||
|
||||
backwards = FALSE;
|
||||
if (dst < src)
|
||||
{
|
||||
@@ -2447,6 +2462,7 @@ pg_bin2hex(UCHAR *src, UCHAR *dst, int length)
|
||||
dst[2 * length] = '\0';
|
||||
return length;
|
||||
}
|
||||
|
||||
/*-------
|
||||
* 1. get oid (from 'value')
|
||||
* 2. open the large object
|
||||
@@ -2474,7 +2490,7 @@ convert_lo(StatementClass *stmt, const void *value, Int2 fCType, PTR rgbValue,
|
||||
BindInfoClass *bindInfo = NULL;
|
||||
ConnectionClass *conn = SC_get_conn(stmt);
|
||||
ConnInfo *ci = &(conn->connInfo);
|
||||
int factor = (fCType == SQL_C_CHAR ? 2 : 1);
|
||||
int factor = (fCType == SQL_C_CHAR ? 2 : 1);
|
||||
|
||||
/* If using SQLGetData, then current_col will be set */
|
||||
if (stmt->current_col >= 0)
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct
|
||||
int mm;
|
||||
int ss;
|
||||
int fr;
|
||||
} SIMPLE_TIME;
|
||||
} SIMPLE_TIME;
|
||||
|
||||
int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col);
|
||||
int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
|
||||
|
||||
@@ -445,11 +445,11 @@ updateCommons(const ConnInfo *ci)
|
||||
{
|
||||
sprintf(tmp, "%d", comval->unique_index);
|
||||
SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp,
|
||||
fileName);
|
||||
fileName);
|
||||
|
||||
sprintf(tmp, "%d", comval->onlyread);
|
||||
SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
|
||||
fileName);
|
||||
sprintf(tmp, "%d", comval->onlyread);
|
||||
SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
|
||||
fileName);
|
||||
}
|
||||
|
||||
sprintf(tmp, "%d", comval->use_declarefetch);
|
||||
@@ -497,7 +497,7 @@ updateCommons(const ConnInfo *ci)
|
||||
* comval->conn_settings, fileName);
|
||||
*/
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
void
|
||||
|
||||
@@ -134,7 +134,7 @@ int CALLBACK ds_optionsProc(HWND hdlg,
|
||||
WORD wMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
void updateGlobals(void);
|
||||
void writeDSNinfo(const ConnInfo *ci);
|
||||
|
||||
@@ -338,7 +338,7 @@ dconn_FDriverConnectProc(
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
void
|
||||
@@ -354,7 +354,7 @@ dconn_get_connect_attributes(const UCHAR FAR * connect_string, ConnInfo *ci)
|
||||
memset(ci, 0, sizeof(ConnInfo));
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
ci->updatable_cursors = 1;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
|
||||
our_connect_string = strdup(connect_string);
|
||||
strtok_arg = our_connect_string;
|
||||
|
||||
@@ -517,7 +517,7 @@ EN_Destructor(EnvironmentClass *self)
|
||||
mylog("exit EN_Destructor: rv = %d\n", rv);
|
||||
#ifdef _MEMORY_DEBUG_
|
||||
debug_memory_inouecheck();
|
||||
#endif /* _MEMORY_DEBUG_ */
|
||||
#endif /* _MEMORY_DEBUG_ */
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +449,6 @@ if (!keyFound)
|
||||
|
||||
return aReturnLength > 0 ? aReturnLength - 1 : 0;
|
||||
}
|
||||
#endif /* NOT_USED */
|
||||
#endif /* NOT_USED */
|
||||
|
||||
#endif /* not WIN32 */
|
||||
#endif /* not WIN32 */
|
||||
|
||||
@@ -2839,7 +2839,7 @@ getClientColumnName(ConnectionClass *conn, const char *serverTableName, char *se
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
RETCODE SQL_API
|
||||
PGAPI_ForeignKeys(
|
||||
@@ -2888,7 +2888,7 @@ PGAPI_ForeignKeys(
|
||||
pkt_alloced,
|
||||
fkt_alloced;
|
||||
ConnectionClass *conn;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
int i,
|
||||
j,
|
||||
k,
|
||||
@@ -2950,7 +2950,7 @@ PGAPI_ForeignKeys(
|
||||
QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
|
||||
#if (ODBCVER >= 0x0300)
|
||||
QR_set_field_info(stmt->result, 14, "DEFERRABILITY", PG_TYPE_INT2, 2);
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
|
||||
/*
|
||||
* also, things need to think that this statement is finished so the
|
||||
@@ -2985,7 +2985,7 @@ PGAPI_ForeignKeys(
|
||||
pkey_text = fkey_text = pkt_text = fkt_text = NULL;
|
||||
pkey_alloced = fkey_alloced = pkt_alloced = fkt_alloced = FALSE;
|
||||
conn = SC_get_conn(stmt);
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
/*
|
||||
* Case #2 -- Get the foreign keys in the specified table (fktab) that
|
||||
@@ -3151,7 +3151,7 @@ PGAPI_ForeignKeys(
|
||||
pkt_text = getClientTableName(conn, pk_table, &pkt_alloced);
|
||||
#else
|
||||
pkt_text = pk_table;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
/* If there is a pk table specified, then check it. */
|
||||
if (pk_table_needed[0] != '\0')
|
||||
{
|
||||
@@ -3192,7 +3192,7 @@ PGAPI_ForeignKeys(
|
||||
pkey_text = getClientColumnName(conn, pk_table, pkey_ptr, &pkey_alloced);
|
||||
#else
|
||||
pkey_text = pkey_ptr;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_text, pkey);
|
||||
if (strcmp(pkey_text, pkey))
|
||||
{
|
||||
@@ -3202,7 +3202,7 @@ PGAPI_ForeignKeys(
|
||||
#ifdef MULTIBYTE
|
||||
if (pkey_alloced)
|
||||
free(pkey_text);
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
/* Get to next primary key */
|
||||
for (k = 0; k < 2; k++)
|
||||
pkey_ptr += strlen(pkey_ptr) + 1;
|
||||
@@ -3245,7 +3245,7 @@ PGAPI_ForeignKeys(
|
||||
defer_type = SQL_INITIALLY_IMMEDIATE;
|
||||
else
|
||||
defer_type = SQL_NOT_DEFERRABLE;
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
|
||||
/* Get to first primary key */
|
||||
pkey_ptr = trig_args;
|
||||
@@ -3262,7 +3262,7 @@ PGAPI_ForeignKeys(
|
||||
#else
|
||||
pkey_text = pkey_ptr;
|
||||
fkey_text = fkey_ptr;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pkt_text, pkey_text);
|
||||
set_tuplefield_null(&row->tuple[0]);
|
||||
set_tuplefield_string(&row->tuple[1], "");
|
||||
@@ -3284,7 +3284,7 @@ PGAPI_ForeignKeys(
|
||||
set_tuplefield_string(&row->tuple[13], trig_args);
|
||||
#if (ODBCVER >= 0x0300)
|
||||
set_tuplefield_int2(&row->tuple[14], defer_type);
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
|
||||
QR_add_tuple(stmt->result, row);
|
||||
#ifdef MULTIBYTE
|
||||
@@ -3294,7 +3294,7 @@ PGAPI_ForeignKeys(
|
||||
if (pkey_alloced)
|
||||
free(pkey_text);
|
||||
pkey_alloced = FALSE;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
/* next primary/foreign key */
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
@@ -3306,7 +3306,7 @@ PGAPI_ForeignKeys(
|
||||
if (pkt_alloced)
|
||||
free(pkt_text);
|
||||
pkt_alloced = FALSE;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
result = PGAPI_Fetch(htbl_stmt);
|
||||
}
|
||||
@@ -3475,7 +3475,7 @@ PGAPI_ForeignKeys(
|
||||
defer_type = SQL_INITIALLY_IMMEDIATE;
|
||||
else
|
||||
defer_type = SQL_NOT_DEFERRABLE;
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
|
||||
mylog("Foreign Key Case#1: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys);
|
||||
|
||||
@@ -3492,7 +3492,7 @@ PGAPI_ForeignKeys(
|
||||
fkt_text = getClientTableName(conn, fk_table, &fkt_alloced);
|
||||
#else
|
||||
fkt_text = fk_table;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
/* Get to first foreign key */
|
||||
fkey_ptr = trig_args;
|
||||
@@ -3507,7 +3507,7 @@ PGAPI_ForeignKeys(
|
||||
#else
|
||||
pkey_text = pkey_ptr;
|
||||
fkey_text = fkey_ptr;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_text, fkt_text, fkey_text);
|
||||
|
||||
row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
|
||||
@@ -3538,7 +3538,7 @@ PGAPI_ForeignKeys(
|
||||
#if (ODBCVER >= 0x0300)
|
||||
mylog("defer_type = '%s'", defer_type);
|
||||
set_tuplefield_int2(&row->tuple[14], defer_type);
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
#endif /* ODBCVER >= 0x0300 */
|
||||
|
||||
QR_add_tuple(stmt->result, row);
|
||||
#ifdef MULTIBYTE
|
||||
@@ -3548,7 +3548,7 @@ PGAPI_ForeignKeys(
|
||||
if (fkey_alloced)
|
||||
free(fkey_text);
|
||||
fkey_alloced = FALSE;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
/* next primary/foreign key */
|
||||
for (j = 0; j < 2; j++)
|
||||
@@ -3561,7 +3561,7 @@ PGAPI_ForeignKeys(
|
||||
if (fkt_alloced)
|
||||
free(fkt_text);
|
||||
fkt_alloced = FALSE;
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
result = PGAPI_Fetch(htbl_stmt);
|
||||
}
|
||||
}
|
||||
@@ -3582,7 +3582,7 @@ PGAPI_ForeignKeys(
|
||||
free(fkt_text);
|
||||
if (fkey_alloced)
|
||||
free(fkey_text);
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
|
||||
PGAPI_FreeStmt(htbl_stmt, SQL_DROP);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef WORD WPARAM;
|
||||
typedef DWORD LPARAM;
|
||||
typedef void *HWND;
|
||||
typedef int BOOL;
|
||||
#endif /* _UNIX_ */
|
||||
#endif /* _UNIX_ */
|
||||
|
||||
#if defined(WIN32) || defined(WIN32_SYSTEM)
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef int BOOL;
|
||||
#define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0)
|
||||
#define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#define SYSERR (-1)
|
||||
|
||||
|
||||
@@ -234,10 +234,10 @@ extern "C"
|
||||
SDWORD FAR * pcbValue);
|
||||
|
||||
RETCODE SQL_API SQLDataSources(HENV henv,
|
||||
UWORD Direction, UCHAR FAR *ServerName,
|
||||
WORD BufferLength1, WORD *NameLength1,
|
||||
UCHAR FAR *Description, WORD BufferLength2,
|
||||
WORD *NameLength2);
|
||||
UWORD Direction, UCHAR FAR * ServerName,
|
||||
WORD BufferLength1, WORD *NameLength1,
|
||||
UCHAR FAR * Description, WORD BufferLength2,
|
||||
WORD *NameLength2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ typedef struct
|
||||
SQLUINTEGER dwLowWord;
|
||||
SQLINTEGER dwHighWord;
|
||||
} SQLBIGINT;
|
||||
#endif /* GCC */
|
||||
#endif /* GCC */
|
||||
|
||||
typedef struct tagDATE_STRUCT
|
||||
{
|
||||
|
||||
@@ -344,7 +344,7 @@ SQLGetStmtAttr(HSTMT StatementHandle,
|
||||
len = 4;
|
||||
break;
|
||||
case SQL_ATTR_AUTO_IPD: /* 10001 */
|
||||
/* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */
|
||||
/* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */
|
||||
case SQL_ATTR_PARAMSET_SIZE: /* 22 */
|
||||
case SQL_ATTR_PARAM_STATUS_PTR: /* 20 */
|
||||
case SQL_ATTR_PARAMS_PROCESSED_PTR: /* 21 */
|
||||
@@ -484,7 +484,7 @@ SQLSetStmtAttr(HSTMT StatementHandle,
|
||||
case SQL_ATTR_APP_ROW_DESC: /* 10010 */
|
||||
case SQL_ATTR_APP_PARAM_DESC: /* 10011 */
|
||||
case SQL_ATTR_AUTO_IPD: /* 10001 */
|
||||
/* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */
|
||||
/* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */
|
||||
case SQL_ATTR_IMP_ROW_DESC: /* 10012 */
|
||||
case SQL_ATTR_IMP_PARAM_DESC: /* 10013 */
|
||||
case SQL_ATTR_METADATA_ID: /* 10014 */
|
||||
|
||||
@@ -615,7 +615,7 @@ parse_statement(StatementClass *stmt)
|
||||
if ((unsigned char) *ptr >= 0x80)
|
||||
ptr++;
|
||||
else
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
*ptr = tolower((unsigned char) *ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,4 +241,4 @@ RETCODE SQL_API PGAPI_SetScrollOptions(
|
||||
SDWORD crowKeyset,
|
||||
UWORD crowRowset);
|
||||
|
||||
#endif /* define_PG_API_FUNC_H__ */
|
||||
#endif /* define_PG_API_FUNC_H__ */
|
||||
|
||||
@@ -539,7 +539,7 @@ getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_si
|
||||
static Int2
|
||||
getTimestampScale(StatementClass *stmt, Int4 type, int col)
|
||||
{
|
||||
ConnectionClass *conn = SC_get_conn (stmt);
|
||||
ConnectionClass *conn = SC_get_conn(stmt);
|
||||
Int4 atttypmod;
|
||||
QResultClass *result;
|
||||
ColumnInfoClass *flds;
|
||||
@@ -563,11 +563,11 @@ getTimestampScale(StatementClass *stmt, Int4 type, int col)
|
||||
flds = result->fields;
|
||||
if (flds)
|
||||
atttypmod = flds->atttypmod[col];
|
||||
mylog("atttypmod1=%d\n", atttypmod);
|
||||
mylog("atttypmod1=%d\n", atttypmod);
|
||||
}
|
||||
else
|
||||
else
|
||||
atttypmod = QR_get_atttypmod(result, col);
|
||||
mylog("atttypmod2=%d\n", atttypmod);
|
||||
mylog("atttypmod2=%d\n", atttypmod);
|
||||
return (atttypmod > -1 ? atttypmod : 0);
|
||||
}
|
||||
|
||||
@@ -575,7 +575,8 @@ mylog("atttypmod2=%d\n", atttypmod);
|
||||
static Int4
|
||||
getTimestampPrecision(StatementClass *stmt, Int4 type, int col)
|
||||
{
|
||||
Int4 fixed, scale;
|
||||
Int4 fixed,
|
||||
scale;
|
||||
|
||||
mylog("getTimestampPrecision: type=%d, col=%d\n", type, col);
|
||||
|
||||
@@ -594,8 +595,8 @@ getTimestampPrecision(StatementClass *stmt, Int4 type, int col)
|
||||
fixed = 22;
|
||||
break;
|
||||
}
|
||||
scale = getTimestampScale(stmt, type, col);
|
||||
return (scale > 0) ? fixed + 1 + scale : fixed;
|
||||
scale = getTimestampScale(stmt, type, col);
|
||||
return (scale > 0) ? fixed + 1 + scale : fixed;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -760,7 +761,7 @@ pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_
|
||||
#else
|
||||
/* CR -> CR/LF */
|
||||
return 2 * pgtype_precision(stmt, type, col, handle_unknown_size_as);
|
||||
#endif /* MULTIBYTE */
|
||||
#endif /* MULTIBYTE */
|
||||
default:
|
||||
return pgtype_precision(stmt, type, col, handle_unknown_size_as);
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
#define PG_TYPE_VARCHAR 1043
|
||||
#define PG_TYPE_DATE 1082
|
||||
#define PG_TYPE_TIME 1083
|
||||
#define PG_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */
|
||||
#define PG_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */
|
||||
#define PG_TYPE_DATETIME 1184
|
||||
#define PG_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */
|
||||
#define PG_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */
|
||||
#define PG_TYPE_TIMESTAMP 1296 /* deprecated since 7.0 */
|
||||
#define PG_TYPE_NUMERIC 1700
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ _fini(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* not __GNUC__ */
|
||||
#endif /* not WIN32 */
|
||||
#endif /* not __GNUC__ */
|
||||
#endif /* not WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Comments: See "notice.txt" for copyright and license information.
|
||||
*
|
||||
* $Id: psqlodbc.h,v 1.55 2001/11/05 10:35:14 inoue Exp $
|
||||
* $Id: psqlodbc.h,v 1.56 2001/11/05 17:46:38 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <stdio.h> /* for FILE* pointers: see GLOBAL_VALUES */
|
||||
|
||||
/* Must come before sql.h */
|
||||
#ifndef ODBCVER
|
||||
#ifndef ODBCVER
|
||||
#define ODBCVER 0x0250
|
||||
#endif /* ODBCVER_REP */
|
||||
#endif /* ODBCVER_REP */
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(WITH_UNIXODBC) || defined(WITH_IODBC)
|
||||
@@ -83,7 +83,7 @@ typedef UInt4 Oid;
|
||||
#else
|
||||
#define DRIVER_ODBC_VER "02.50"
|
||||
#define DBMS_NAME "PostgreSQL"
|
||||
#endif /* ODBCVER */
|
||||
#endif /* ODBCVER */
|
||||
|
||||
#define POSTGRESDRIVERVERSION "07.01.0009"
|
||||
|
||||
@@ -92,10 +92,10 @@ typedef UInt4 Oid;
|
||||
#define DRIVER_FILE_NAME "PSQLODBC30.DLL"
|
||||
#else
|
||||
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
|
||||
#endif /* ODBCVER */
|
||||
#endif /* ODBCVER */
|
||||
#else
|
||||
#define DRIVER_FILE_NAME "libpsqlodbc.so"
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* Limits */
|
||||
#ifdef WIN32
|
||||
@@ -209,14 +209,14 @@ typedef struct StatementOptions_
|
||||
UInt4 *rowsFetched;
|
||||
UInt2 *rowStatusArray;
|
||||
void *bookmark_ptr;
|
||||
UInt2 *row_operation_ptr;
|
||||
UInt4 *row_offset_ptr;
|
||||
UInt4 paramset_size;
|
||||
UInt4 param_bind_type;
|
||||
UInt4 *param_processed_ptr;
|
||||
UInt2 *param_status_ptr;
|
||||
UInt2 *param_operation_ptr;
|
||||
UInt4 *param_offset_ptr;
|
||||
UInt2 *row_operation_ptr;
|
||||
UInt4 *row_offset_ptr;
|
||||
UInt4 paramset_size;
|
||||
UInt4 param_bind_type;
|
||||
UInt4 *param_processed_ptr;
|
||||
UInt2 *param_status_ptr;
|
||||
UInt2 *param_operation_ptr;
|
||||
UInt4 *param_offset_ptr;
|
||||
} StatementOptions;
|
||||
|
||||
/* Used to pass extra query info to send_query */
|
||||
@@ -263,6 +263,6 @@ void debug_memory_check(void);
|
||||
#define realloc debug_realloc
|
||||
#define strdup debug_strdup
|
||||
#define free debug_free
|
||||
#endif /* _MEMORY_DEBUG_ */
|
||||
#endif /* _MEMORY_DEBUG_ */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,6 @@
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
|
||||
@@ -1165,7 +1165,7 @@ PGAPI_ExtendedFetch(
|
||||
/* this should be refined */
|
||||
else if (result > 10 && result < 20)
|
||||
*(rgfRowStatus + i) = result - 10;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
else
|
||||
*(rgfRowStatus + i) = SQL_ROW_SUCCESS;
|
||||
}
|
||||
@@ -1721,7 +1721,7 @@ SC_pos_add(StatementClass *stmt,
|
||||
/*
|
||||
* Stuff for updatable cursors end.
|
||||
*/
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
|
||||
/*
|
||||
* This positions the cursor within a rowset, that was positioned using SQLExtendedFetch.
|
||||
@@ -1752,7 +1752,7 @@ PGAPI_SetPos(
|
||||
if (stmt->options.scroll_concurrency != SQL_CONCUR_READ_ONLY)
|
||||
;
|
||||
else
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
if (fOption != SQL_POSITION && fOption != SQL_REFRESH)
|
||||
{
|
||||
stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
|
||||
@@ -1798,7 +1798,7 @@ PGAPI_SetPos(
|
||||
case SQL_ADD:
|
||||
return SC_pos_add(stmt, irow);
|
||||
}
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
/* Reset for SQLGetData */
|
||||
for (i = 0; i < num_cols; i++)
|
||||
bindings[i].data_left = -1;
|
||||
@@ -1812,7 +1812,7 @@ PGAPI_SetPos(
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
if (stmt->options.cursor_type == SQL_CURSOR_KEYSET_DRIVEN)
|
||||
SC_pos_reload(stmt, irow, (UWORD *) 0);
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
stmt->currTuple = stmt->rowset_start + irow - 1;
|
||||
stmt->bind_row = irow;
|
||||
SC_fetch(stmt);
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct tagSETUPDLG
|
||||
BOOL fNewDSN; /* New data source flag */
|
||||
BOOL fDefault; /* Default data source flag */
|
||||
|
||||
} SETUPDLG, FAR * LPSETUPDLG;
|
||||
} SETUPDLG, FAR * LPSETUPDLG;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ static struct
|
||||
{
|
||||
int type;
|
||||
char *s;
|
||||
} Statement_Type[] =
|
||||
} Statement_Type[] =
|
||||
|
||||
{
|
||||
{
|
||||
@@ -215,7 +215,7 @@ InitializeStatementOptions(StatementOptions *opt)
|
||||
opt->retrieve_data = SQL_RD_ON;
|
||||
opt->use_bookmarks = SQL_UB_OFF;
|
||||
opt->paramset_size = 1;
|
||||
opt->param_bind_type = 0; /*default is column-wise binding */
|
||||
opt->param_bind_type = 0; /* default is column-wise binding */
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +324,8 @@ SC_Destructor(StatementClass *self)
|
||||
/* about that here. */
|
||||
if (self->bindings)
|
||||
{
|
||||
int lf;
|
||||
int lf;
|
||||
|
||||
for (lf = 0; lf < self->bindings_allocated; lf++)
|
||||
{
|
||||
if (self->bindings[lf].ttlbuf != NULL)
|
||||
@@ -711,7 +712,7 @@ SC_fetch(StatementClass *self)
|
||||
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
int updret;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
Int2 num_cols,
|
||||
lf;
|
||||
Oid type;
|
||||
@@ -791,13 +792,13 @@ SC_fetch(StatementClass *self)
|
||||
updret = SQL_ROW_DELETED;
|
||||
num_cols -= 2;
|
||||
}
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
if (self->options.retrieve_data == SQL_RD_OFF) /* data isn't required */
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
return updret ? updret + 10 : SQL_SUCCESS;
|
||||
#else
|
||||
return SQL_SUCCESS;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
for (lf = 0; lf < num_cols; lf++)
|
||||
{
|
||||
mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer);
|
||||
@@ -881,7 +882,7 @@ SC_fetch(StatementClass *self)
|
||||
#ifdef DRIVER_CURSOR_IMPLEMENT
|
||||
if (updret)
|
||||
result = updret + 10;
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
#endif /* DRIVER_CURSOR_IMPLEMENT */
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +284,6 @@ SV *sv;
|
||||
PL_curcop->cop_line = oldline;
|
||||
}
|
||||
#endif
|
||||
#endif /* newCONSTSUB */
|
||||
#endif /* newCONSTSUB */
|
||||
|
||||
#endif /* _P_P_PORTABILITY_H_ */
|
||||
#endif /* _P_P_PORTABILITY_H_ */
|
||||
|
||||
@@ -72,15 +72,15 @@ const char *__movename[5] =
|
||||
|
||||
#ifndef NO_DIRECT
|
||||
#define DIRECT_ACCESS 1 /* enables direct access functions */
|
||||
#endif /* NO_DIRECT */
|
||||
#endif /* NO_DIRECT */
|
||||
|
||||
#ifndef NO_LARGE
|
||||
#define LARGE_OBJECTS 1 /* enables large objects support */
|
||||
#endif /* NO_LARGE */
|
||||
#endif /* NO_LARGE */
|
||||
|
||||
#ifndef NO_DEF_VAR
|
||||
#define DEFAULT_VARS 1 /* enables default variables use */
|
||||
#endif /* NO_DEF_VAR */
|
||||
#endif /* NO_DEF_VAR */
|
||||
|
||||
#ifdef MS_WIN32
|
||||
#define NO_SNPRINTF 1
|
||||
@@ -99,7 +99,7 @@ static PyObject *pg_default_tty; /* default debug tty */
|
||||
static PyObject *pg_default_port; /* default connection port */
|
||||
static PyObject *pg_default_user; /* default username */
|
||||
static PyObject *pg_default_passwd; /* default password */
|
||||
#endif /* DEFAULT_VARS */
|
||||
#endif /* DEFAULT_VARS */
|
||||
|
||||
DL_EXPORT(void) init_pg(void);
|
||||
int *get_type_array(PGresult *result, int nfields);
|
||||
@@ -115,7 +115,7 @@ typedef struct
|
||||
int valid; /* validity flag */
|
||||
PGconn *cnx; /* PostGres connection handle */
|
||||
PGresult *last_result; /* last result content */
|
||||
} pgobject;
|
||||
} pgobject;
|
||||
|
||||
staticforward PyTypeObject PgType;
|
||||
|
||||
@@ -144,7 +144,7 @@ typedef struct
|
||||
int result_type; /* type of previous result */
|
||||
long current_pos; /* current position in last result */
|
||||
long num_rows; /* number of (affected) rows */
|
||||
} pgqueryobject;
|
||||
} pgqueryobject;
|
||||
|
||||
staticforward PyTypeObject PgQueryType;
|
||||
|
||||
@@ -163,7 +163,7 @@ typedef struct
|
||||
int current_row; /* current selected row */
|
||||
int max_row; /* number of rows in the result */
|
||||
int num_fields; /* number of fields in each row */
|
||||
} pgsourceobject;
|
||||
} pgsourceobject;
|
||||
|
||||
staticforward PyTypeObject PgSourceType;
|
||||
|
||||
@@ -179,12 +179,12 @@ typedef struct
|
||||
pgobject * pgcnx; /* parent connection object */
|
||||
Oid lo_oid; /* large object oid */
|
||||
int lo_fd; /* large object fd */
|
||||
} pglargeobject;
|
||||
} pglargeobject;
|
||||
|
||||
staticforward PyTypeObject PglargeType;
|
||||
|
||||
#define is_pglargeobject(v) ((v)->ob_type == &PglargeType)
|
||||
#endif /* LARGE_OBJECTS */
|
||||
#endif /* LARGE_OBJECTS */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* INTERNAL FUNCTIONS */
|
||||
@@ -235,7 +235,7 @@ check_lo_obj(pglargeobject * self, int level)
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* LARGE_OBJECTS */
|
||||
#endif /* LARGE_OBJECTS */
|
||||
|
||||
/* checks source object validity */
|
||||
static int
|
||||
@@ -1450,7 +1450,7 @@ staticforward PyTypeObject PglargeType = {
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
};
|
||||
#endif /* LARGE_OBJECTS */
|
||||
#endif /* LARGE_OBJECTS */
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -1511,7 +1511,7 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
|
||||
|
||||
if ((!pgpasswd) && (pg_default_passwd != Py_None))
|
||||
pgpasswd = PyString_AsString(pg_default_passwd);
|
||||
#endif /* DEFAULT_VARS */
|
||||
#endif /* DEFAULT_VARS */
|
||||
|
||||
if ((npgobj = (pgobject *) pgobject_New()) == NULL)
|
||||
return NULL;
|
||||
@@ -2335,7 +2335,7 @@ pg_endcopy(pgobject * self, PyObject * args)
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
#endif /* DIRECT_ACCESS */
|
||||
#endif /* DIRECT_ACCESS */
|
||||
|
||||
|
||||
static PyObject *
|
||||
@@ -2623,13 +2623,13 @@ static struct PyMethodDef pgobj_methods[] = {
|
||||
{"putline", (PyCFunction) pg_putline, 1, pg_putline__doc__},
|
||||
{"getline", (PyCFunction) pg_getline, 1, pg_getline__doc__},
|
||||
{"endcopy", (PyCFunction) pg_endcopy, 1, pg_endcopy__doc__},
|
||||
#endif /* DIRECT_ACCESS */
|
||||
#endif /* DIRECT_ACCESS */
|
||||
|
||||
#ifdef LARGE_OBJECTS
|
||||
{"locreate", (PyCFunction) pg_locreate, 1, pg_locreate__doc__},
|
||||
{"getlo", (PyCFunction) pg_getlo, 1, pg_getlo__doc__},
|
||||
{"loimport", (PyCFunction) pg_loimport, 1, pg_loimport__doc__},
|
||||
#endif /* LARGE_OBJECTS */
|
||||
#endif /* LARGE_OBJECTS */
|
||||
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
@@ -3119,7 +3119,7 @@ pgsetdefport(PyObject * self, PyObject * args)
|
||||
|
||||
return old;
|
||||
}
|
||||
#endif /* DEFAULT_VARS */
|
||||
#endif /* DEFAULT_VARS */
|
||||
|
||||
/* List of functions defined in the module */
|
||||
|
||||
@@ -3140,7 +3140,7 @@ static struct PyMethodDef pg_methods[] = {
|
||||
{"get_defuser", pggetdefuser, 1, getdefuser__doc__},
|
||||
{"set_defuser", pgsetdefuser, 1, setdefuser__doc__},
|
||||
{"set_defpasswd", pgsetdefpasswd, 1, setdefpasswd__doc__},
|
||||
#endif /* DEFAULT_VARS */
|
||||
#endif /* DEFAULT_VARS */
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
@@ -3187,7 +3187,7 @@ init_pg(void)
|
||||
PyDict_SetItemString(dict, "SEEK_SET", PyInt_FromLong(SEEK_SET));
|
||||
PyDict_SetItemString(dict, "SEEK_CUR", PyInt_FromLong(SEEK_CUR));
|
||||
PyDict_SetItemString(dict, "SEEK_END", PyInt_FromLong(SEEK_END));
|
||||
#endif /* LARGE_OBJECTS */
|
||||
#endif /* LARGE_OBJECTS */
|
||||
|
||||
#ifdef DEFAULT_VARS
|
||||
/* prepares default values */
|
||||
@@ -3205,7 +3205,7 @@ init_pg(void)
|
||||
pg_default_user = Py_None;
|
||||
Py_INCREF(Py_None);
|
||||
pg_default_passwd = Py_None;
|
||||
#endif /* DEFAULT_VARS */
|
||||
#endif /* DEFAULT_VARS */
|
||||
|
||||
/* Check for errors */
|
||||
if (PyErr_Occurred())
|
||||
|
||||
Reference in New Issue
Block a user