File tree Expand file tree Collapse file tree 4 files changed +4
-4
lines changed
Expand file tree Collapse file tree 4 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -548,7 +548,7 @@ module Source_type = struct
548548end
549549
550550type 't param = { id : param_id ; typ : 't ; } [@@ deriving show , make ]
551- type option_actions_kind = BoolChoices | SetDefault [@@ deriving show ]
551+ type option_actions_kind = BoolChoices | SetDefault | SetSelf of string [@@ deriving show ]
552552type params = Type .t param list [@@ deriving show ]
553553type in_or_not_in = [`In | `NotIn ] [@@ deriving show ]
554554type ctor =
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ let resolve_column_assignments ~env l =
257257 let l_with_meta = List. map (fun (n ,e ) -> n, Option. map (set_param_meta ~env col) e) l in
258258 Choices (n, List. map (fun (n ,e ) -> n, Option. map (equality typ) e) l_with_meta)
259259 | RegularExpr (OptionActions ch ) ->
260- OptionActions { ch with choice = (equality typ) ch.choice } (* FIXME hack, should propagate properly *)
260+ OptionActions { ch with choice = (equality typ) ch.choice; kind = SetSelf col.cname }
261261 | RegularExpr expr -> equality typ (set_param_meta ~env col expr)
262262 | WithDefaultParam (e , pos ) -> with_default @@ OptionActions { choice = equality typ (set_param_meta ~env col e); pos; kind = SetDefault }
263263 | AssignDefault -> with_default @@ (Value typ)
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ let substitute_vars s vars subst_param =
156156 let args = Some (vars) in
157157 {ctor; args; sql; is_poly= false } in
158158 let n =
159- let sql = Static (match kind with | BoolChoices -> " TRUE " | SetDefault -> " DEFAULT " ) in
159+ let sql = Static (match kind with | BoolChoices -> " TRUE " | SetDefault -> " DEFAULT " | SetSelf col -> " " ^ col ^ " " ) in
160160 let ctor = Sql. { value= Some (" None" ); pos= (0 , 0 ); } in
161161 let args = None in
162162 {ctor; args; sql= [sql]; is_poly= false } in
Original file line number Diff line number Diff line change @@ -3468,6 +3468,6 @@ optional parameter in UPDATE:
34683468 T. set_param_Int p id;
34693469 T. finish_params p
34703470 in
3471- T. execute db (" UPDATE products SET stock = " ^ (match stock with Some _ -> " ( " ^ " " ^ " ?" ^ " " ^ " ) " | None -> " TRUE " ) ^ " WHERE id = ?" ) set_params
3471+ T. execute db (" UPDATE products SET stock = " ^ (match stock with Some _ -> " ( " ^ " " ^ " ?" ^ " " ^ " ) " | None -> " stock " ) ^ " WHERE id = ?" ) set_params
34723472
34733473 end (* module Sqlgg * )
You can’t perform that action at this time.
0 commit comments