Commit 65c3bf19 authored by Magnus Hagander's avatar Magnus Hagander

Add libpq function PQconninfo()

This allows a caller to get back the exact conninfo array that was
used to create a connection, including parameters read from the
environment.

In doing this, restructure how options are copied from the conninfo
to the actual connection.

Zoltan Boszormenyi and Magnus Hagander
parent 4af446e7
......@@ -496,6 +496,30 @@ typedef struct
</listitem>
</varlistentry>
<varlistentry id="libpq-pqconninfo">
<term><function>PQconninfo</function><indexterm><primary>PQconninfo</></></term>
<listitem>
<para>
Returns the connection options used by a live connection.
<synopsis>
PQconninfoOption *PQconninfo(PGconn *conn);
</synopsis>
</para>
<para>
Returns a connection options array. This can be used to determine
all possible <function>PQconnectdb</function> options and the
values that were used to connect to the server. The return
value points to an array of <structname>PQconninfoOption</structname>
structures, which ends with an entry having a null <structfield>keyword</>
pointer. All notes above for <function>PQconndefaults</function> also
apply to the result of <function>PQconninfo</function>.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-pqconninfoparse">
<term><function>PQconninfoParse</function><indexterm><primary>PQconninfoParse</></></term>
<listitem>
......
......@@ -164,3 +164,4 @@ PQsetSingleRowMode 161
lo_lseek64 162
lo_tell64 163
lo_truncate64 164
PQconninfo 165
This diff is collapsed.
......@@ -262,6 +262,9 @@ extern PQconninfoOption *PQconndefaults(void);
/* parse connection options in same way as PQconnectdb */
extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
/* return the connection options used by a live connection */
extern PQconninfoOption *PQconninfo(PGconn *conn);
/* free the data structure returned by PQconndefaults() or PQconninfoParse() */
extern void PQconninfoFree(PQconninfoOption *connOptions);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment