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