⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libpq-int.h

📁 PostgreSQL7.4.6 for Linux
💻 H
📖 第 1 页 / 共 2 页
字号:
/*------------------------------------------------------------------------- * * libpq-int.h *	  This file contains internal definitions meant to be used only by *	  the frontend libpq library, not by applications that call it. * *	  An application can include this file if it wants to bypass the *	  official API defined by libpq-fe.h, but code that does so is much *	  more likely to break across PostgreSQL releases than code that uses *	  only the official API. * * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $Id: libpq-int.h,v 1.82.2.1 2004/03/05 01:54:13 tgl Exp $ * *------------------------------------------------------------------------- */#ifndef LIBPQ_INT_H#define LIBPQ_INT_H/* We assume libpq-fe.h has already been included. */#include "postgres_fe.h"#include <time.h>#include <sys/types.h>#ifndef WIN32#include <sys/time.h>#endif#if defined(WIN32) && (!defined(ssize_t))typedef int ssize_t;			/* ssize_t doesn't exist in VC (at least								 * not VC6) */#endif/* include stuff common to fe and be */#include "getaddrinfo.h"#include "libpq/pqcomm.h"#include "lib/dllist.h"/* include stuff found in fe only */#include "pqexpbuffer.h"#ifdef USE_SSL#include <openssl/ssl.h>#include <openssl/err.h>#endif/* * POSTGRES backend dependent Constants. */#define PQERRORMSG_LENGTH 1024#define CMDSTATUS_LEN 40/* * PGresult and the subsidiary types PGresAttDesc, PGresAttValue * represent the result of a query (or more precisely, of a single SQL * command --- a query string given to PQexec can contain multiple commands). * Note we assume that a single command can return at most one tuple group, * hence there is no need for multiple descriptor sets. *//* Subsidiary-storage management structure for PGresult. * See space management routines in fe-exec.c for details. * Note that space[k] refers to the k'th byte starting from the physical * head of the block --- it's a union, not a struct! */typedef union pgresult_data PGresult_data;union pgresult_data{	PGresult_data *next;		/* link to next block, or NULL */	char		space[1];		/* dummy for accessing block as bytes */};/* Data about a single attribute (column) of a query result */typedef struct pgresAttDesc{	char	   *name;			/* column name */	Oid			tableid;		/* source table, if known */	int			columnid;		/* source column, if known */	int			format;			/* format code for value (text/binary) */	Oid			typid;			/* type id */	int			typlen;			/* type size */	int			atttypmod;		/* type-specific modifier info */}	PGresAttDesc;/* * Data for a single attribute of a single tuple * * We use char* for Attribute values. * * The value pointer always points to a null-terminated area; we add a * null (zero) byte after whatever the backend sends us.  This is only * particularly useful for text values ... with a binary value, the * value might have embedded nulls, so the application can't use C string * operators on it.  But we add a null anyway for consistency. * Note that the value itself does not contain a length word. * * A NULL attribute is a special case in two ways: its len field is NULL_LEN * and its value field points to null_field in the owning PGresult.  All the * NULL attributes in a query result point to the same place (there's no need * to store a null string separately for each one). */#define NULL_LEN		(-1)	/* pg_result len for NULL value */typedef struct pgresAttValue{	int			len;			/* length in bytes of the value */	char	   *value;			/* actual value, plus terminating zero								 * byte */}	PGresAttValue;/* Typedef for message-field list entries */typedef struct pgMessageField{	struct pgMessageField *next;	/* list link */	char		code;			/* field code */	char		contents[1];	/* field value (VARIABLE LENGTH) */}	PGMessageField;/* Fields needed for notice handling */typedef struct{	PQnoticeReceiver noticeRec; /* notice message receiver */	void	   *noticeRecArg;	PQnoticeProcessor noticeProc;		/* notice message processor */	void	   *noticeProcArg;}	PGNoticeHooks;struct pg_result{	int			ntups;	int			numAttributes;	PGresAttDesc *attDescs;	PGresAttValue **tuples;		/* each PGresTuple is an array of								 * PGresAttValue's */	int			tupArrSize;		/* allocated size of tuples array */	ExecStatusType resultStatus;	char		cmdStatus[CMDSTATUS_LEN];		/* cmd status from the												 * query */	int			binary;			/* binary tuple values if binary == 1,								 * otherwise text */	/*	 * These fields are copied from the originating PGconn, so that	 * operations on the PGresult don't have to reference the PGconn.	 */	PGNoticeHooks noticeHooks;	int			client_encoding;	/* encoding id */	/*	 * Error information (all NULL if not an error result).  errMsg is the	 * "overall" error message returned by PQresultErrorMessage.  If we	 * have per-field info then it is stored in a linked list.	 */	char	   *errMsg;			/* error message, or NULL if no error */	PGMessageField *errFields;	/* message broken into fields */	/* All NULL attributes in the query result point to this null string */	char		null_field[1];	/*	 * Space management information.  Note that attDescs and error stuff,	 * if not null, point into allocated blocks.  But tuples points to a	 * separately malloc'd block, so that we can realloc it.	 */	PGresult_data *curBlock;	/* most recently allocated block */	int			curOffset;		/* start offset of free space in block */	int			spaceLeft;		/* number of free bytes remaining in block */};/* PGAsyncStatusType defines the state of the query-execution state machine */typedef enum{	PGASYNC_IDLE,				/* nothing's happening, dude */	PGASYNC_BUSY,				/* query in progress */	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;/* PGSetenvStatusType defines the state of the PQSetenv state machine *//* (this is used only for 2.0-protocol connections) */typedef enum{	SETENV_STATE_OPTION_SEND,	/* About to send an Environment Option */	SETENV_STATE_OPTION_WAIT,	/* Waiting for above send to complete */	SETENV_STATE_QUERY1_SEND,	/* About to send a status query */	SETENV_STATE_QUERY1_WAIT,	/* Waiting for query to complete */	SETENV_STATE_QUERY2_SEND,	/* About to send a status query */	SETENV_STATE_QUERY2_WAIT,	/* Waiting for query to complete */	SETENV_STATE_IDLE}	PGSetenvStatusType;/* Typedef for the EnvironmentOptions[] array */typedef struct PQEnvironmentOption{	const char *envName,		/* name of an environment variable */			   *pgName;			/* name of corresponding SET variable */}	PQEnvironmentOption;/* Typedef for parameter-status list entries */typedef struct pgParameterStatus{	struct pgParameterStatus *next;		/* list link */	char	   *name;			/* parameter name */	char	   *value;			/* parameter value */	/* Note: name and value are stored in same malloc block as struct is */}	pgParameterStatus;/* large-object-access data ... allocated only if large-object code is used. */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 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;/* * PGconn stores all the state data associated with a single connection * to a backend. */struct pg_conn{	/* Saved values of connection options */	char	   *pghost;			/* the machine on which the server is								 * running */	char	   *pghostaddr;		/* the IPv4 address of the machine on								 * which the server is running, in IPv4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -