From b032f606b0e3c58eb39fd7dcd411dfbe40897095 Mon Sep 17 00:00:00 2001
From: "Stephen R. van den Berg" <srb@cuci.nl>
Date: Sat, 5 Jul 2008 13:17:45 +0200
Subject: [PATCH] Fix documentation for postgres module

Rev: lib/modules/Sql.pmod/postgres.pike:1.32
Rev: src/modules/Postgres/pgresult.c:1.36
Rev: src/modules/Postgres/postgres.c:1.64
---
 lib/modules/Sql.pmod/postgres.pike |  4 ++--
 src/modules/Postgres/pgresult.c    | 17 ++++++++++++++---
 src/modules/Postgres/postgres.c    |  7 ++++---
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/lib/modules/Sql.pmod/postgres.pike b/lib/modules/Sql.pmod/postgres.pike
index 3310b487fd..a919f85b92 100644
--- a/lib/modules/Sql.pmod/postgres.pike
+++ b/lib/modules/Sql.pmod/postgres.pike
@@ -1,7 +1,7 @@
 /*
  * This is part of the Postgres module for Pike.
  *
- * $Id: postgres.pike,v 1.31 2008/07/04 09:38:40 srb Exp $
+ * $Id: postgres.pike,v 1.32 2008/07/05 11:17:45 srb Exp $
  *
  */
 
@@ -375,7 +375,7 @@ array(mapping(string:mixed)) list_fields (string table, void|string wild)
 //! recommend using @[query()] for simpler queries (because it is
 //! easier to handle, but stores all the result in memory), and
 //! @[big_query()] for queries you expect to return huge amounts of
-//! data (it's harder to handle, but fectches results on demand).
+//! data (it's harder to handle, but fetches results on demand).
 //!
 //! @note
 //! This function @b{can@} raise exceptions.
diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c
index d17e9d5e92..b2b03ee974 100644
--- a/src/modules/Postgres/pgresult.c
+++ b/src/modules/Postgres/pgresult.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: pgresult.c,v 1.35 2008/06/25 11:53:32 srb Exp $
+|| $Id: pgresult.c,v 1.36 2008/07/05 11:17:45 srb Exp $
 */
 
 /*
@@ -55,6 +55,14 @@
  * 20 characters', where in Postgres it means 'any string long exactly 20
  * characters'. With Postgres you have to use type varchar otherwise, but
  * this makes its SQL incompatible with other servers'.
+ *
+ * Newer versions of Postgres seem to do this by themselves already.
+ * Newer meaning at least 7.4 and later.  Since Postgres 7.4 is the oldest
+ * Postgres version that is still supported (by the Postgres team itself),
+ * we might as well drop support for any earlier versions as well.
+ *
+ * FIXME: test the CUT_TRAILING_SPACES macro, and delete it if it is already
+ * being done by the DB.
  */
 
 #define CUT_TRAILING_SPACES
@@ -257,8 +265,11 @@ static void f_fetch_fields (INT32 args)
 		/* no default value information is availible */
 		push_text("type");
 		push_int(PQftype(res,j));
-		/* ARGH! I'd kill 'em! How am I supposed to know how types are coded
-		 * internally!?!?!?!?
+		/* ARGH! I'd kill 'em! How am I supposed to know how types are
+  	         * coded internally!?!?!?!?
+  	         *
+  	         * The internal encoding is well defined for the standard
+  	         * types (big endian).  The problem are the extended types.
 		 */
 		push_text("length");
 		tmp=PQfsize(res,j);
diff --git a/src/modules/Postgres/postgres.c b/src/modules/Postgres/postgres.c
index 3e5520383e..be5d026785 100644
--- a/src/modules/Postgres/postgres.c
+++ b/src/modules/Postgres/postgres.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: postgres.c,v 1.63 2008/07/04 09:38:40 srb Exp $
+|| $Id: postgres.c,v 1.64 2008/07/05 11:17:45 srb Exp $
 */
 
 /*
@@ -370,8 +370,9 @@ static void f_select_db (INT32 args)
  *! @note
  *! This function @b{can@} raise exceptions.
  *!
- *! The program @[Sql.postgres_result] is exactly
- *! the same as @[Postgres.postgres_result].
+ *! The program @[Sql.postgres_result] is a superset of
+ *! the raw @[Postgres.postgres_result] which does not do chunking to
+ *! avoid excessive memory usage in case of large resultsets.
  *!
  *! @seealso
  *!  @[Sql.Sql], @[Sql.sql_result]
-- 
GitLab