Postgresql 中文操作指南

Chapter 34. libpq — C Library

Table of Contents

libpq 是 C 应用程序编程器与 PostgreSQL 的接口。libpq 是一组库函数,允许客户端程序将查询传递到 PostgreSQL 后端服务器并接收这些查询的结果。

libpq is the C application programmer’s interface to PostgreSQL. libpq is a set of library functions that allow client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries.

libpq 也是其他几个 PostgreSQL 应用程序接口的基础引擎,包括为 C++、Perl、Python、Tcl 和 ECPG 编写的接口。因此,如果您使用这些包中的任何一个,libpq 行为的一些方面对您来说将很重要。尤其重要的是, Section 34.15Section 34.16Section 34.19 描述了任何使用 libpq 的应用程序的用户可见的行为。

libpq is also the underlying engine for several other PostgreSQL application interfaces, including those written for C++, Perl, Python, Tcl and ECPG. So some aspects of libpq’s behavior will be important to you if you use one of those packages. In particular, Section 34.15, Section 34.16 and Section 34.19 describe behavior that is visible to the user of any application that uses libpq.

本章末尾包含一些简短程序 ( Section 34.22 ),用以演示如何编写使用 libpq 的程序。源代码分发版中的 src/test/examples 目录中还有一些 libpq 应用程序的完整示例。

Some short programs are included at the end of this chapter (Section 34.22) to show how to write programs that use libpq. There are also several complete examples of libpq applications in the directory src/test/examples in the source code distribution.

使用 libpq 的客户端程序必须包含以下头文件 libpq-fe.h ,并且必须与 libpq 库建立链接。

Client programs that use libpq must include the header file libpq-fe.h and must link with the libpq library.