mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-11 19:20:40 +08:00
Add libpq comment about how to determine the format used for passing
binary values. Add comments to libpq C function for parameter passing.
This commit is contained in:
parent
01930cea03
commit
2296e29998
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.258 2008/06/01 16:23:08 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.259 2008/06/23 21:10:49 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="libpq">
|
<chapter id="libpq">
|
||||||
<title><application>libpq</application> - C Library</title>
|
<title><application>libpq</application> - C Library</title>
|
||||||
@ -1397,6 +1397,14 @@ PGresult *PQexecParams(PGconn *conn,
|
|||||||
If the array pointer is null then all parameters are presumed
|
If the array pointer is null then all parameters are presumed
|
||||||
to be text strings.
|
to be text strings.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
Values passed in binary format require knowlege of
|
||||||
|
the internal representation expected by the backend.
|
||||||
|
For example, integers must be passed in network byte
|
||||||
|
order. Passing <type>numeric</> values requires
|
||||||
|
knowledge of the server storage format, as implemented
|
||||||
|
in <filename>src/backend/utils/adt/numeric.c</>.
|
||||||
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.195 2008/05/29 22:02:44 tgl Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.196 2008/06/23 21:10:49 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -976,12 +976,13 @@ PQsendQueryGuts(PGconn *conn,
|
|||||||
goto sendFailed;
|
goto sendFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct the Bind message */
|
/* Construct the Bind message */
|
||||||
if (pqPutMsgStart('B', false, conn) < 0 ||
|
if (pqPutMsgStart('B', false, conn) < 0 ||
|
||||||
pqPuts("", conn) < 0 ||
|
pqPuts("", conn) < 0 ||
|
||||||
pqPuts(stmtName, conn) < 0)
|
pqPuts(stmtName, conn) < 0)
|
||||||
goto sendFailed;
|
goto sendFailed;
|
||||||
|
|
||||||
|
/* Send parameter formats */
|
||||||
if (nParams > 0 && paramFormats)
|
if (nParams > 0 && paramFormats)
|
||||||
{
|
{
|
||||||
if (pqPutInt(nParams, 2, conn) < 0)
|
if (pqPutInt(nParams, 2, conn) < 0)
|
||||||
@ -1001,6 +1002,7 @@ PQsendQueryGuts(PGconn *conn,
|
|||||||
if (pqPutInt(nParams, 2, conn) < 0)
|
if (pqPutInt(nParams, 2, conn) < 0)
|
||||||
goto sendFailed;
|
goto sendFailed;
|
||||||
|
|
||||||
|
/* Send parameters */
|
||||||
for (i = 0; i < nParams; i++)
|
for (i = 0; i < nParams; i++)
|
||||||
{
|
{
|
||||||
if (paramValues && paramValues[i])
|
if (paramValues && paramValues[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user