# 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.

    method ntuples : int

`#ntuples`
Returns the number of tuples of a query result.

    method nparams : int

`#nparams`
Returns the number of parameters of a prepared statement. This function is only useful when inspecting the result of `#describe_prepared`. For other types of queries it will return zero.

    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 `n`th 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 `n`th field.

    method ftype : int -> ftype

`#ftype n`
Raises

- `Oid` if there was no corresponding ftype for the internal `oid`.
- `Error` if field out of range.

Returns the type of the `n`th field.

    method paramtype : int -> ftype

`#paramtype n`
Raises

- `Oid` if there was no corresponding ftype for the internal `oid`.
- `Error` if field out of range.

Returns the datatype of the indicated statement parameter. Parameter numbers start at 0. This function is only useful when inspecting the result of `#describe_prepared`. For other types of queries it will return zero.

    method fmod : int -> int

`#fmod n`
Raises `Error` if field out of range.
Returns type-specific modification data of the `n`th field.

    method fsize : int -> int

`#fsize n`
Raises `Error` if field out of range.
Returns size in bytes of the `n`th field.

    method binary_tuples : bool

`#binary_tuples`
Returns `true` iff result contains binary tuple data.

    method getvalue : int -> int -> string

`#getvalue tuple field`
Raises

- `Error` if tuple out of range.
- `Error` if field out of range.

Returns value of `field` in `tuple`.

    method get_escaped_value : int -> int -> string

`#get_escaped_value tuple field`
Raises

- `Error` if tuple out of range.
- `Error` if field out of range.

Returns escaped value of `field` in `tuple`.

    method getisnull : int -> int -> bool

`#getisnull tuple field` tests for a NULL-value of `field` in `tuple`.
Raises

- `Error` if tuple out of range.
- `Error` if field out of range.

    method getlength : int -> int -> int

`#getlength tuple field`
Raises

- `Error` if tuple out of range.
- `Error` if field out of range.

Returns length of value in `field` of `tuple` in bytes.

    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`.

    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 `n`th tuple.

    method get_tuple_lst : int -> string list

`#get_tuple_lst n`
Raises `Error` if tuple out of range.
Returns all fields of the `n`th 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.