summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/libpq.html
blob: 07bd97369f9814a2c04a7c6ebcb9618361d750ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 34. libpq — C Library</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="client-interfaces.html" title="Part IV. Client Interfaces" /><link rel="next" href="libpq-connect.html" title="34.1. Database Connection Control Functions" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 34. <span class="application">libpq</span> — C Library</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="client-interfaces.html" title="Part IV. Client Interfaces">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="client-interfaces.html" title="Part IV. Client Interfaces">Up</a></td><th width="60%" align="center">Part IV. Client Interfaces</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="libpq-connect.html" title="34.1. Database Connection Control Functions">Next</a></td></tr></table><hr /></div><div class="chapter" id="LIBPQ"><div class="titlepage"><div><div><h2 class="title">Chapter 34. <span class="application">libpq</span> — C Library</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="libpq-connect.html">34.1. Database Connection Control Functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-connect.html#LIBPQ-CONNSTRING">34.1.1. Connection Strings</a></span></dt><dt><span class="sect2"><a href="libpq-connect.html#LIBPQ-PARAMKEYWORDS">34.1.2. Parameter Key Words</a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-status.html">34.2. Connection Status Functions</a></span></dt><dt><span class="sect1"><a href="libpq-exec.html">34.3. Command Execution Functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-exec.html#LIBPQ-EXEC-MAIN">34.3.1. Main Functions</a></span></dt><dt><span class="sect2"><a href="libpq-exec.html#LIBPQ-EXEC-SELECT-INFO">34.3.2. Retrieving Query Result Information</a></span></dt><dt><span class="sect2"><a href="libpq-exec.html#LIBPQ-EXEC-NONSELECT">34.3.3. Retrieving Other Result Information</a></span></dt><dt><span class="sect2"><a href="libpq-exec.html#LIBPQ-EXEC-ESCAPE-STRING">34.3.4. Escaping Strings for Inclusion in SQL Commands</a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-async.html">34.4. Asynchronous Command Processing</a></span></dt><dt><span class="sect1"><a href="libpq-pipeline-mode.html">34.5. Pipeline Mode</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-pipeline-mode.html#LIBPQ-PIPELINE-USING">34.5.1. Using Pipeline Mode</a></span></dt><dt><span class="sect2"><a href="libpq-pipeline-mode.html#LIBPQ-PIPELINE-FUNCTIONS">34.5.2. Functions Associated with Pipeline Mode</a></span></dt><dt><span class="sect2"><a href="libpq-pipeline-mode.html#LIBPQ-PIPELINE-TIPS">34.5.3. When to Use Pipeline Mode</a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-single-row-mode.html">34.6. Retrieving Query Results Row-by-Row</a></span></dt><dt><span class="sect1"><a href="libpq-cancel.html">34.7. Canceling Queries in Progress</a></span></dt><dt><span class="sect1"><a href="libpq-fastpath.html">34.8. The Fast-Path Interface</a></span></dt><dt><span class="sect1"><a href="libpq-notify.html">34.9. Asynchronous Notification</a></span></dt><dt><span class="sect1"><a href="libpq-copy.html">34.10. Functions Associated with the <code class="command">COPY</code> Command</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-copy.html#LIBPQ-COPY-SEND">34.10.1. Functions for Sending <code class="command">COPY</code> Data</a></span></dt><dt><span class="sect2"><a href="libpq-copy.html#LIBPQ-COPY-RECEIVE">34.10.2. Functions for Receiving <code class="command">COPY</code> Data</a></span></dt><dt><span class="sect2"><a href="libpq-copy.html#LIBPQ-COPY-DEPRECATED">34.10.3. Obsolete Functions for <code class="command">COPY</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-control.html">34.11. Control Functions</a></span></dt><dt><span class="sect1"><a href="libpq-misc.html">34.12. Miscellaneous Functions</a></span></dt><dt><span class="sect1"><a href="libpq-notice-processing.html">34.13. Notice Processing</a></span></dt><dt><span class="sect1"><a href="libpq-events.html">34.14. Event System</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-events.html#LIBPQ-EVENTS-TYPES">34.14.1. Event Types</a></span></dt><dt><span class="sect2"><a href="libpq-events.html#LIBPQ-EVENTS-PROC">34.14.2. Event Callback Procedure</a></span></dt><dt><span class="sect2"><a href="libpq-events.html#LIBPQ-EVENTS-FUNCS">34.14.3. Event Support Functions</a></span></dt><dt><span class="sect2"><a href="libpq-events.html#LIBPQ-EVENTS-EXAMPLE">34.14.4. Event Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-envars.html">34.15. Environment Variables</a></span></dt><dt><span class="sect1"><a href="libpq-pgpass.html">34.16. The Password File</a></span></dt><dt><span class="sect1"><a href="libpq-pgservice.html">34.17. The Connection Service File</a></span></dt><dt><span class="sect1"><a href="libpq-ldap.html">34.18. LDAP Lookup of Connection Parameters</a></span></dt><dt><span class="sect1"><a href="libpq-ssl.html">34.19. SSL Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="libpq-ssl.html#LIBQ-SSL-CERTIFICATES">34.19.1. Client Verification of Server Certificates</a></span></dt><dt><span class="sect2"><a href="libpq-ssl.html#LIBPQ-SSL-CLIENTCERT">34.19.2. Client Certificates</a></span></dt><dt><span class="sect2"><a href="libpq-ssl.html#LIBPQ-SSL-PROTECTION">34.19.3. Protection Provided in Different Modes</a></span></dt><dt><span class="sect2"><a href="libpq-ssl.html#LIBPQ-SSL-FILEUSAGE">34.19.4. SSL Client File Usage</a></span></dt><dt><span class="sect2"><a href="libpq-ssl.html#LIBPQ-SSL-INITIALIZE">34.19.5. SSL Library Initialization</a></span></dt></dl></dd><dt><span class="sect1"><a href="libpq-threading.html">34.20. Behavior in Threaded Programs</a></span></dt><dt><span class="sect1"><a href="libpq-build.html">34.21. Building <span class="application">libpq</span> Programs</a></span></dt><dt><span class="sect1"><a href="libpq-example.html">34.22. Example Programs</a></span></dt></dl></div><a id="id-1.7.3.2" class="indexterm"></a><a id="id-1.7.3.3" class="indexterm"></a><p>
  <span class="application">libpq</span> is the <acronym class="acronym">C</acronym>
  application programmer's interface to <span class="productname">PostgreSQL</span>.
  <span class="application">libpq</span> is a set of library functions that allow
  client programs to pass queries to the <span class="productname">PostgreSQL</span>
  backend server and to receive the results of these queries.
 </p><p>
  <span class="application">libpq</span> is also the underlying engine for several
  other <span class="productname">PostgreSQL</span> application interfaces, including
  those written for C++, Perl, Python, Tcl and <span class="application">ECPG</span>.
  So some aspects of <span class="application">libpq</span>'s behavior will be
  important to you if you use one of those packages.  In particular,
  <a class="xref" href="libpq-envars.html" title="34.15. Environment Variables">Section 34.15</a>,
  <a class="xref" href="libpq-pgpass.html" title="34.16. The Password File">Section 34.16</a> and
  <a class="xref" href="libpq-ssl.html" title="34.19. SSL Support">Section 34.19</a>
  describe behavior that is visible to the user of any application
  that uses <span class="application">libpq</span>.
 </p><p>
  Some short programs are included at the end of this chapter (<a class="xref" href="libpq-example.html" title="34.22. Example Programs">Section 34.22</a>) to show how
  to write programs that use <span class="application">libpq</span>.  There are also several
  complete examples of <span class="application">libpq</span> applications in the
  directory <code class="filename">src/test/examples</code> in the source code distribution.
 </p><p>
  Client programs that use <span class="application">libpq</span> must
  include the header file
  <code class="filename">libpq-fe.h</code><a id="id-1.7.3.7.3" class="indexterm"></a>
  and must link with the <span class="application">libpq</span> library.
 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="client-interfaces.html" title="Part IV. Client Interfaces">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="client-interfaces.html" title="Part IV. Client Interfaces">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="libpq-connect.html" title="34.1. Database Connection Control Functions">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part IV. Client Interfaces </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 34.1. Database Connection Control Functions</td></tr></table></div></body></html>