sig
module Result :
sig
type t
type status =
Empty_query
| Command_ok
| Tuples_ok
| Copy_out
| Copy_in
| Bad_response
| Nonfatal_error
| Fatal_error
type oid = int
external string_of_status : Postgres.Result.status -> string
= "stub_PQresStatus"
external is_null : Postgres.Result.t -> bool = "res_isnull"
external status : Postgres.Result.t -> Postgres.Result.status
= "stub_PQresultStatus"
external error : Postgres.Result.t -> string
= "stub_PQresultErrorMessage"
external ntuples : Postgres.Result.t -> int = "stub_PQntuples"
external nfields : Postgres.Result.t -> int = "stub_PQnfields"
external binary_tuples : Postgres.Result.t -> bool
= "stub_PQbinaryTuples"
external fname : Postgres.Result.t -> int -> string = "stub_PQfname"
external fnumber : Postgres.Result.t -> string -> int
= "stub_PQfnumber"
external ftype : Postgres.Result.t -> int -> Postgres.Result.oid
= "stub_PQftype"
external fsize : Postgres.Result.t -> int -> int = "stub_PQfsize"
external fmod : Postgres.Result.t -> int -> int = "stub_PQfmod"
external getvalue : Postgres.Result.t -> int -> int -> string
= "stub_PQgetvalue"
external getlength : Postgres.Result.t -> int -> int -> int
= "stub_PQgetlength"
external getisnull : Postgres.Result.t -> int -> int -> bool
= "stub_PQgetisnull"
external cmd_status : Postgres.Result.t -> string = "stub_PQcmdStatus"
external cmd_tuples : Postgres.Result.t -> string = "stub_PQcmdTuples"
external oid_value : Postgres.Result.t -> Postgres.Result.oid
= "stub_PQoidValue"
end
module Connection :
sig
type t
type status = Ok | Bad
external connect : string -> Postgres.Connection.t = "stub_PQconnectdb"
external is_null : Postgres.Connection.t -> bool = "conn_isnull"
external finish : Postgres.Connection.t -> unit = "stub_PQfinish"
external reset : Postgres.Connection.t -> unit = "stub_PQreset"
external db : Postgres.Connection.t -> string = "stub_PQdb"
external user : Postgres.Connection.t -> string = "stub_PQuser"
external pass : Postgres.Connection.t -> string = "stub_PQpass"
external host : Postgres.Connection.t -> string = "stub_PQhost"
external port : Postgres.Connection.t -> string = "stub_PQport"
external tty : Postgres.Connection.t -> string = "stub_PQtty"
external options : Postgres.Connection.t -> string = "stub_PQoptions"
external status : Postgres.Connection.t -> Postgres.Connection.status
= "stub_PQstatus"
external error_message : Postgres.Connection.t -> string
= "stub_PQerrorMessage"
external backend_pid : Postgres.Connection.t -> int
= "stub_PQbackendPID"
external notifies : Postgres.Connection.t -> (string * int) option
= "stub_PQnotifies"
external set_notice_processor :
Postgres.Connection.t -> (string -> unit) -> unit
= "stub_PQsetNoticeProcessor"
external set_nonblocking : Postgres.Connection.t -> bool -> int
= "stub_PQsetnonblocking"
external is_nonblocking : Postgres.Connection.t -> bool
= "stub_PQisnonblocking"
external consume_input : Postgres.Connection.t -> int
= "stub_PQconsumeInput"
external is_busy : Postgres.Connection.t -> bool = "stub_PQisBusy"
external flush : Postgres.Connection.t -> int = "stub_PQflush"
external socket : Postgres.Connection.t -> int = "stub_PQsocket"
external request_cancel : Postgres.Connection.t -> int
= "stub_PQrequestCancel"
external getline : Postgres.Connection.t -> string -> int -> int -> int
= "stub_PQgetline"
external getline_async :
Postgres.Connection.t -> string -> int -> int -> int
= "stub_PQgetlineAsync"
external putline : Postgres.Connection.t -> string -> int
= "stub_PQputline"
external putnbytes :
Postgres.Connection.t -> string -> int -> int -> int
= "stub_PQputnbytes"
external endcopy : Postgres.Connection.t -> int = "stub_PQendcopy"
external exec : Postgres.Connection.t -> string -> Postgres.Result.t
= "stub_PQexec"
external send_query : Postgres.Connection.t -> string -> int
= "stub_PQsendQuery"
external get_result : Postgres.Connection.t -> Postgres.Result.t
= "stub_PQgetResult"
external make_empty :
Postgres.Connection.t -> Postgres.Result.status -> Postgres.Result.t
= "stub_PQmakeEmptyPGresult"
end
module LargeObjects :
sig
type t
type conn = Postgres.Connection.t
type oid = Postgres.Result.oid
external lo_open :
Postgres.LargeObjects.conn ->
Postgres.LargeObjects.oid -> Postgres.LargeObjects.t = "stub_lo_open"
external close :
Postgres.LargeObjects.conn -> Postgres.LargeObjects.t -> int
= "stub_lo_close"
external read :
Postgres.LargeObjects.conn ->
Postgres.LargeObjects.t -> string -> int -> int -> int
= "stub_lo_read"
external write :
Postgres.LargeObjects.conn ->
Postgres.LargeObjects.t -> string -> int -> int -> int
= "stub_lo_write"
external seek :
Postgres.LargeObjects.conn -> Postgres.LargeObjects.t -> int -> int
= "stub_lo_lseek"
external tell :
Postgres.LargeObjects.conn -> Postgres.LargeObjects.t -> int
= "stub_lo_tell"
external create :
Postgres.LargeObjects.conn -> Postgres.LargeObjects.oid
= "stub_lo_creat"
external unlink :
Postgres.LargeObjects.conn ->
Postgres.LargeObjects.oid -> Postgres.LargeObjects.oid
= "stub_lo_unlink"
external import :
Postgres.LargeObjects.conn -> string -> Postgres.LargeObjects.oid
= "stub_lo_import"
external export :
Postgres.LargeObjects.conn ->
Postgres.LargeObjects.oid -> string -> int = "stub_lo_export"
end
type error =
Field_out_of_range of int * int
| Tuple_out_of_range of int * int
| Binary
| ConnectionFailure of string
| UnexpectedStatus of Postgres.Result.status * string *
Postgres.Result.status list
exception Error of Postgres.error
val string_of_error : Postgres.error -> string
class type result =
object
method binary : bool
method cmd_status : string
method cmd_tuples : string
method error : string
method fmod : int -> int
method fname : int -> string
method fnumber : string -> int
method fsize : int -> int
method ftype : int -> Postgres.Result.oid
method get_array : string array array
method get_fields_list : string list
method get_list : string list list
method get_tuple_array : int -> string array
method get_tuple_list : int -> string list
method getisnull : int -> int -> bool
method getlength : int -> int -> int
method getvalue : int -> int -> string
method internal : Postgres.Result.t
method nfields : int
method ntuples : int
method oid_value : int
method status : Postgres.Result.status
end
class connection :
string ->
object
method backend : int
method close : unit
method consume_input : unit
method copy_in_channel : Pervasives.in_channel -> unit
method copy_out : (string -> unit) -> unit
method copy_out_channel : Pervasives.out_channel -> unit
method db : string
method empty_result : Postgres.Result.status -> Postgres.result
method endcopy : unit
method exec : string -> Postgres.result
method exec_expect :
string -> Postgres.Result.status list -> Postgres.result
method flush : unit
method get_result : Postgres.result option
method getline : string -> int -> int -> int
method getline_async : string -> int -> int -> int
method host : string
method internal : Postgres.Connection.t
method is_busy : bool
method is_nonblocking : bool
method lo_close : Postgres.LargeObjects.t -> unit
method lo_create : Postgres.LargeObjects.oid
method lo_export : Postgres.LargeObjects.oid -> string -> unit
method lo_import : string -> Postgres.LargeObjects.oid
method lo_open : Postgres.LargeObjects.oid -> Postgres.LargeObjects.t
method lo_read : Postgres.LargeObjects.t -> string -> int -> int -> int
method lo_seek : Postgres.LargeObjects.t -> int -> unit
method lo_tell : Postgres.LargeObjects.t -> int
method lo_unlink : Postgres.LargeObjects.oid -> unit
method lo_write :
Postgres.LargeObjects.t -> string -> int -> int -> unit
method lo_write_string : Postgres.LargeObjects.t -> string -> unit
method may_reset : unit
method notification : (string * int) option
method options : string
method pass : string
method port : string
method putline : string -> unit
method putnbytes : string -> int -> int -> unit
method request_cancel : unit
method reset : unit
method send : string -> unit
method set_nonblocking : bool -> unit
method set_notice_callback : (string -> unit) -> unit
method socket : int
method tty : string
method user : string
end
val conninfo :
?host:string ->
?hostaddr:string ->
?port:string ->
?dbname:string ->
?user:string ->
?password:string ->
?options:string -> ?tty:string -> ?requiressl:string -> unit -> string
val escape_string : string -> string
val escape_substring : string -> int -> int -> string
external escapeString :
dest:string -> int -> src:string -> int -> int -> int
= "stub_PQescapeString"
end