New upstream version 4.5.1
Stephane Glondu authored 3 years ago
Stéphane Glondu committed 3 years ago
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 | ||
0 | 7 | ### 4.5.0 (2019-06-06) |
1 | 8 | |
2 | 9 | * Added support for `put_copy_data`, `put_copy_end`, and `get_copy_data` |
0 | 0 | (env |
1 | (dev (flags (:standard -w -9 -principal))) | |
1 | (dev | |
2 | (flags (:standard -w -9 -principal)) | |
3 | (c_flags (:standard -Wall -pedantic -Wextra -Wunused))) | |
2 | 4 | (release (ocamlopt_flags (:standard -O3))) |
3 | 5 | ) |
0 | version: "4.5.0" | |
0 | version: "4.5.1" | |
1 | 1 | opam-version: "2.0" |
2 | 2 | maintainer: "Markus Mottl <markus.mottl@gmail.com>" |
3 | 3 | authors: [ |
18 | 18 | |
19 | 19 | depends: [ |
20 | 20 | "ocaml" {>= "4.05"} |
21 | "dune" {build & >= "1.4.0"} | |
21 | "dune" {build & >= "1.7.0"} | |
22 | 22 | "base" {build} |
23 | 23 | "stdio" {build} |
24 | 24 | "base-bytes" |
0 | 0 | open Base |
1 | 1 | 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 | |
2 | 23 | |
3 | 24 | let () = |
4 | 25 | let module C = Configurator.V1 in |
16 | 37 | let print_fail () = |
17 | 38 | eprintf "Unable to find versions from line '%s', cmd: '%s'" line cmd |
18 | 39 | in |
40 | let exit_fail () = print_fail (); Caml.exit 1 in | |
19 | 41 | try |
20 | 42 | 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" | |
25 | 50 | 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 | |
45 | 53 | "-DPG_OCAML_MAJOR_VERSION=" ^ major, |
46 | 54 | "-DPG_OCAML_MINOR_VERSION=" ^ minor |
47 | else begin | |
48 | print_fail (); | |
49 | Caml.exit 1 | |
50 | end | |
51 | 55 | with exn -> print_fail (); raise exn |
52 | 56 | in |
53 | 57 | let conf = { |
0 | 0 | (library |
1 | 1 | (public_name postgresql) |
2 | 2 | (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 | ) | |
8 | 7 | (c_library_flags (:include c_library_flags.sexp)) |
9 | 8 | (libraries threads bigarray) |
10 | 9 | ) |
131 | 131 | |
132 | 132 | (** Result of get_copy_data *) |
133 | 133 | 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 *) | |
135 | 135 | | Get_copy_wait (** The next row is still being received (async only); wait |
136 | 136 | for read-only, call [consume_input], and try again *) |
137 | 137 | | Get_copy_end (** All data has been successfully retrieved *) |
131 | 131 | |
132 | 132 | /* Cache for OCaml-values */ |
133 | 133 | 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; | |
136 | 136 | |
137 | 137 | CAMLprim value PQocaml_init(value __unused v_unit) |
138 | 138 | { |
527 | 527 | custom_hash_default, |
528 | 528 | custom_serialize_default, |
529 | 529 | custom_deserialize_default, |
530 | custom_compare_ext_default | |
530 | custom_compare_ext_default, | |
531 | custom_fixed_length_default | |
531 | 532 | }; |
532 | 533 | |
533 | 534 | static inline value alloc_result(PGresult *res, np_callback *cb) |