From: Bruce Momjian Date: Mon, 23 Jun 2008 21:10:49 +0000 (+0000) Subject: Add libpq comment about how to determine the format used for passing X-Git-Tag: REL8_4_BETA1~1258 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2296e299986aece2cdf0a4bff273bc505fb81368;p=postgresql Add libpq comment about how to determine the format used for passing binary values. Add comments to libpq C function for parameter passing. --- diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 006c81f307..629e501b8a 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,4 +1,4 @@ - + <application>libpq</application> - C Library @@ -1397,6 +1397,14 @@ PGresult *PQexecParams(PGconn *conn, If the array pointer is null then all parameters are presumed to be text strings. + + 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 numeric values requires + knowledge of the server storage format, as implemented + in src/backend/utils/adt/numeric.c. + diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 25ad0e4a1a..50b5c7bcf7 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * 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; } - /* construct the Bind message */ + /* Construct the Bind message */ if (pqPutMsgStart('B', false, conn) < 0 || pqPuts("", conn) < 0 || pqPuts(stmtName, conn) < 0) goto sendFailed; + /* Send parameter formats */ if (nParams > 0 && paramFormats) { if (pqPutInt(nParams, 2, conn) < 0) @@ -1001,6 +1002,7 @@ PQsendQueryGuts(PGconn *conn, if (pqPutInt(nParams, 2, conn) < 0) goto sendFailed; + /* Send parameters */ for (i = 0; i < nParams; i++) { if (paramValues && paramValues[i])