WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] Remove redundant code from Db_action_helper

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Remove redundant code from Db_action_helper
From: Jonathan Davies <jonathan.davies@xxxxxxxxxx>
Date: Tue, 9 Mar 2010 16:05:56 +0000
Delivery-date: Tue, 09 Mar 2010 08:14:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jonathan Davies <jonathan.davies@xxxxxxxxxx>
# Date 1268150522 0
# Node ID ee00783cffb3f9523a1bc12695229d3bd1a84f14
# Parent  5181c070835e08622edd6d663db8fe4ad97544ae
Remove some redundant code from the Db_action_helper module and simplify the 
usage of this module in the auto-generated code.

Signed-off-by: Jonathan Davies <jonathan.davies@xxxxxxxxxx>

diff -r 5181c070835e -r ee00783cffb3 ocaml/database/db_action_helper.ml
--- a/ocaml/database/db_action_helper.ml        Tue Mar 09 16:02:01 2010 +0000
+++ b/ocaml/database/db_action_helper.ml        Tue Mar 09 16:02:02 2010 +0000
@@ -11,20 +11,12 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Lesser General Public License for more details.
  *)
-(** Helper functions called from the generated Db_action code. *)
-
-exception Cannot_read_schema_version
 
 (** Table column name which contains the reference *)
 let reference = Escaping.reference
 
 (** Table column name which contains the uuid *)
 let uuid = "uuid"
-
-open Threadext
-
-module D = Debug.Debugger(struct let name = "sql" end)
-open D
 
 (* General DB utils *)
 
@@ -37,18 +29,6 @@
     | None -> ()
     | Some f -> f ?snapshot ty op ref
          
-(* Return query used by update *)
-let update_query tbl fldvalue fld objref =
-  let sql = Printf.sprintf "UPDATE %s SET %s=? WHERE %s=?;" tbl fld reference 
in
-  let params = [fldvalue; objref ] in
-    (sql,params)
-      
-(* Return query used by delete *)
-let deleterow_query tbl objref =
-  let sql = Printf.sprintf "DELETE FROM %s WHERE %s=?;" tbl reference in
-  let params = [ objref ] in
-    (sql,params)
-      
 exception Db_set_or_map_parse_fail of string
   
 let parse_sexpr s : SExpr.t list =
diff -r 5181c070835e -r ee00783cffb3 ocaml/idl/ocaml_backend/gen_db_actions.ml
--- a/ocaml/idl/ocaml_backend/gen_db_actions.ml Tue Mar 09 16:02:01 2010 +0000
+++ b/ocaml/idl/ocaml_backend/gen_db_actions.ml Tue Mar 09 16:02:02 2010 +0000
@@ -166,7 +166,7 @@
 let read_set_ref obj other full_name =
   (* Set(Ref t) is actually stored in the table t *)
   let obj', fld' = look_up_related_table_and_field obj other full_name in
-  Printf.sprintf "ignore (read_field __context \"%s\" \"%s\" %s); List.map 
%s.%s (read_set_ref {table=\"%s\"; return=reference; where_field=\"%s\"; 
where_value=%s})"
+  Printf.sprintf "ignore (read_field __context \"%s\" \"%s\" %s); List.map 
%s.%s (read_set_ref {table=\"%s\"; return=Db_action_helper.reference; 
where_field=\"%s\"; where_value=%s})"
     (Escaping.escape_obj obj.DT.name) "uuid" Client._self
     _string_to_dm (OU.alias_of_ty (DT.Ref other))
     (Escaping.escape_obj obj') fld' Client._self
@@ -449,7 +449,6 @@
   O.Module.make
     ~name:_db_action
     ~preamble:[ 
-               "open Db_action_helper";
                 "open Db_cache.DBCache";
                 "open Db_cache_types";
                "module D=Debug.Debugger(struct let name=\"db\" end)";

Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Remove redundant code from Db_action_helper, Jonathan Davies <=