From 66b97f85b706d5dd71a0b2f7fd8114759dd20fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Cichoci=C5=84ski?= Date: Wed, 23 Oct 2019 23:19:16 +0200 Subject: [PATCH] dune upgrade --- Makefile | 10 ++++----- dune-project | 2 ++ mysql/dune | 4 ++++ mysql/jbuild | 8 ------- mysql/mysql.ml | 48 ++++++++++++++++++++-------------------- postgresql/dune | 4 ++++ postgresql/jbuild | 8 ------- postgresql/postgresql.ml | 48 ++++++++++++++++++++-------------------- ppx/dune | 6 +++++ ppx/jbuild | 11 --------- ppx/sequoia_ppx.ml | 14 ++++++------ sequoia-mysql.opam | 8 +++---- sequoia-postgresql.opam | 6 ++--- sequoia-ppx.opam | 6 ++--- sequoia-sqlite.opam | 6 ++--- sequoia.opam | 7 +++--- sqlite/dune | 4 ++++ sqlite/jbuild | 6 ----- sqlite/sqlite.ml | 8 +++---- src/dune | 4 ++++ src/jbuild | 5 ----- src/query_common.ml | 3 +-- src/select.ml | 4 ++-- src/sequoia.ml | 3 --- src/update.ml | 6 ++--- src/vector.ml | 2 +- test/dune | 9 ++++++++ test/jbuild | 12 ---------- test/ppx/dune | 20 +++++++++++++++++ test/ppx/jbuild | 22 ------------------ test/ppx/queries/q8.ml | 4 ++-- test/ppx/readme/dune | 9 ++++++++ test/ppx/readme/jbuild | 13 ----------- test/ppx/t.cppo.ml | 4 ++-- 34 files changed, 154 insertions(+), 180 deletions(-) create mode 100644 dune-project create mode 100644 mysql/dune delete mode 100644 mysql/jbuild create mode 100644 postgresql/dune delete mode 100644 postgresql/jbuild create mode 100644 ppx/dune delete mode 100644 ppx/jbuild create mode 100644 sqlite/dune delete mode 100644 sqlite/jbuild create mode 100644 src/dune delete mode 100644 src/jbuild create mode 100644 test/dune delete mode 100644 test/jbuild create mode 100644 test/ppx/dune delete mode 100644 test/ppx/jbuild create mode 100644 test/ppx/readme/dune delete mode 100644 test/ppx/readme/jbuild diff --git a/Makefile b/Makefile index 6a22b02..6cde888 100644 --- a/Makefile +++ b/Makefile @@ -2,21 +2,21 @@ INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) # Default rule default: - jbuilder build @install + dune build @install install: - jbuilder install $(INSTALL_ARGS) + dune install $(INSTALL_ARGS) uninstall: - jbuilder uninstall $(INSTALL_ARGS) + dune uninstall $(INSTALL_ARGS) reinstall: uninstall install test: - jbuilder build @runtest + dune build @runtest example: - jbuilder build examples/server.exe + dune build examples/server.exe clean: rm -rf _build diff --git a/dune-project b/dune-project new file mode 100644 index 0000000..11f73dc --- /dev/null +++ b/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.0) +(name sequoia) diff --git a/mysql/dune b/mysql/dune new file mode 100644 index 0000000..96c0c28 --- /dev/null +++ b/mysql/dune @@ -0,0 +1,4 @@ +(library + (name sequoia_mysql) + (public_name sequoia-mysql) + (libraries sequoia unix)) diff --git a/mysql/jbuild b/mysql/jbuild deleted file mode 100644 index 3bfa920..0000000 --- a/mysql/jbuild +++ /dev/null @@ -1,8 +0,0 @@ -(jbuild_version 1) - -(library - ((name sequoia_mysql) - (public_name sequoia-mysql) - (libraries - (sequoia - unix)))) diff --git a/mysql/mysql.ml b/mysql/mysql.ml index 60873ae..4def308 100644 --- a/mysql/mysql.ml +++ b/mysql/mysql.ml @@ -106,7 +106,7 @@ module Field = struct | Null.Enum (_, t, _) -> t | fld -> table fld - let to_string : type a b. (a, b) t -> string = function + (* let to_string : type a b. (a, b) t -> string = function | Time (name, table) -> sprintf "%s.%s" (Table.name table) name | Timestamp (name, table) -> sprintf "%s.%s" (Table.name table) name | Date (name, table) -> sprintf "%s.%s" (Table.name table) name @@ -117,7 +117,7 @@ module Field = struct | Null.Date (name, table) -> sprintf "%s.%s" (Table.name table) name | Null.Datetime (name, table) -> sprintf "%s.%s" (Table.name table) name | Null.Enum (name, table, _) -> sprintf "%s.%s" (Table.name table) name - | other -> to_string other + | other -> to_string other *) let to_string fld = let t = table fld in @@ -391,7 +391,7 @@ module Expr = struct let date ?(year = 0) ?(month = 0) ?(day = 0) = fun _ -> Lit (Lit.Date { base_time with year; month; day }) let datetime ?(year = 0) ?(month = 0) ?(day = 0) - ?(hour = 0) ?(minute = 0) ?(second = 0) = fun _ -> + ?(minute = 0) ?(second = 0) = fun _ -> Lit (Lit.Datetime { base_time with year; month; day; minute; second }) let enum inst = fun _ -> @@ -419,17 +419,17 @@ module Expr = struct let compress f = fun src -> Compress (f src) let concat f = fun src -> Concat (f src) let concat_ws sep l = fun src -> Concat_ws (sep, List.map (fun f -> f src) l) - let connection_id () = fun src -> Connection_id + let connection_id () = fun _src -> Connection_id let conv f i j = fun src -> Conv (f src, i, j) let cos f = fun src -> Cos (f src) let cot f = fun src -> Cot (f src) let count ?(distinct = false) f = fun src -> Count (f src, distinct) let crc32 f = fun src -> Crc32 (f src) - let current_date () = fun src -> Current_date - let current_time () = fun src -> Current_time - let current_timestamp () = fun src -> Current_timestamp - let current_user () = fun src -> Current_user - let database () = fun src -> Database + let current_date () = fun _src -> Current_date + let current_time () = fun _src -> Current_time + let current_timestamp () = fun _src -> Current_timestamp + let current_user () = fun _src -> Current_user + let database () = fun _src -> Database let date_of : ('s M.Select.source -> [< `Date | `Datetime] time t) -> 's M.Select.source -> [`Date] time t = fun f src -> DateFn (f src) let date_add f i u = fun src -> Date_add (f src, i, u) let date_format f fmt = fun src -> Date_format (f src, fmt) @@ -448,7 +448,7 @@ module Expr = struct let ifnull f g = fun src -> Ifnull (f src, g src) let last_day f = fun src -> Last_day (f src) let length f = fun src -> Length (f src) - let localtime () = fun src -> Localtime + let localtime () = fun _src -> Localtime let log f = fun src -> Log (f src) let log10 f = fun src -> Log10 (f src) let log2 f = fun src -> Log2 (f src) @@ -460,7 +460,7 @@ module Expr = struct let minute f = fun src -> Minute (f src) let month f = fun src -> Month (f src) let monthname f = fun src -> Monthname (f src) - let now () = fun src -> Now + let now () = fun _src -> Now let nullif f g = fun src -> Nullif (f src, g src) let ord f = fun src -> Ord (f src) let pow f = fun src -> Pow (f src) @@ -489,23 +489,23 @@ module Expr = struct let timestampdiff u f g = fun src -> Timestampdiff (u, f src, g src) let trim f = fun src -> Trim (f src) let uncompress f = fun src -> Uncompress (f src) - let utc_date () = fun src -> Utc_date - let utc_time () = fun src -> Utc_time - let utc_timestamp () = fun src -> Utc_timestamp - let uuid () = fun src -> Uuid - let uuid_short () = fun src -> Uuid_short - let week () = fun src -> Week - let weekday () = fun src -> Weekday - let weekofyear () = fun src -> Weekofyear + let utc_date () = fun _src -> Utc_date + let utc_time () = fun _src -> Utc_time + let utc_timestamp () = fun _src -> Utc_timestamp + let uuid () = fun _src -> Uuid + let uuid_short () = fun _src -> Uuid_short + let week () = fun _src -> Week + let weekday () = fun _src -> Weekday + let weekofyear () = fun _src -> Weekofyear let upper f = fun src -> Upper (f src) - let year () = fun src -> Year + let year () = fun _src -> Year let as_time f = fun src -> Cast (f src, Time) let as_timestamp f = fun src -> Cast (f src, Timestamp) let as_date f = fun src -> Cast (f src, Date) let as_datetime f = fun src -> Cast (f src, Datetime) - let rec build + let build : type a. handover:handover -> build_step -> a t -> build_step = fun ~handover st e -> let build_param = build_param D.placeholder in @@ -543,7 +543,7 @@ module Expr = struct | Collation e -> fn "COLLATION(" [e] ")" | Compress e -> fn "COMPRESS(" [e] ")" | Concat l -> fn "CONCAT(" l ")" - | Concat_ws (s, l) -> fn "CONCAT_WS" l ")" + | Concat_ws (_s, l) -> fn "CONCAT_WS" l ")" | Connection_id -> fn "CONNECTION_ID" [] ")" | Conv (e1, i, j) -> fn "CONV(" [e1] (sprintf ", %d, %d)" i j) | Cos e -> fn "COS(" [e] ")" @@ -576,13 +576,13 @@ module Expr = struct | If (b, t, f) -> let st1 = fn "IF(" [b] "" in let st2 = fn ~st:st1 (st1.repr ^ ", ") [t; f] ")" in - Sequoia.{ st2 with params = st1.params @ st2.params } + { st2 with params = st1.params @ st2.params } | From_days e -> fn "FROM_DAYS(" [e] ")" | From_unixtime e -> fn "FROM_UNIXTIME(" [e] ")" | Ifnull (e1, e2) -> let st1 = fn "IFNULL(" [e1] "" in let st2 = fn ~st:st1 (st1.repr ^ ", ") [e2] ")" in - Sequoia.{ st2 with params = st1.params @ st2.params } + { st2 with params = st1.params @ st2.params } | Last_day e -> fn "LAST_DAY(" [e] ")" | Length e -> fn "LENGTH(" [e] ")" | Localtime -> fn "LOCALTIME(" [] ")" diff --git a/postgresql/dune b/postgresql/dune new file mode 100644 index 0000000..3c5c752 --- /dev/null +++ b/postgresql/dune @@ -0,0 +1,4 @@ +(library + (name sequoia_postgresql) + (public_name sequoia-postgresql) + (libraries sequoia unix)) diff --git a/postgresql/jbuild b/postgresql/jbuild deleted file mode 100644 index 242b876..0000000 --- a/postgresql/jbuild +++ /dev/null @@ -1,8 +0,0 @@ -(jbuild_version 1) - -(library - ((name sequoia_postgresql) - (public_name sequoia-postgresql) - (libraries - (sequoia - unix)))) diff --git a/postgresql/postgresql.ml b/postgresql/postgresql.ml index 8cd9f44..1a6c906 100644 --- a/postgresql/postgresql.ml +++ b/postgresql/postgresql.ml @@ -106,7 +106,7 @@ module Field = struct | Null.Enum (_, t, _) -> t | fld -> table fld - let to_string : type a b. (a, b) t -> string = function + (* let to_string : type a b. (a, b) t -> string = function | Time (name, table) -> sprintf "%s.%s" (Table.name table) name | Timestamp (name, table) -> sprintf "%s.%s" (Table.name table) name | Date (name, table) -> sprintf "%s.%s" (Table.name table) name @@ -117,7 +117,7 @@ module Field = struct | Null.Date (name, table) -> sprintf "%s.%s" (Table.name table) name | Null.Datetime (name, table) -> sprintf "%s.%s" (Table.name table) name | Null.Enum (name, table, _) -> sprintf "%s.%s" (Table.name table) name - | other -> to_string other + | other -> to_string other *) let to_string fld = let t = table fld in @@ -391,7 +391,7 @@ module Expr = struct let date ?(year = 0) ?(month = 0) ?(day = 0) = fun _ -> Lit (Lit.Date { base_time with year; month; day }) let datetime ?(year = 0) ?(month = 0) ?(day = 0) - ?(hour = 0) ?(minute = 0) ?(second = 0) = fun _ -> + ?(minute = 0) ?(second = 0) = fun _ -> Lit (Lit.Datetime { base_time with year; month; day; minute; second }) let enum inst = fun _ -> @@ -419,17 +419,17 @@ module Expr = struct let compress f = fun src -> Compress (f src) let concat f = fun src -> Concat (f src) let concat_ws sep l = fun src -> Concat_ws (sep, List.map (fun f -> f src) l) - let connection_id () = fun src -> Connection_id + let connection_id () = fun _src -> Connection_id let conv f i j = fun src -> Conv (f src, i, j) let cos f = fun src -> Cos (f src) let cot f = fun src -> Cot (f src) let count ?(distinct = false) f = fun src -> Count (f src, distinct) let crc32 f = fun src -> Crc32 (f src) - let current_date () = fun src -> Current_date - let current_time () = fun src -> Current_time - let current_timestamp () = fun src -> Current_timestamp - let current_user () = fun src -> Current_user - let database () = fun src -> Database + let current_date () = fun _src -> Current_date + let current_time () = fun _src -> Current_time + let current_timestamp () = fun _src -> Current_timestamp + let current_user () = fun _src -> Current_user + let database () = fun _src -> Database let date_of : ('s M.Select.source -> [< `Date | `Datetime] time t) -> 's M.Select.source -> [`Date] time t = fun f src -> DateFn (f src) let date_add f i u = fun src -> Date_add (f src, i, u) let date_format f fmt = fun src -> Date_format (f src, fmt) @@ -448,7 +448,7 @@ module Expr = struct let ifnull f g = fun src -> Ifnull (f src, g src) let last_day f = fun src -> Last_day (f src) let length f = fun src -> Length (f src) - let localtime () = fun src -> Localtime + let localtime () = fun _src -> Localtime let log f = fun src -> Log (f src) let log10 f = fun src -> Log10 (f src) let log2 f = fun src -> Log2 (f src) @@ -460,7 +460,7 @@ module Expr = struct let minute f = fun src -> Minute (f src) let month f = fun src -> Month (f src) let monthname f = fun src -> Monthname (f src) - let now () = fun src -> Now + let now () = fun _src -> Now let nullif f g = fun src -> Nullif (f src, g src) let ord f = fun src -> Ord (f src) let pow f = fun src -> Pow (f src) @@ -489,23 +489,23 @@ module Expr = struct let timestampdiff u f g = fun src -> Timestampdiff (u, f src, g src) let trim f = fun src -> Trim (f src) let uncompress f = fun src -> Uncompress (f src) - let utc_date () = fun src -> Utc_date - let utc_time () = fun src -> Utc_time - let utc_timestamp () = fun src -> Utc_timestamp - let uuid () = fun src -> Uuid - let uuid_short () = fun src -> Uuid_short - let week () = fun src -> Week - let weekday () = fun src -> Weekday - let weekofyear () = fun src -> Weekofyear + let utc_date () = fun _src -> Utc_date + let utc_time () = fun _src -> Utc_time + let utc_timestamp () = fun _src -> Utc_timestamp + let uuid () = fun _src -> Uuid + let uuid_short () = fun _src -> Uuid_short + let week () = fun _src -> Week + let weekday () = fun _src -> Weekday + let weekofyear () = fun _src -> Weekofyear let upper f = fun src -> Upper (f src) - let year () = fun src -> Year + let year () = fun _src -> Year let as_time f = fun src -> Cast (f src, Time) let as_timestamp f = fun src -> Cast (f src, Timestamp) let as_date f = fun src -> Cast (f src, Date) let as_datetime f = fun src -> Cast (f src, Datetime) - let rec build + let build : type a. handover:handover -> build_step -> a t -> build_step = fun ~handover st e -> let build_param = build_param D.placeholder in @@ -543,7 +543,7 @@ module Expr = struct | Collation e -> fn "COLLATION(" [e] ")" | Compress e -> fn "COMPRESS(" [e] ")" | Concat l -> fn "CONCAT(" l ")" - | Concat_ws (s, l) -> fn "CONCAT_WS" l ")" + | Concat_ws (_s, l) -> fn "CONCAT_WS" l ")" | Connection_id -> fn "CONNECTION_ID" [] ")" | Conv (e1, i, j) -> fn "CONV(" [e1] (sprintf ", %d, %d)" i j) | Cos e -> fn "COS(" [e] ")" @@ -577,13 +577,13 @@ module Expr = struct | If (b, t, f) -> let st1 = fn "CASE WHEN " [b] " THEN " in let st2 = fn ~st:st1 (st1.repr ^ " ELSE ") [t; f] " END " in - Sequoia.{ st2 with params = st1.params @ st2.params } + { st2 with params = st1.params @ st2.params } | From_days e -> fn "FROM_DAYS(" [e] ")" | From_unixtime e -> fn "FROM_UNIXTIME(" [e] ")" | Ifnull (e1, e2) -> let st1 = fn "IFNULL(" [e1] "" in let st2 = fn ~st:st1 (st1.repr ^ ", ") [e2] ")" in - Sequoia.{ st2 with params = st1.params @ st2.params } + { st2 with params = st1.params @ st2.params } | Last_day e -> fn "LAST_DAY(" [e] ")" | Length e -> fn "LENGTH(" [e] ")" | Localtime -> fn "LOCALTIME(" [] ")" diff --git a/ppx/dune b/ppx/dune new file mode 100644 index 0000000..1f3d681 --- /dev/null +++ b/ppx/dune @@ -0,0 +1,6 @@ +(library + (name sequoia_ppx) + (public_name sequoia-ppx) + (kind ppx_rewriter) + (libraries sequoia ppx_tools_versioned ocaml-migrate-parsetree) + (flags (:standard -w -9))) diff --git a/ppx/jbuild b/ppx/jbuild deleted file mode 100644 index 5048228..0000000 --- a/ppx/jbuild +++ /dev/null @@ -1,11 +0,0 @@ -(jbuild_version 1) - -(library - ((name sequoia_ppx) - (public_name sequoia-ppx) - (kind ppx_rewriter) - (libraries - (sequoia - ppx_tools_versioned - ocaml-compiler-libs - ocaml-migrate-parsetree)))) diff --git a/ppx/sequoia_ppx.ml b/ppx/sequoia_ppx.ml index e330c7f..14f8aaf 100644 --- a/ppx/sequoia_ppx.ml +++ b/ppx/sequoia_ppx.ml @@ -70,7 +70,7 @@ let rec map_expr_list loc f = function let e = map_expr_list pexp_loc f e in { expr with pexp_desc = Pexp_open (ovr, loc, e) } - | e -> + | _e -> error loc "unexpected element in select expression" let add_table t u ts = @@ -104,7 +104,7 @@ let rec map_query st loc = function (* from MyTable.table *) | { pexp_desc = Pexp_apply ({ pexp_desc = - Pexp_ident { txt = Lident "from"; loc } }, + Pexp_ident { txt = Lident "from" } }, [(_, { pexp_desc = Pexp_ident { txt = Ldot (Lident t, _) } })]) } as e -> st.tables := [t]; @@ -183,7 +183,7 @@ let rec map_query st loc = function (([ (Nolabel, { pexp_desc = Pexp_ident - { txt = Ldot (Lident tbl, fld) ; loc } }) + { txt = Ldot (Lident tbl, _fld) ; loc } }) ; _ ]) as args)) } as join_args))]) } as e when join_fun = "left_join" @@ -261,7 +261,7 @@ let rec map_query st loc = function Pexp_ident { txt = Lident fn; loc } } as fld), ([ (Nolabel, { pexp_desc = - Pexp_ident { txt = Ldot (Lident table, field) } }) + Pexp_ident { txt = Ldot (Lident table, _field) } }) ] as args)) } as e when fn = "field"|| fn = "foreign_key" -> let steps = build_steps (index loc table !(st.tables)) in @@ -283,7 +283,7 @@ let rec map_query st loc = function | e -> e -and map_select st loc = function +and map_select st _loc = function (* select [...; field|foreign_key|unwrap Table.field; ...] *) | { pexp_desc = Pexp_apply @@ -298,7 +298,7 @@ and map_select st loc = function (* select [...; subquery (from ...); ...] *) | { pexp_desc = Pexp_apply (({ pexp_desc = - Pexp_ident { txt = Lident "subquery"; loc } } as sub), + Pexp_ident { txt = Lident "subquery" } } as sub), [(lbl, expr)]) } as e -> let st' = { st with tables = ref [] } in @@ -321,7 +321,7 @@ and map_select st loc = function | e -> e -let rec map_module table references loc = function +let rec map_module table references _loc = function | [] -> () (* Field.foreign_key name ~references:Some.field *) diff --git a/sequoia-mysql.opam b/sequoia-mysql.opam index 7b6d648..cec4211 100644 --- a/sequoia-mysql.opam +++ b/sequoia-mysql.opam @@ -8,12 +8,12 @@ license: "MIT" dev-repo: "https://github.com/andrenth/sequoia" available: [ ocaml-version >= "4.04.0" ] build: [ - ["jbuilder" "subst" "-n" name] {pinned} - ["jbuilder" "build" "-p" name "-j" jobs] + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] ] -build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] +build-test: [["dune" "runtest" "-p" name "-j" jobs]] depends: [ - "jbuilder" {build} + "dune" {build & >= "1.0"} "base-unix" "sequoia" ] diff --git a/sequoia-postgresql.opam b/sequoia-postgresql.opam index 2c94539..fbbcafd 100644 --- a/sequoia-postgresql.opam +++ b/sequoia-postgresql.opam @@ -8,11 +8,11 @@ license: "MIT" dev-repo: "https://github.com/andrenth/sequoia" available: [ ocaml-version >= "4.04.0" ] build: [ - ["jbuilder" "build" "-p" name "-j" jobs] + ["dune" "build" "-p" name "-j" jobs] ] -build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] +build-test: [["dune" "runtest" "-p" name "-j" jobs]] depends: [ - "jbuilder" {build} + "dune" {build & >= "1.0"} "base-unix" "sequoia" ] diff --git a/sequoia-ppx.opam b/sequoia-ppx.opam index dece24c..8882503 100644 --- a/sequoia-ppx.opam +++ b/sequoia-ppx.opam @@ -8,11 +8,11 @@ license: "MIT" dev-repo: "https://github.com/andrenth/sequoia" available: [ ocaml-version >= "4.04.0" ] build: [ - ["jbuilder" "build" "-p" name "-j" jobs] + ["dune" "build" "-p" name "-j" jobs] ] -build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] +build-test: [["dune" "runtest" "-p" name "-j" jobs]] depends: [ - "jbuilder" {build} + "dune" {build & >= "1.0"} "sequoia" "ppx_tools_versioned" "ocaml-migrate-parsetree" diff --git a/sequoia-sqlite.opam b/sequoia-sqlite.opam index 61ab0d6..8f1d437 100644 --- a/sequoia-sqlite.opam +++ b/sequoia-sqlite.opam @@ -8,10 +8,10 @@ license: "MIT" dev-repo: "https://github.com/andrenth/sequoia" available: [ ocaml-version >= "4.04.0" ] build: [ - ["jbuilder" "subst" "-n" name] {pinned} + ["dune" "subst"] {pinned} ] -build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] +build-test: [["dune" "runtest" "-p" name "-j" jobs]] depends: [ - "jbuilder" {build} + "dune" {build & >= "1.0"} "sequoia" ] diff --git a/sequoia.opam b/sequoia.opam index c540f65..b20efca 100644 --- a/sequoia.opam +++ b/sequoia.opam @@ -8,9 +8,10 @@ license: "MIT" dev-repo: "https://github.com/andrenth/sequoia" available: [ ocaml-version >= "4.04.0" ] build: [ - ["jbuilder" "build" "-p" name "-j" jobs] + ["dune" "build" "-p" name "-j" jobs] ] -build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] +build-test: [["dune" "runtest" "-p" name "-j" jobs]] depends: [ - "jbuilder" {build} + "dune" {build & >= "1.0"} + "cppo" {build} ] diff --git a/sqlite/dune b/sqlite/dune new file mode 100644 index 0000000..a3e94d2 --- /dev/null +++ b/sqlite/dune @@ -0,0 +1,4 @@ +(library + (name sequoia_sqlite) + (public_name sequoia-sqlite) + (libraries sequoia)) diff --git a/sqlite/jbuild b/sqlite/jbuild deleted file mode 100644 index de54a37..0000000 --- a/sqlite/jbuild +++ /dev/null @@ -1,6 +0,0 @@ -(jbuild_version 1) - -(library - ((name sequoia_sqlite) - (public_name sequoia-sqlite) - (libraries (sequoia)))) diff --git a/sqlite/sqlite.ml b/sqlite/sqlite.ml index 29805bc..395b6a1 100644 --- a/sqlite/sqlite.ml +++ b/sqlite/sqlite.ml @@ -62,8 +62,8 @@ module Expr = struct | Sum : int t -> int t | Total : int t -> int t - let avg f = fun src -> Avg (f src) - let changes () = fun src -> Changes + (* let avg f = fun src -> Avg (f src) *) + let changes () = fun _src -> Changes let char f = fun src -> Char (f src) let coalesce f = fun src -> Coalesce (f src) let glob pat f = fun src -> Glob (pat, f src) @@ -78,7 +78,7 @@ module Expr = struct let max f = fun src -> Max (f src) let min f = fun src -> Min (f src) let nullif f g = fun src -> Nullif (f src, g src) - let random () = fun src -> Random + let random () = fun _src -> Random let randomblob f = fun src -> Randomblob (f src) let replace f s1 s2 = fun src -> Replace (f src, s1, s2) let round f ?digits = fun src -> Round (f src, digits) @@ -102,7 +102,7 @@ module Expr = struct let sum f = fun src -> Sum (f src) let total f = fun src -> Total (f src) - let rec build + let build : type a. handover:handover -> build_step -> a t -> build_step = fun ~handover st e -> let fn ?(st = st) = diff --git a/src/dune b/src/dune new file mode 100644 index 0000000..a4cb937 --- /dev/null +++ b/src/dune @@ -0,0 +1,4 @@ +(library + (name sequoia) + (public_name sequoia) + (flags (:standard -w -50))) diff --git a/src/jbuild b/src/jbuild deleted file mode 100644 index 5f479cf..0000000 --- a/src/jbuild +++ /dev/null @@ -1,5 +0,0 @@ -(jbuild_version 1) - -(library - ((name sequoia) - (public_name sequoia))) diff --git a/src/query_common.ml b/src/query_common.ml index c5bfc5a..1d18e5f 100644 --- a/src/query_common.ml +++ b/src/query_common.ml @@ -42,7 +42,7 @@ module UpdateDeleteExpr = struct let field fld = fun table -> Field (fld, table) let foreign_key fk = fun table -> Foreign (fk, table) - let rec build + let build : type a. placeholder:(int -> string) -> handover:Expr.handover -> build_step @@ -92,7 +92,6 @@ module InsertReplace = struct | f::fs -> Field.name f ^ ", " ^ join_fields fs let expr_placeholders ~placeholder i vs = - let open Lit in let rec eps : type t a n. int -> (t, a, n) Lit.Vector.t -> string list = fun i exprs -> diff --git a/src/select.ml b/src/select.ml index 075c5db..a55f81f 100644 --- a/src/select.ml +++ b/src/select.ml @@ -224,10 +224,10 @@ module Make (D : Driver.S) : S = struct type 'a t = 'a Expr.t let (-->) expr alias = fun src -> As (expr src, alias) - let alias name = fun src -> Alias name + let alias name = fun _src -> Alias name let field fld steps = fun src -> Field (fld, src, steps) let foreign_key fk steps = fun src -> Foreign (fk, src, steps) - let subquery sel = fun src -> Select sel + let subquery sel = fun _src -> Select sel (* XXX is there a better name for this? *) let unwrap diff --git a/src/sequoia.ml b/src/sequoia.ml index fef89aa..466c4eb 100644 --- a/src/sequoia.ml +++ b/src/sequoia.ml @@ -1,6 +1,3 @@ -open Printf -open Common - module type NAMED = sig type t val name : string diff --git a/src/update.ml b/src/update.ml index 45c6a86..dd8677b 100644 --- a/src/update.ml +++ b/src/update.ml @@ -98,7 +98,7 @@ module Make (D : Driver.S) : S = struct type ('t, 'a) elem = ('t, 'a) mk end) - let rec vectormk_to_vector + (* let rec vectormk_to_vector : type a n. 't Table.t -> ('t, a, n) Vector.t -> ('t, a, n) Vec.t = @@ -110,7 +110,7 @@ module Make (D : Driver.S) : S = struct [] | f::rest -> let open Vec in - (f table) :: vectormk_to_vector table rest + (f table) :: vectormk_to_vector table rest *) end module UpdateVec = Vector.Make(struct @@ -167,7 +167,7 @@ module Make (D : Driver.S) : S = struct let vec = OrderBy.vectormk_to_vector stmt.table bl in U { stmt with order_by = Some vec } - let build_updates ~handover st table updates = + let build_updates ~handover st _table updates = let fold : type t a b. build_step * int -> (t, a) Field.t * (b, a) Expr.expr diff --git a/src/vector.ml b/src/vector.ml index 3dba920..926a9f4 100644 --- a/src/vector.ml +++ b/src/vector.ml @@ -46,7 +46,7 @@ struct | (::) : ('a, 'b, 'n) t * ('a, 'b, 'm, 'n) matrix -> ('a, 'b, 'm Nat.s, 'n) matrix - type 'z matrix_folder = { mf : 'a 'b. 'z -> ('a, 'b) E.elem -> 'z } + (* type 'z matrix_folder = { mf : 'a 'b. 'z -> ('a, 'b) E.elem -> 'z } *) let rec matrix_fold_left : type a b m n. 'z folder -> 'z -> (a, b, m, n) matrix -> 'z = diff --git a/test/dune b/test/dune new file mode 100644 index 0000000..3652bbd --- /dev/null +++ b/test/dune @@ -0,0 +1,9 @@ +(alias + (name runtest) + (deps t.exe)) + +(executable + (name t) + (libraries sequoia sequoia-mysql) + (preprocess + (pps sequoia-ppx))) diff --git a/test/jbuild b/test/jbuild deleted file mode 100644 index 08e5a00..0000000 --- a/test/jbuild +++ /dev/null @@ -1,12 +0,0 @@ -(jbuild_version 1) - -(alias - ((name runtest) - (deps (t.exe)))) - -(executable - ((name t) - (libraries - (sequoia - sequoia-mysql)) - (preprocess (pps (sequoia-ppx))))) diff --git a/test/ppx/dune b/test/ppx/dune new file mode 100644 index 0000000..39f8a8d --- /dev/null +++ b/test/ppx/dune @@ -0,0 +1,20 @@ +(alias + (name runtest) + (deps t.exe)) + +(rule + (targets t.ml) + (deps + (:< t.cppo.ml) + (glob_files tables/*.ml) + (glob_files queries/*.ml)) + (action + (chdir + %{workspace_root} + (run %{bin:cppo} -V OCAML:%{ocaml_version} %{<} -o %{targets})))) + +(executable + (name t) + (libraries sequoia sequoia-mysql sequoia-ppx) + (preprocess + (pps sequoia-ppx))) diff --git a/test/ppx/jbuild b/test/ppx/jbuild deleted file mode 100644 index c876b6b..0000000 --- a/test/ppx/jbuild +++ /dev/null @@ -1,22 +0,0 @@ -(jbuild_version 1) - -(alias - ((name runtest) - (deps (t.exe)))) - -(rule - ((targets (t.ml)) - (deps - (t.cppo.ml - (glob_files tables/*.ml) - (glob_files queries/*.ml))) - (action - (chdir ${ROOT} (run ${bin:cppo} -V OCAML:${ocaml_version} ${<} -o ${@}))))) - -(executable - ((name t) - (libraries - (sequoia - sequoia-mysql - sequoia-ppx)) - (preprocess (pps (sequoia-ppx))))) diff --git a/test/ppx/queries/q8.ml b/test/ppx/queries/q8.ml index b7056cc..0a11596 100644 --- a/test/ppx/queries/q8.ml +++ b/test/ppx/queries/q8.ml @@ -1,6 +1,6 @@ let q8 = let query, params = - Mysql.(Expr.(Update.(Vector.(Expr.(Vector.(OrderBy.Expr.(Vector.( + Mysql.(Expr.(Update.(Vector.(Expr.(OrderBy.Expr.(Vector.( update User.table ~set: [ User.name, string "John Doe" @@ -10,5 +10,5 @@ let q8 = |> order_by [desc (field User.name)] |> limit 10 |> seal - )))))))) in + ))))))) in query, params diff --git a/test/ppx/readme/dune b/test/ppx/readme/dune new file mode 100644 index 0000000..44fcac0 --- /dev/null +++ b/test/ppx/readme/dune @@ -0,0 +1,9 @@ +(alias + (name runtest) + (deps readme.exe)) + +(executable + (name readme) + (libraries sequoia sequoia-mysql sequoia-ppx) + (preprocess + (pps sequoia-ppx))) diff --git a/test/ppx/readme/jbuild b/test/ppx/readme/jbuild deleted file mode 100644 index 634d225..0000000 --- a/test/ppx/readme/jbuild +++ /dev/null @@ -1,13 +0,0 @@ -(jbuild_version 1) - -(alias - ((name runtest) - (deps (readme.exe)))) - -(executable - ((name readme) - (libraries - (sequoia - sequoia-mysql - sequoia-ppx)) - (preprocess (pps (sequoia-ppx))))) diff --git a/test/ppx/t.cppo.ml b/test/ppx/t.cppo.ml index 229ba33..e6baf92 100644 --- a/test/ppx/t.cppo.ml +++ b/test/ppx/t.cppo.ml @@ -8,12 +8,12 @@ module Bool = struct let instance = function | True -> (module struct - type t = True + type nonrec t = t let to_string = "TRUE" end : Mysql.Enum.Instance) | False -> (module struct - type t = False + type nonrec t = t let to_string = "FALSE" end : Mysql.Enum.Instance) end