|
1 | 1 | <!--
|
2 |
| -$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.41 2000/09/29 20:21:34 petere Exp $ |
| 2 | +$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.42 2000/10/03 19:16:16 petere Exp $ |
3 | 3 | -->
|
4 | 4 |
|
5 | 5 | <chapter id="libpq-chapter">
|
@@ -38,21 +38,22 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.41 2000/09/29 20:21:34 peter
|
38 | 38 | <filename>libpq</filename> library.
|
39 | 39 | </para>
|
40 | 40 |
|
41 |
| - <sect1 id="libpq-connect"> |
42 |
| - <title>Database Connection Functions</title> |
| 41 | + <sect1 id="libpq-connect"> |
| 42 | + <title>Database Connection Functions</title> |
43 | 43 |
|
44 |
| - <para> |
45 |
| - The following routines deal with making a connection to |
46 |
| - a <productname>Postgres</productname> backend server. The application |
47 |
| - program can have several backend connections open at one time. |
48 |
| - (One reason to do that is to access more than one database.) |
49 |
| - Each connection is represented by a PGconn object which is obtained |
50 |
| - from PQconnectdb() or PQsetdbLogin(). Note that these functions |
51 |
| - will always return a non-null object pointer, unless perhaps |
52 |
| - there is too little memory even to allocate the PGconn object. |
53 |
| - The PQstatus function should be called |
54 |
| - to check whether a connection was successfully made |
55 |
| - before queries are sent via the connection object. |
| 44 | + <para> |
| 45 | + The following routines deal with making a connection to a |
| 46 | + <productname>Postgres</productname> backend server. The |
| 47 | + application program can have several backend connections open at |
| 48 | + one time. (One reason to do that is to access more than one |
| 49 | + database.) Each connection is represented by a |
| 50 | + <structname>PGconn</> object which is obtained from |
| 51 | + <function>PQconnectdb</> or <function>PQsetdbLogin</>. Note that |
| 52 | + these functions will always return a non-null object pointer, |
| 53 | + unless perhaps there is too little memory even to allocate the |
| 54 | + <structname>PGconn</> object. The <function>PQstatus</> function |
| 55 | + should be called to check whether a connection was successfully |
| 56 | + made before queries are sent via the connection object. |
56 | 57 |
|
57 | 58 | <itemizedlist>
|
58 | 59 | <listitem>
|
@@ -87,9 +88,8 @@ PGconn *PQconnectdb(const char *conninfo)
|
87 | 88 | <listitem>
|
88 | 89 | <para>
|
89 | 90 | Name of host to connect to. If a non-zero-length string is
|
90 |
| - specified, TCP/IP |
91 |
| - communication is used. Using this parameter causes a hostname look-up. |
92 |
| - See hostaddr. |
| 91 | + specified, TCP/IP communication is used, else Unix sockets. |
| 92 | + Using this parameter causes a hostname look-up. See hostaddr. |
93 | 93 | </para>
|
94 | 94 | </listitem>
|
95 | 95 | </varlistentry>
|
@@ -1930,22 +1930,22 @@ call <function>fe_setauthsvc</function> at all.
|
1930 | 1930 |
|
1931 | 1931 | </sect1>
|
1932 | 1932 |
|
1933 |
| -<sect1 id="libpq-sample"> |
1934 |
| -<title>Sample Programs</title> |
1935 | 1933 |
|
1936 |
| -<sect2> |
1937 |
| -<title>Sample Program 1</title> |
| 1934 | + <sect1 id="libpq-example"> |
| 1935 | + <title>Example Programs</title> |
| 1936 | + |
| 1937 | + <example id="libpq-example-1"> |
| 1938 | + <title>libpq Example Program 1</title> |
1938 | 1939 |
|
1939 |
| -<para> |
1940 | 1940 | <programlisting>
|
1941 | 1941 | /*
|
1942 |
| - * testlibpq.c Test the C version of Libpq, the Postgres frontend |
1943 |
| - * library. |
1944 |
| - * |
| 1942 | + * testlibpq.c |
1945 | 1943 | *
|
| 1944 | + * Test the C version of libpq, the PostgreSQL frontend |
| 1945 | + * library. |
1946 | 1946 | */
|
1947 | 1947 | #include <stdio.h>
|
1948 |
| -#include "libpq-fe.h" |
| 1948 | +#include <libpq-fe.h> |
1949 | 1949 |
|
1950 | 1950 | void
|
1951 | 1951 | exit_nicely(PGconn *conn)
|
@@ -2065,13 +2065,11 @@ main()
|
2065 | 2065 |
|
2066 | 2066 | }
|
2067 | 2067 | </programlisting>
|
2068 |
| -</para> |
2069 |
| -</sect2> |
| 2068 | + </example> |
2070 | 2069 |
|
2071 |
| -<sect2> |
2072 |
| -<title>Sample Program 2</title> |
| 2070 | + <example id="libpq-example-2"> |
| 2071 | + <title>libpq Example Program 2</title> |
2073 | 2072 |
|
2074 |
| -<para> |
2075 | 2073 | <programlisting>
|
2076 | 2074 | /*
|
2077 | 2075 | * testlibpq2.c
|
@@ -2187,13 +2185,11 @@ main()
|
2187 | 2185 | return 0;
|
2188 | 2186 | }
|
2189 | 2187 | </programlisting>
|
2190 |
| -</para> |
2191 |
| -</sect2> |
| 2188 | + </example> |
2192 | 2189 |
|
2193 |
| -<sect2> |
2194 |
| -<title>Sample Program 3</title> |
| 2190 | + <example id="libpq-example-3"> |
| 2191 | + <title>libpq Example Program 3</> |
2195 | 2192 |
|
2196 |
| -<para> |
2197 | 2193 | <programlisting>
|
2198 | 2194 | /*
|
2199 | 2195 | * testlibpq3.c Test the C version of Libpq, the Postgres frontend
|
@@ -2370,10 +2366,9 @@ main()
|
2370 | 2366 | return 0;
|
2371 | 2367 | }
|
2372 | 2368 | </programlisting>
|
2373 |
| -</para> |
| 2369 | + </example> |
2374 | 2370 |
|
2375 |
| -</sect2> |
2376 |
| -</sect1> |
| 2371 | + </sect1> |
2377 | 2372 | </chapter>
|
2378 | 2373 |
|
2379 | 2374 | <!-- Keep this comment at the end of the file
|
|
0 commit comments