Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2296e29

Browse files
committed
Add libpq comment about how to determine the format used for passing
binary values. Add comments to libpq C function for parameter passing.
1 parent 01930ce commit 2296e29

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.258 2008/06/01 16:23:08 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.259 2008/06/23 21:10:49 momjian Exp $ -->
22

33
<chapter id="libpq">
44
<title><application>libpq</application> - C Library</title>
@@ -1397,6 +1397,14 @@ PGresult *PQexecParams(PGconn *conn,
13971397
If the array pointer is null then all parameters are presumed
13981398
to be text strings.
13991399
</para>
1400+
<para>
1401+
Values passed in binary format require knowlege of
1402+
the internal representation expected by the backend.
1403+
For example, integers must be passed in network byte
1404+
order. Passing <type>numeric</> values requires
1405+
knowledge of the server storage format, as implemented
1406+
in <filename>src/backend/utils/adt/numeric.c</>.
1407+
</para>
14001408
</listitem>
14011409
</varlistentry>
14021410

src/interfaces/libpq/fe-exec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.195 2008/05/29 22:02:44 tgl Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.196 2008/06/23 21:10:49 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -976,12 +976,13 @@ PQsendQueryGuts(PGconn *conn,
976976
goto sendFailed;
977977
}
978978

979-
/* construct the Bind message */
979+
/* Construct the Bind message */
980980
if (pqPutMsgStart('B', false, conn) < 0 ||
981981
pqPuts("", conn) < 0 ||
982982
pqPuts(stmtName, conn) < 0)
983983
goto sendFailed;
984984

985+
/* Send parameter formats */
985986
if (nParams > 0 && paramFormats)
986987
{
987988
if (pqPutInt(nParams, 2, conn) < 0)
@@ -1001,6 +1002,7 @@ PQsendQueryGuts(PGconn *conn,
10011002
if (pqPutInt(nParams, 2, conn) < 0)
10021003
goto sendFailed;
10031004

1005+
/* Send parameters */
10041006
for (i = 0; i < nParams; i++)
10051007
{
10061008
if (paramValues && paramValues[i])

0 commit comments

Comments
 (0)