package postgresql

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Class type of query results.

Indices of tuples and fields start at 0!

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

  • returns

    the name of the nth field.

  • raises Error

    if field out of range.

method fnumber : string -> int

#fnumber field

  • returns

    the index of the field named field.

  • raises Not_found

    if no such named field.

method fformat : int -> FFormat.t

#fformat n

  • returns

    the format of the nth field.

  • raises Error

    if field out of range.

method ftype : int -> ftype

#ftype n

  • returns

    the type of the nth field.

  • raises Oid

    if there was no corresponding ftype for the internal oid.

  • raises Error

    if field out of range.

method ftype_oid : int -> oid

#ftype n

  • returns

    the oid of the nth field.

  • raises Error

    if field out of range.

method paramtype : int -> ftype

#paramtype n

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

  • raises Oid

    if there was no corresponding ftype for the internal oid.

  • raises Error

    if field out of range.

method paramtype_oid : int -> oid

#paramtype n

  • returns

    the oid 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.

  • raises Error

    if field out of range.

method fmod : int -> int

#fmod n

  • returns

    type-specific modification data of the nth field.

  • raises Error

    if field out of range.

method fsize : int -> int

#fsize n

  • returns

    size in bytes of the nth field.

  • raises Error

    if field out of range.

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

  • returns

    value of field in tuple.

  • raises Error

    if tuple out of range.

  • raises Error

    if field out of range.

method get_escaped_value : int -> int -> string

#get_escaped_value tuple field

  • returns

    escaped value of field in tuple.

  • raises Error

    if tuple out of range.

  • raises Error

    if field out of range.

method getisnull : int -> int -> bool

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

  • raises Error

    if tuple out of range.

  • raises Error

    if field out of range.

method getlength : int -> int -> int

#getlength tuple field

  • returns

    length of value in field of tuple in bytes.

  • raises Error

    if tuple out of range.

  • raises Error

    if field out of range.

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

  • returns

    all fields of the nth tuple.

  • raises Error

    if tuple out of range.

method get_tuple_lst : int -> string list

#get_tuple_lst n

  • returns

    all fields of the nth tuple as list.

  • raises Error

    if tuple out of range.

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.

OCaml

Innovation. Community. Security.