MainLoop.c (4)结构体PGconn 和 PGresult
来源:互联网 发布:java微信公众平台框架 编辑:程序博客网 时间:2024/06/08 14:58
MainLoop.c 文件中重要的结构体
/*
* Global psql options
*/
PsqlSettings pset 中的PGconn
/* * PGconn stores all the state data associated with a single connection * to a backend. */struct pg_conn{/* Saved values of connection options */char *pghost;//服务器主机名称char *pghostaddr;//服务器主机IPV4地址char *pgport;//与服务器通讯端口char *pgunixsocket;/* the Unix-domain socket that the server is * listening on; if NULL, uses a default * constructed from pgport */char *pgtty;/* tty on which the backend messages is * displayed (OBSOLETE, NOT USED) */char *connect_timeout;//超时时间char *client_encoding_initial;/* encoding to use */char *pgoptions;/* options to start the backend with */char *appname;/* application name */char *fbappname;/* fallback application name */char *dbName;/* database name */char *replication;/* connect as the replication standby? */char *pguser;/* Postgres username and password, if any */char *pgpass;char *keepalives;/* use TCP keepalives? */char *keepalives_idle;/* time between TCP keepalives */char *keepalives_interval;/* time between TCP keepalive * retransmits */char *keepalives_count;/* maximum number of TCP keepalive * retransmits */char *sslmode;/* SSL mode (require,prefer,allow,disable) */char *sslkey;/* client key filename */char *sslcert;/* client certificate filename */char *sslrootcert;/* root certificate filename */char *sslcrl;/* certificate revocation list filename */char *requirepeer;/* required peer credentials for local sockets */#if defined(KRB5) || defined(ENABLE_GSS) || defined(ENABLE_SSPI)char *krbsrvname;/* Kerberos service name */#endif/* Optional file to write trace info to */FILE *Pfdebug;/* Callback procedures for notice message processing */PGNoticeHooks noticeHooks;/* Event procs registered via PQregisterEventProc */PGEvent *events;/* expandable array of event data */intnEvents;/* number of active events */inteventArraySize; /* allocated array size *//* Status indicators */ConnStatusType status;PGAsyncStatusType asyncStatus;PGTransactionStatusType xactStatus; /* never changes to ACTIVE */PGQueryClass queryclass;char *last_query;/* last SQL command, or NULL if unknown */charlast_sqlstate[6];/* last reported SQLSTATE */booloptions_valid;/* true if OK to attempt connection */boolnonblocking;/* whether this connection is using nonblock * sending semantics */charcopy_is_binary; /* 1 = copy binary, 0 = copy text */intcopy_already_done;/* # bytes already returned in COPY * OUT */PGnotify *notifyHead;/* oldest unreported Notify msg */PGnotify *notifyTail;/* newest unreported Notify msg *//* Connection data */intsock;/* Unix FD for socket, -1 if not connected */SockAddrladdr;/* Local address */SockAddrraddr;/* Remote address */ProtocolVersion pversion;/* FE/BE protocol version in use */intsversion;/* server version, e.g. 70401 for 7.4.1 */boolauth_req_received;/* true if any type of auth req * received */boolpassword_needed;/* true if server demanded a password */booldot_pgpass_used;/* true if used .pgpass */boolsigpipe_so;/* have we masked SIGPIPE via SO_NOSIGPIPE? */boolsigpipe_flag;/* can we mask SIGPIPE via MSG_NOSIGNAL? *//* Transient state needed while establishing connection */struct addrinfo *addrlist;/* list of possible backend addresses */struct addrinfo *addr_cur;/* the one currently being tried */intaddrlist_family;/* needed to know how to free addrlist */PGSetenvStatusType setenv_state;/* for 2.0 protocol only */const PQEnvironmentOption *next_eo;boolsend_appname;/* okay to send application_name? *//* Miscellaneous stuff */intbe_pid;/* PID of backend --- needed for cancels */intbe_key;/* key of backend --- needed for cancels */charmd5Salt[4];/* password salt received from backend */pgParameterStatus *pstatus; /* ParameterStatus data */intclient_encoding;/* encoding id */boolstd_strings;/* standard_conforming_strings */PGVerbosity verbosity;/* error/notice message verbosity */PGlobjfuncs *lobjfuncs;/* private state for large-object access fns *//* Buffer for data received from backend and not yet processed */char *inBuffer;/* currently allocated buffer */intinBufSize;/* allocated size of buffer */intinStart;/* offset to first unconsumed data in buffer */intinCursor;/* next byte to tentatively consume */intinEnd;/* offset to first position after avail data *//* Buffer for data not yet sent to backend */char *outBuffer;/* currently allocated buffer */intoutBufSize;/* allocated size of buffer */intoutCount;/* number of chars waiting in buffer *//* State for constructing messages in outBuffer */intoutMsgStart;/* offset to msg start (length word); if -1, * msg has no length word */intoutMsgEnd;/* offset to msg end (so far) *//* Status for asynchronous result construction */PGresult *result;/* result being constructed */PGresAttValue *curTuple;/* tuple currently being read */#ifdef USE_SSLboolallow_ssl_try;/* Allowed to try SSL negotiation */boolwait_ssl_try;/* Delay SSL negotiation until after * attempting normal connection */SSL *ssl;/* SSL status, if have SSL connection */X509 *peer;/* X509 cert of server */#ifdef USE_SSL_ENGINEENGINE *engine;/* SSL engine, if any */#elsevoid *engine;/* dummy field to keep struct the same if * OpenSSL version changes */#endif#endif /* USE_SSL */#ifdef ENABLE_GSSgss_ctx_id_t gctx;/* GSS context */gss_name_tgtarg_nam;/* GSS target name */gss_buffer_desc ginbuf;/* GSS input token */gss_buffer_desc goutbuf;/* GSS output token */#endif#ifdef ENABLE_SSPI#ifndef ENABLE_GSSgss_buffer_desc ginbuf;/* GSS input token */#elsechar *gsslib;/* What GSS librart to use ("gssapi" or * "sspi") */#endifCredHandle *sspicred;/* SSPI credentials handle */CtxtHandle *sspictx;/* SSPI context */char *sspitarget;/* SSPI target name */intusesspi;/* Indicate if SSPI is in use on the * connection */#endif/* Buffer for current error message */PQExpBufferData errorMessage;//错误信息缓存/* Buffer for receiving various parts of messages */PQExpBufferData workBuffer; //工作缓存};
SendQuery函数中的PGresult *results
struct pg_result{intntups;intnumAttributes;PGresAttDesc *attDescs;PGresAttValue **tuples;/* each PGresTuple is an array of * PGresAttValue's */inttupArrSize;/* allocated size of tuples array */intnumParameters;PGresParamDesc *paramDescs;ExecStatusType resultStatus;charcmdStatus[CMDSTATUS_LEN];/* cmd status from the query */intbinary;/* 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;PGEvent *events;intnEvents;intclient_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 */charnull_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 */intcurOffset;/* start offset of free space in block */intspaceLeft;/* number of free bytes remaining in block */};
0 0
- MainLoop.c (4)结构体PGconn 和 PGresult
- Mainloop.c (1) 函数MainLoop 和PQExpBufferData,_psqlSettings
- MainLoop.c (2)函数SendQuery 和 HandleSlashCmds
- MainLoop.c (3)函数exec_command
- MainLoop
- mainLoop
- Postgres FDW 中由 PGresult 结构生成 HeapTuple 的过程
- 结构体和类的区别(C/C++)
- C++--结构体和类
- C结构体和枚举
- c指针和结构体
- 结构和类(C#)
- C语言结构体和C 结构体的区别
- 结构体 (C/C++)
- C语言结构体和共用体(2)
- C语言基础-结构体和联合体(ZZ)
- C结构体指针(和老农交流的)
- C语言基础知识之(十六):结构体和指针
- 基于树莓派的舵机控制原理
- UIButtonAndUITextField
- matlab调用c程序
- 助您开启高效编程之旅:10款云端IDE推荐
- 字符串编辑距离与拼写错误检查
- MainLoop.c (4)结构体PGconn 和 PGresult
- CABasicAnimation(基础属性动画)的简单使用
- Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently
- 第二十章 内存等空间管理类的实现
- Oracle,MySQL,SQL Server数据库的数据类型
- Android--取得系统服务
- QImage 图像格式小结
- .Net相关的证书
- 【BZOJ】【P2730】【HNOI2012】【矿场搭建】【题解】【dfs】