Codebase list postgresql-ocaml / 1afc584
New upstream version 4.5.1 Stephane Glondu authored 3 years ago Stéphane Glondu committed 3 years ago
8 changed file(s) with 54 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
0 ### 4.5.1 (2019-10-11)
1
2 * Fixed warnings in C-stubs
3
4 * Support detection of release candidate version numbers
5
6
07 ### 4.5.0 (2019-06-06)
18
29 * Added support for `put_copy_data`, `put_copy_end`, and `get_copy_data`
00 (env
1 (dev (flags (:standard -w -9 -principal)))
1 (dev
2 (flags (:standard -w -9 -principal))
3 (c_flags (:standard -Wall -pedantic -Wextra -Wunused)))
24 (release (ocamlopt_flags (:standard -O3)))
35 )
0 (lang dune 1.1)
0 (lang dune 1.7)
11 (name postgresql)
2 (version 4.5.0)
2 (version 4.5.1)
0 version: "4.5.0"
0 version: "4.5.1"
11 opam-version: "2.0"
22 maintainer: "Markus Mottl <markus.mottl@gmail.com>"
33 authors: [
1818
1919 depends: [
2020 "ocaml" {>= "4.05"}
21 "dune" {build & >= "1.4.0"}
21 "dune" {build & >= "1.7.0"}
2222 "base" {build}
2323 "stdio" {build}
2424 "base-bytes"
00 open Base
11 open Stdio
2
3 let find_number ~pos str =
4 let len = String.length str in
5 let rec skip_other ~pos =
6 if pos = len then pos
7 else
8 match str.[pos] with
9 | '0'..'9' -> pos
10 | _ -> skip_other ~pos:(pos + 1)
11 in
12 let pos = skip_other ~pos in
13 let rec loop ~pos =
14 if pos = len then [], pos
15 else match str.[pos] with
16 | '0'..'9' as c ->
17 let acc, next = loop ~pos:(pos + 1) in
18 String.make 1 c :: acc, next
19 | _ -> [], pos
20 in
21 let number_lst, next = loop ~pos in
22 String.concat number_lst, next
223
324 let () =
425 let module C = Configurator.V1 in
1637 let print_fail () =
1738 eprintf "Unable to find versions from line '%s', cmd: '%s'" line cmd
1839 in
40 let exit_fail () = print_fail (); Caml.exit 1 in
1941 try
2042 let first_space = String.index_exn line ' ' in
21 let first_dot = String.index_exn line '.' in
22 let first_part =
23 let len = first_dot - first_space - 1 in
24 String.sub line ~pos:(first_space + 1) ~len
43 let major, next = find_number ~pos:first_space line in
44 let minor =
45 (* Can also handle release candidates *)
46 let c = line.[next] in
47 if Char.(c = '.') then fst (find_number ~pos:next line)
48 else if Char.(c <> 'r' || line.[next + 1] <> 'c') then exit_fail ()
49 else "0"
2550 in
26 let second_part =
27 let len = String.length line - first_dot - 1 in
28 String.sub line ~pos:(first_dot + 1) ~len
29 in
30 let search_version s =
31 let version = ref "" in
32 let stop = ref false in
33 let check_car c =
34 let ascii = Char.to_int c in
35 if (ascii >= 48 && ascii <= 57 && not !stop) then
36 version := !version ^ (String.make 1 c)
37 else stop := true
38 in
39 let () = String.iter ~f:check_car s in
40 !version
41 in
42 let major = search_version first_part in
43 let minor = search_version second_part in
44 if String.(major <> "" && minor <> "") then
51 if String.(major = "" || minor = "") then exit_fail ()
52 else
4553 "-DPG_OCAML_MAJOR_VERSION=" ^ major,
4654 "-DPG_OCAML_MINOR_VERSION=" ^ minor
47 else begin
48 print_fail ();
49 Caml.exit 1
50 end
5155 with exn -> print_fail (); raise exn
5256 in
5357 let conf = {
00 (library
11 (public_name postgresql)
22 (c_names postgresql_stubs)
3 (c_flags (
4 (:include c_flags.sexp) -g -O2 -fPIC -DPIC
5 ; NOTE: for debugging before releases
6 ; -Wall -pedantic -Wextra -Wunused -Wno-long-long -Wno-keyword-macro
7 ))
3 (c_flags
4 (:standard) (:include c_flags.sexp) -O2 -fPIC -DPIC
5 -Wno-keyword-macro
6 )
87 (c_library_flags (:include c_library_flags.sexp))
98 (libraries threads bigarray)
109 )
131131
132132 (** Result of get_copy_data *)
133133 type get_copy_result =
134 | Get_copy_data of string (** Data corresponding to one row is retured *)
134 | Get_copy_data of string (** Data corresponding to one row is returned *)
135135 | Get_copy_wait (** The next row is still being received (async only); wait
136136 for read-only, call [consume_input], and try again *)
137137 | Get_copy_end (** All data has been successfully retrieved *)
131131
132132 /* Cache for OCaml-values */
133133 static value v_empty_string = Val_unit;
134 static value *v_exc_Oid = NULL; /* Exception [Oid] */
135 static value *v_null_param = NULL;
134 static const value *v_exc_Oid = NULL; /* Exception [Oid] */
135 static const value *v_null_param = NULL;
136136
137137 CAMLprim value PQocaml_init(value __unused v_unit)
138138 {
527527 custom_hash_default,
528528 custom_serialize_default,
529529 custom_deserialize_default,
530 custom_compare_ext_default
530 custom_compare_ext_default,
531 custom_fixed_length_default
531532 };
532533
533534 static inline value alloc_result(PGresult *res, np_callback *cb)