📄 libpq-fe.h
字号:
extern const char *PQparameterStatus(const PGconn *conn, const char *paramName);extern int PQprotocolVersion(const PGconn *conn);extern int PQserverVersion(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);/* Get the OpenSSL structure associated with a connection. Returns NULL for * unencrypted connections or if any other TLS library is in use. */extern void *PQgetssl(PGconn *conn);/* Tell libpq whether it needs to initialize OpenSSL */extern void PQinitSSL(int do_init);/* Set verbosity for PQerrorMessage and PQresultErrorMessage */extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);/* Enable/disable tracing */extern void PQtrace(PGconn *conn, FILE *debug_port);extern void PQuntrace(PGconn *conn);/* Override default notice handling routines */extern PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg);extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg);/* * Used to set callback that prevents concurrent access to * non-thread safe functions that libpq needs. * The default implementation uses a libpq internal mutex. * Only required for multithreaded apps that use kerberos * both within their app and for postgresql connections. */typedef void (*pgthreadlock_t) (int acquire);extern pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler);/* === in fe-exec.c === *//* Simple synchronous query */extern PGresult *PQexec(PGconn *conn, const char *query);extern PGresult *PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);extern PGresult *PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);extern PGresult *PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);/* Interface for multiple-result or asynchronous queries */extern int PQsendQuery(PGconn *conn, const char *query);extern int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);extern int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);extern int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);extern PGresult *PQgetResult(PGconn *conn);/* Routines for managing an asynchronous query */extern int PQisBusy(PGconn *conn);extern int PQconsumeInput(PGconn *conn);/* LISTEN/NOTIFY support */extern PGnotify *PQnotifies(PGconn *conn);/* Routines for copy in/out */extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);extern int PQputCopyEnd(PGconn *conn, const char *errormsg);extern int PQgetCopyData(PGconn *conn, char **buffer, int async);/* Deprecated 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);/* Set blocking/nonblocking connection to the backend */extern int PQsetnonblocking(PGconn *conn, int arg);extern int PQisnonblocking(const PGconn *conn);extern int PQisthreadsafe(void);/* Force the write buffer to be written (or at least try) */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);/* Accessor functions for PGresult objects */extern ExecStatusType PQresultStatus(const PGresult *res);extern char *PQresStatus(ExecStatusType status);extern char *PQresultErrorMessage(const PGresult *res);extern char *PQresultErrorField(const PGresult *res, int fieldcode);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 PQftable(const PGresult *res, int field_num);extern int PQftablecol(const PGresult *res, int field_num);extern int PQfformat(const PGresult *res, int field_num);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 int PQnparams(const PGresult *res);extern Oid PQparamtype(const PGresult *res, int param_num);/* Describe prepared statements and portals */extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);extern PGresult *PQdescribePortal(PGconn *conn, const char *portal);extern int PQsendDescribePrepared(PGconn *conn, const char *stmt);extern int PQsendDescribePortal(PGconn *conn, const char *portal);/* Delete a PGresult */extern void PQclear(PGresult *res);/* For freeing other alloc'd results, such as PGnotify structs */extern void PQfreemem(void *ptr);/* Exists for backward compatibility. bjm 2003-03-24 */#define PQfreeNotify(ptr) PQfreemem(ptr)/* Define the string so all uses are consistent. */#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"/* * 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);/* Quoting strings before inclusion in queries. */extern size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error);extern unsigned char *PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length);extern unsigned char *PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen);/* These forms are deprecated! */extern size_t PQescapeString(char *to, const char *from, size_t length);extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length);/* === in fe-print.c === */extern voidPQprint(FILE *fout, /* output stream */ const PGresult *res, const PQprintOpt *ps); /* option structure *//* * really old printing routines */extern voidPQdisplayTuples(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 voidPQprintTuples(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, const 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 Oid lo_create(PGconn *conn, Oid lobjId);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 char *s, int encoding);/* Determine display length of multibyte encoded char at *s */extern int PQdsplen(const char *s, int encoding);/* Get encoding id from environment variable PGCLIENTENCODING */extern int PQenv2encoding(void);/* === in fe-auth.c === */extern char *PQencryptPassword(const char *passwd, const char *user);#ifdef __cplusplus}#endif#endif /* LIBPQ_FE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -