NAME
	Sql.postgres_result - result of a Postgres query 

AUTHOR
	Francesco Chemolli <kinkie@comedia.it>

DESCRIPTION
	Sql.postgres_result contains the result of a Postgres-query.

KEYWORDS
	sql, database

SEE ALSO
	Sql.postgres, Postgres.postgres, Sql.sql, Sql.sql_result


============================================================================
NAME
	create - make a new postgres_result object

SYNTAX
	object(postgres_result) postgres->big_query(string q);
	or
	object(postgres_result) sql->big_query(string q);

DESCRIPTION
	Notice that you can't create istances of this object yourself.
	The only way to create it is via a big_query to a Postgres
	database.

SEE ALSO
	postgres->big_query, Sql.postgres

============================================================================
NAME
	num_rows - number of rows in the result

SYNTAX
	int postgres_result->num_rows();

DESCRIPTION
	Returns the number of rows in the result.

SEE ALSO
	postgres_result->num_fields

============================================================================
NAME
	num_fields - number of fields in the result

SYNTAX
	int postgres_result->num_fields();

DESCRIPTION
	Returns the number of fields in the result.

SEE ALSO
	postgres_result->num_rows

============================================================================
NAME
	fetch_fields - get informations on the fields of the current result set

SYNTAX
	array(mapping(string:mixed)) postgres_result->fetch_fields();

DESCRIPTION
	Returns an array with an entry for each field, each entry is
	a mapping with the following fields:

	string "name": name of the column

	int "type": the type ID of the field. This is the database's internal
	  representation type ID.

	int|string "length": can be an integer (the size of the contents in
	  bytes) or the word "variable".

NOTA BENE
	For char() fields, length is to be intended as the MAXIMUM length
	of the field. This is not part of the interface specifications in fact,
	but a driver-choice. In fact char() fields are for Postgres _FIXED_
	length fields, and are space-padded. If CUT_TRAILING_SPACES is defined
	when the driver is compiled (default behavior) it will cut such spaces.

SEE ALSO
	sql->list_fields

============================================================================
NAME
	seek - seek the results cursor position

SYNTAX
	void postgres_result->seek(int r);

DESCRIPTION
	Moves the result cursor (ahead or backwards) the specified number of
	rows. Notice that when you fetch a row, the cursor is automatically
	moved forward one slot.

SEE ALSO
	postgres_result->fetch_row


============================================================================
NAME
	fetch_row - fetch the next row from the result

SYNTAX
	#include <postgres.h>

	array(string) postgres_result->fetch_row();

DESCRIPTION
	Returns an array with the contents of the next row in the result.
	Advances the row cursor to the next row. Returns 0 at end of table.

BUGS
	Since there's no generic way to know whether a type is numeric
	or not in Postgres, all results are returned as strings.
	You can typecast them in Pike to get the numeric value.

SEE ALSO
	postgres_result->seek

============================================================================
THANKS
	Many thanks to Henrik Grubbström, without whose help this piece of
	code couldn't be nearly as complete as it is.
	Also thanks to Frederik Hubinette, for designing such a nice language
	as Pike.

COPYRIGHT
	This code and documentation are copyright 1997 Francesco Chemolli 
	<kinkie@comedia.it>.
	It may be copied, modified, redistributed under the terms of the
	GNU General Public License, version 2.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with the Pike source. If not, write to the Free Software
	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

	The Pike programming language is copyright Frederik Hubinette, and is
	distributed under the terms of the GNU General Public License. For furhter
	information, please consult the Pike WWW site, at http://pike.idonex.se/
