From: Claudio Sacerdoti Coen Date: Mon, 8 Mar 2004 23:16:50 +0000 (+0000) Subject: - reindented X-Git-Tag: v0_0_4~32 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=8e0cc60ace0568fef849d0a689ab222010c17e33;p=helm.git - reindented - "count (" is not valid SQL (at least for MySql). Replaced with "count(" - binary removed. Tables are now binary by default. The advantage is that in this way indexes do work. --- diff --git a/helm/ocaml/mathql_interpreter/mQIMySql.ml b/helm/ocaml/mathql_interpreter/mQIMySql.ml index af50af8ff..59d1ccf97 100644 --- a/helm/ocaml/mathql_interpreter/mQIMySql.ml +++ b/helm/ocaml/mathql_interpreter/mQIMySql.ml @@ -60,9 +60,9 @@ let exec c table cols ct cfl = if col <> "" then let f s = col ^ " regexp " ^ quote ("^" ^ s ^ "$") in if pat then "(" ^ iter f " or " v ^ ")" - else match v with - | [s] -> "binary " ^ col ^ " = " ^ (quote s) - | v -> "binary " ^ col ^ " in (" ^ pg_msval v ^ ")" + else match v with + | [s] -> col ^ " = " ^ (quote s) + | v -> col ^ " in (" ^ pg_msval v ^ ")" else "1" in let pg_cons l = iter pg_con " and " l in @@ -75,10 +75,10 @@ let exec c table cols ct cfl = | lt, llf -> " where " ^ pg_cons lt ^ " and " ^ pg_cons_not_l llf in if cols = [] then - let r, q = exec c ("select count (source) from " ^ table ^ pg_where) in + let r, q = exec c ("select count(source) from " ^ table ^ pg_where) in match r with | [[s]] when int_of_string s > 0 -> [[]], q - | _ -> [], q + | _ -> [], q else exec c ("select " ^ pg_cols ^ " from " ^ table ^ pg_where ^ " order by " ^ List.hd cols ^ " asc") diff --git a/helm/ocaml/mathql_interpreter/mQIPostgres.ml b/helm/ocaml/mathql_interpreter/mQIPostgres.ml index cf82814e9..f983a5862 100644 --- a/helm/ocaml/mathql_interpreter/mQIPostgres.ml +++ b/helm/ocaml/mathql_interpreter/mQIPostgres.ml @@ -59,9 +59,9 @@ let exec c table cols ct cfl = if col <> "" then let f s = col ^ " ~ " ^ quote ("^" ^ s ^ "$") in if pat then "(" ^ iter f " or " v ^ ")" - else match v with - | [s] -> col ^ " = " ^ (quote s) - | v -> col ^ " in (" ^ pg_msval v ^ ")" + else match v with + | [s] -> col ^ " = " ^ (quote s) + | v -> col ^ " in (" ^ pg_msval v ^ ")" else "true" in let pg_cons l = iter pg_con " and " l in @@ -74,10 +74,10 @@ let exec c table cols ct cfl = | lt, llf -> " where " ^ pg_cons lt ^ " and " ^ pg_cons_not_l llf in if cols = [] then - let r, q = exec c ("select count (source) from " ^ table ^ pg_where) in + let r, q = exec c ("select count(source) from " ^ table ^ pg_where) in match r with | [[s]] when int_of_string s > 0 -> [[]], q - | _ -> [], q + | _ -> [], q else exec c ("select " ^ pg_cols ^ " from " ^ table ^ pg_where ^ " order by " ^ List.hd cols ^ " asc")