value of a null pointer, in which case it will return
<symbol>PGRES_FATAL_ERROR</symbol>). Use
<xref linkend="libpq-PQerrorMessage"/> to get more information about such
errors.
</para>
</listitem>
</varlistentry>
</variablelist>
The command string can include multiple SQL commands
(separated by semicolons). Multiple queries sent in a single
<xref linkend="libpq-PQexec"/> call are processed in a single transaction, unless
there are explicit <command>BEGIN</command>/<command>COMMIT</command>
commands included in the query string to divide it into multiple
transactions. (See <xref linkend="protocol-flow-multi-statement"/>
for more details about how the server handles multi-query strings.)
Note however that the returned
<structname>PGresult</structname> structure describes only the result
of the last command executed from the string. Should one of the
commands fail, processing of the string stops with it and the returned
<structname>PGresult</structname> describes the error condition.
</para>
<para>
<variablelist>
<varlistentry id="libpq-PQexecParams">
<term><function>PQexecParams</function><indexterm><primary>PQexecParams</primary></indexterm></term>
<listitem>
<para>
Submits a command to the server and waits for the result,
with the ability to pass parameters separately from the SQL
command text.
<synopsis>
PGresult *PQexecParams(PGconn *conn,
const char *command,
int nParams,
const Oid *paramTypes,
const char * const *paramValues,
const int *paramLengths,
const int *paramFormats,
int resultFormat);
</synopsis>
</para>
<para>
<xref linkend="libpq-PQexecParams"/> is like <xref linkend="libpq-PQexec"/>, but offers additional
functionality: parameter values can be specified separately from the command
string proper, and query results can be requested in either text or binary
format.
</para>
<para>
The function arguments are:
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection object to send the command through.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
The SQL command string to be executed. If parameters are used,
they are referred to in the command string as <literal>$1</literal>,
<literal>$2</literal>, etc.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>nParams</parameter></term>
<listitem>
<para>
The number of parameters supplied; it is the length of the arrays
<parameter>paramTypes[]</parameter>, <parameter>paramValues[]</parameter>,
<parameter>paramLengths[]</parameter>, and <parameter>paramFormats[]</parameter>. (The
array pointers can be <symbol>NULL</symbol> when <parameter>nParams</parameter>
is zero.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>paramTypes[]</parameter></term>
<listitem>
<para>
Specifies, by OID, the data types to be assigned to the
parameter symbols. If <parameter>paramTypes</parameter> is
<symbol>NULL</symbol>, or any particular element in the array
is zero, the server infers a data type for the parameter symbol
in the same way it would do for an untyped literal string.
</para>
</listitem>
</varlistentry>