Commits

Dmitry Grebeniuk  committed ededd98

amall.dbi fixes: exception -> `Error

  • Participants
  • Parent commits 4d5e3d6

Comments (0)

Files changed (1)

File src/dbi/dbi_pg.ml

     ;
 
     (* _p = positional bindings *)
-    method execute_p sql params = self#with_con & fun pcon ->
-      let (string_params, binary_params) =
-        convert_in_params params in
-      make_result (pcon#exec
-        ~params:string_params ~binary_params sql)
+    method execute_p sql params =
+      try
+        self#with_con & fun pcon ->
+          let (string_params, binary_params) =
+            convert_in_params params in
+          make_result (pcon#exec
+            ~params:string_params ~binary_params sql)
+      with [ e -> `Error e ]
     ;
 
     (* no bindings, typed results *)
-    method execute sql = self#with_con & fun pcon ->
-      make_result (pcon#exec sql)
+    method execute sql =
+      try
+        self#with_con & fun pcon ->
+          make_result (pcon#exec sql)
+      with [ e -> `Error e ]
     ;
 
     method start () = cmd_ok & self#execute "start transaction";
 *)
 
     method execute () =
-      ( (meth_with_con : (P.connection -> 'q) -> 'q) & fun pcon ->
+      try
+        (meth_with_con : (P.connection -> 'q) -> 'q) & fun pcon ->
            make_result (pcon#exec_prepared stm_name)
-      )
+      with [ e -> `Error e ]
     ;
 
     (* execute prepared statement with "_p"ositional parameters *)
     method execute_p params =
-      ( meth_with_con & fun pcon ->
+      try
+        meth_with_con & fun pcon ->
           let (string_params, binary_params) =
             convert_in_params params in
           make_result (pcon#exec_prepared
             ~params:string_params ~binary_params stm_name)
-      )
+      with [ e -> `Error e ]
     ;
 
     (* will be implemented as "cleaning prepared statement"