array of <structname>PQconninfoOption</structname>
structures, which ends with an entry having a null <structfield>keyword</structfield>
pointer. All notes above for <xref linkend="libpq-PQconndefaults"/> also
apply to the result of <xref linkend="libpq-PQconninfo"/>.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-PQconninfoParse">
<term><function>PQconninfoParse</function><indexterm><primary>PQconninfoParse</primary></indexterm></term>
<listitem>
<para>
Returns parsed connection options from the provided connection string.
<synopsis>
PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
</synopsis>
</para>
<para>
Parses a connection string and returns the resulting options as an
array; or returns <symbol>NULL</symbol> if there is a problem with the connection
string. This function can be used to extract
the <xref linkend="libpq-PQconnectdb"/> options in the provided
connection string. The return value points to an array of
<structname>PQconninfoOption</structname> structures, which ends
with an entry having a null <structfield>keyword</structfield> pointer.
</para>
<para>
All legal options will be present in the result array, but the
<literal>PQconninfoOption</literal> for any option not present
in the connection string will have <literal>val</literal> set to
<literal>NULL</literal>; default values are not inserted.
</para>
<para>
If <literal>errmsg</literal> is not <symbol>NULL</symbol>, then <literal>*errmsg</literal> is set
to <symbol>NULL</symbol> on success, else to a <function>malloc</function>'d error string explaining
the problem. (It is also possible for <literal>*errmsg</literal> to be
set to <symbol>NULL</symbol> and the function to return <symbol>NULL</symbol>;
this indicates an out-of-memory condition.)
</para>
<para>
After processing the options array, free it by passing it to
<xref linkend="libpq-PQconninfoFree"/>. If this is not done, some memory
is leaked for each call to <xref linkend="libpq-PQconninfoParse"/>.
Conversely, if an error occurs and <literal>errmsg</literal> is not <symbol>NULL</symbol>,
be sure to free the error string using <xref linkend="libpq-PQfreemem"/>.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-PQfinish">
<term><function>PQfinish</function><indexterm><primary>PQfinish</primary></indexterm></term>
<listitem>
<para>
Closes the connection to the server. Also frees
memory used by the <structname>PGconn</structname> object.
<synopsis>
void PQfinish(PGconn *conn);
</synopsis>
</para>
<para>
Note that even if the server connection attempt fails (as
indicated by <xref linkend="libpq-PQstatus"/>), the application should call <xref linkend="libpq-PQfinish"/>
to free the memory used by the <structname>PGconn</structname> object.
The <structname>PGconn</structname> pointer must not be used again after
<xref linkend="libpq-PQfinish"/> has been called.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-PQreset">
<term><function>PQreset</function><indexterm><primary>PQreset</primary></indexterm></term>
<listitem>
<para>
Resets the communication channel to the server.
<synopsis>
void PQreset(PGconn *conn);
</synopsis>
</para>
<para>
This function will close the connection
to the server and attempt to establish a new
connection, using all the same
parameters previously used. This might be useful for
error recovery if a working connection is lost.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-PQresetStart">
<term><function>PQresetStart</function><indexterm><primary>PQresetStart</primary></indexterm></term>