Add libpq comment about how to determine the format used for passing
authorBruce Momjian <bruce@momjian.us>
Mon, 23 Jun 2008 21:10:49 +0000 (21:10 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 23 Jun 2008 21:10:49 +0000 (21:10 +0000)
binary values.

Add comments to libpq C function for parameter passing.

doc/src/sgml/libpq.sgml
src/interfaces/libpq/fe-exec.c

index a0521505201102063b7523d2a1f54269c4ff0a45..5c2db0ef81ea26cbc68bebb22d3bec02eb6a9608 100644 (file)
@@ -1397,6 +1397,14 @@ PGresult *PQexecParams(PGconn *conn,
             If the array pointer is null then all parameters are presumed
             to be text strings.
            </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>
          </varlistentry>
 
index 97bfcf990f1b4cf2a340d992e7060c0b8961a3ed..37f3f9946e2ad6cb57235da5a444f03937f21950 100644 (file)
@@ -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])