Binary files pgocaml-1.6.old/pGOCaml.cmi and pgocaml-1.6/pGOCaml.cmi differ
Binary files pgocaml-1.6.old/pGOCaml_generic.cmi and pgocaml-1.6/pGOCaml_generic.cmi differ
diff -ur pgocaml-1.6.old/pGOCaml_generic.ml pgocaml-1.6/pGOCaml_generic.ml
--- pgocaml-1.6.old/pGOCaml_generic.ml 2012-04-13 13:55:09.000000000 +0100
+++ pgocaml-1.6/pGOCaml_generic.ml 2017-11-22 15:52:09.933379044 +0000
@@ -48,7 +48,7 @@
val flush : out_channel -> unit t
val input_char : in_channel -> char t
val input_binary_int : in_channel -> int t
- val really_input : in_channel -> string -> int -> int -> unit t
+ val really_input : in_channel -> bytes -> int -> int -> unit t
val close_in : in_channel -> unit t
end
@@ -434,7 +434,7 @@
if len > !max_message_length then (
(* Skip the message so we stay in synch with the stream. *)
let bufsize = 65_536 in
- let buf = String.create bufsize in
+ let buf = Bytes.create bufsize in
let rec loop n =
if n > 0 then begin
let m = min n bufsize in
@@ -450,7 +450,7 @@
) else (
(* Read the binary message content. *)
- let msg = String.create len in
+ let msg = Bytes.create len in
really_input ichan msg 0 len >>= fun () ->
return (typ, msg)
)
@@ -627,17 +627,17 @@
| 2l -> AuthenticationKerberosV5
| 3l -> AuthenticationCleartextPassword
| 4l ->
- let salt = String.create 2 in
+ let salt = Bytes.create 2 in
for i = 0 to 2 do
- salt.[i] <- get_char ()
+ Bytes.set salt i (get_char ())
done;
- AuthenticationCryptPassword salt
+ AuthenticationCryptPassword (Bytes.to_string salt)
| 5l ->
- let salt = String.create 4 in
+ let salt = Bytes.create 4 in
for i = 0 to 3 do
- salt.[i] <- get_char ()
+ Bytes.set salt i (get_char ())
done;
- AuthenticationMD5Password salt
+ AuthenticationMD5Password (Bytes.to_string salt)
| 6l -> AuthenticationSCMCredential
| _ -> UnknownMessage (typ, msg)
);
@@ -704,7 +704,7 @@
if len > Sys.max_string_length then
raise (Error "PGOCaml: result field is too wide for string");
let bytes = get_n_bytes len in
- len, bytes
+ len, Bytes.to_string bytes
) in
fields := field :: !fields
done;
@@ -794,8 +794,8 @@
| None -> return ()
| Some conn ->
let rec loop () =
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with ReadyForQuery _ -> return () | _ -> loop ()
in
loop ()
@@ -968,8 +968,8 @@
let rec loop msg =
(match msg with
| Some msg -> send_recv conn msg
- | None -> receive_message conn) >>= fun msg ->
- let msg = parse_backend_message msg in
+ | None -> receive_message conn) >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ReadyForQuery _ -> return () (* Finished connecting! *)
@@ -1051,8 +1051,8 @@
(* Wait for ReadyForQuery. *)
let rec loop () =
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ReadyForQuery _ -> return () (* Finished! *)
| ErrorResponse err -> pg_error ~conn err (* Error *)
@@ -1086,8 +1086,8 @@
send_message conn msg >>= fun () ->
flush_msg conn >>= fun () ->
let rec loop () =
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ErrorResponse err -> pg_error err
| ParseComplete -> return () (* Finished! *)
@@ -1137,8 +1137,8 @@
*)
let rec loop () =
(* NB: receive_message flushes the output connection. *)
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ReadyForQuery _ -> return () (* Finished! *)
| ErrorResponse err -> pg_error ~conn err (* Error *)
@@ -1253,8 +1253,8 @@
send_message conn msg >>= fun () ->
flush_msg conn >>= fun () ->
let rec loop () =
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ErrorResponse err -> pg_error err
| CloseComplete -> return () (* Finished! *)
@@ -1274,8 +1274,8 @@
send_message conn msg >>= fun () ->
flush_msg conn >>= fun () ->
let rec loop () =
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ErrorResponse err -> pg_error err
| CloseComplete -> return ()
@@ -1309,8 +1309,8 @@
add_string msg name;
send_message conn msg >>= fun () ->
flush_msg conn >>= fun () ->
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
( match msg with
| ErrorResponse err -> pg_error err
| ParameterDescription params ->
@@ -1322,8 +1322,8 @@
| _ ->
fail (Error ("PGOCaml: unknown response from describe: " ^
string_of_msg_t msg))) >>= fun params ->
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ErrorResponse err -> pg_error err
| NoData -> return (params, None)
@@ -1350,8 +1350,8 @@
add_string msg portal;
send_message conn msg >>= fun () ->
flush_msg conn >>= fun () ->
- receive_message conn >>= fun msg ->
- let msg = parse_backend_message msg in
+ receive_message conn >>= fun (c, msg) ->
+ let msg = parse_backend_message (c, Bytes.to_string msg) in
match msg with
| ErrorResponse err -> pg_error err
| NoData -> return None
diff -ur pgocaml-1.6.old/pGOCaml_generic.mli pgocaml-1.6/pGOCaml_generic.mli
--- pgocaml-1.6.old/pGOCaml_generic.mli 2012-04-13 13:55:09.000000000 +0100
+++ pgocaml-1.6/pGOCaml_generic.mli 2017-11-22 15:52:26.785377248 +0000
@@ -38,7 +38,7 @@
val flush : out_channel -> unit t
val input_char : in_channel -> char t
val input_binary_int : in_channel -> int t
- val really_input : in_channel -> string -> int -> int -> unit t
+ val really_input : in_channel -> bytes -> int -> int -> unit t
val close_in : in_channel -> unit t
end