Class type Postgresql.result


class type result = object .. end
Class type of query results.

Indices of tuples and fields start at 0!


Main routines

method status : result_status
#status
Returns status of a command/query result.
method error : string
#error
Returns error string of a result.

Retrieving SELECT Result Information

method ntuples : int
#ntuples
Returns the number of tuples of a query result.
method nfields : int
#nfields
Returns the number of fields in a query result.
method fname : int -> string
#fname n
Raises Error if field out of range.
Returns the name of the nth field.
method fnumber : string -> int
#fnumber field
Raises Not_found if no such named field.
Returns the index of the field named field.
method fformat : int -> FFormat.t
#fformat n
Raises Error if field out of range.
Returns the format of the nth field.
method ftype : int -> ftype
#ftype n
Raises Returns the type of the nth field.
method fmod : int -> int
#fmod n
Raises Error if field out of range.
Returns type-specific modification data of the nth field.
method fsize : int -> int
#fsize n
Raises Error if field out of range.
Returns size in bytes of the nth field.
method binary_tuples : bool
#binary_tuples
Returns true iff result contains binary tuple data.

Retrieving SELECT Result Values

method getvalue : int -> int -> string
#getvalue tuple field
Raises Returns value of field in tuple.
method getisnull : int -> int -> bool
#getisnull tuple field tests for a NULL-value of field in tuple.
Raises
method getlength : int -> int -> int
#getlength tuple field
Raises Returns length of value in field of tuple in bytes.

Retrieving Non-SELECT Result Information

method cmd_status : string
#cmd_status
Returns status of SQL-command associated with result.
method cmd_tuples : string
#cmd_tuples
Returns number of rows affected by the SQL command.
method oid_value : oid
#cmd_tuples
Returns the object ID of the inserted row if the SQL command was an INSERT that inserted exactly one row into a table that has OIDs. Otherwise, returns invalid_oid.

High-level routines

method get_fnames : string array
#get_fnames
Returns array of field names.
method get_fnames_lst : string list
#get_fnames_lst
Returns list of field names.
method get_tuple : int -> string array
#get_tuple n
Raises Error if tuple out of range.
Returns all fields of the nth tuple.
method get_tuple_lst : int -> string list
#get_tuple_lst n
Raises Error if tuple out of range.
Returns all fields of the nth tuple as list.
method get_all : string array array
#get_all
Returns all tuples with all fields.
method get_all_lst : string list list
#get_all
Returns all tuples with all fields as lists.