Fixed PQconsumeInput() usage for PQgetCopyData() in libpq.sgml.
(Related mail thread:
http://archives.postgresql.org/pgsql-novice/2005-06/msg00038.php)

Fixed SegFault in PQsendQueryGuts() when user submitted a binary
parameter without size.

And 2 typo fixes.
Index: doc/src/sgml/libpq.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/libpq.sgml,v
retrieving revision 1.182
diff -u -c -r1.182 libpq.sgml
*** doc/src/sgml/libpq.sgml	4 Jun 2005 20:42:41 -0000	1.182
--- doc/src/sgml/libpq.sgml	7 Jun 2005 15:43:51 -0000
***************
*** 3230,3237 ****
  When <parameter>async</> is true (not zero), <function>PQgetCopyData</>
  will not block waiting for input; it will return zero if the <command>COPY</command> is still
  in progress but no complete row is available.  (In this case wait for
! read-ready before trying again; it does not matter whether you call
! <function>PQconsumeInput</>.)  When <parameter>async</> is
  false (zero), <function>PQgetCopyData</> will block until data is available
  or the operation completes.
  </para>
--- 3230,3237 ----
  When <parameter>async</> is true (not zero), <function>PQgetCopyData</>
  will not block waiting for input; it will return zero if the <command>COPY</command> is still
  in progress but no complete row is available.  (In this case wait for
! read-ready and then call <function>PQconsumeInput</> before calling
! <function>PQgetCopyData</> again.)  When <parameter>async</> is
  false (zero), <function>PQgetCopyData</> will block until data is available
  or the operation completes.
  </para>
Index: src/interfaces/libpq/fe-exec.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v
retrieving revision 1.167
diff -u -c -r1.167 fe-exec.c
*** src/interfaces/libpq/fe-exec.c	29 Apr 2005 13:42:21 -0000	1.167
--- src/interfaces/libpq/fe-exec.c	7 Jun 2005 15:44:00 -0000
***************
*** 30,36 ****
  #endif
  
  /* keep this in same order as ExecStatusType in libpq-fe.h */
! char	   *const pgresStatus[] = {
  	"PGRES_EMPTY_QUERY",
  	"PGRES_COMMAND_OK",
  	"PGRES_TUPLES_OK",
--- 30,36 ----
  #endif
  
  /* keep this in same order as ExecStatusType in libpq-fe.h */
! char *const pgresStatus[] = {
  	"PGRES_EMPTY_QUERY",
  	"PGRES_COMMAND_OK",
  	"PGRES_TUPLES_OK",
***************
*** 960,966 ****
  			if (paramFormats && paramFormats[i] != 0)
  			{
  				/* binary parameter */
! 				nbytes = paramLengths[i];
  			}
  			else
  			{
--- 960,975 ----
  			if (paramFormats && paramFormats[i] != 0)
  			{
  				/* binary parameter */
! 				if ( paramLengths )
! 				{
! 					nbytes = paramLengths[i];
! 				}
! 				else
! 				{
! 					printfPQExpBuffer(&conn->errorMessage,
! 									  libpq_gettext("you have to specify size for binary formats.\n"));
! 					goto sendFailed;
! 				}
  			}
  			else
  			{
Index: src/interfaces/libpq/libpq-fe.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/libpq-fe.h,v
retrieving revision 1.116
diff -u -c -r1.116 libpq-fe.h
*** src/interfaces/libpq/libpq-fe.h	31 Dec 2004 22:03:50 -0000	1.116
--- src/interfaces/libpq/libpq-fe.h	7 Jun 2005 15:44:00 -0000
***************
*** 156,162 ****
  	char	   *fieldSep;		/* field separator */
  	char	   *tableOpt;		/* insert to HTML <table ...> */
  	char	   *caption;		/* HTML <caption> */
! 	char	  **fieldName;		/* null terminated array of repalcement
  								 * field names */
  } PQprintOpt;
  
--- 156,162 ----
  	char	   *fieldSep;		/* field separator */
  	char	   *tableOpt;		/* insert to HTML <table ...> */
  	char	   *caption;		/* HTML <caption> */
! 	char	  **fieldName;		/* null terminated array of replacement
  								 * field names */
  } PQprintOpt;
  
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to