From: dj3c1t Date: Tue, 29 Oct 2013 19:10:47 +0000 (+0100) Subject: auto crud pour XML X-Git-Tag: mtweb.0.11.1 X-Git-Url: http://git.dj3c1t.com/index.cgi?a=commitdiff_plain;h=622eff0b10a740f80efe9f35b58373a9eab54dfe;p=mtweb auto crud pour XML --- diff --git a/mw/app/data/modules/share/mw_data_auto_crud.php b/mw/app/data/modules/share/mw_data_auto_crud.php index 59a7cc0..2e72ebc 100644 --- a/mw/app/data/modules/share/mw_data_auto_crud.php +++ b/mw/app/data/modules/share/mw_data_auto_crud.php @@ -5,11 +5,16 @@ function call_data_auto_crud($method_name, $arguments){ $r = false; $sgbd = $this->sgbd(); + + $env = $this->env(); + $IS_XML = $env->bdd("sgbd") == "xml"; + $table_exists_function = $IS_XML ? "data_exists" : "table_exists"; + // desc_() if( (substr($method_name, 0, 5) == "desc_") && ($table_name = substr($method_name, 5)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $r = $this->data_desc( array( @@ -21,7 +26,7 @@ if( (substr($method_name, 0, 4) == "add_") && ($table_name = substr($method_name, 4)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $r = $this->data_insert( array( @@ -34,7 +39,7 @@ elseif( (substr($method_name, 0, 4) == "get_") && ($table_name = substr($method_name, 4)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $r = $this->data_read( array( @@ -48,7 +53,7 @@ elseif( (substr($method_name, 0, 5) == "list_") && ($table_name = substr($method_name, 5)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $params = $arguments[0]; $params["table_name"] = $table_name; @@ -58,7 +63,7 @@ elseif( (substr($method_name, 0, 4) == "set_") && ($table_name = substr($method_name, 4)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $r = $this->data_update( array( @@ -73,7 +78,7 @@ elseif( (substr($method_name, 0, 4) == "del_") && ($table_name = substr($method_name, 4)) - && ($sgbd->table_exists("#--".$table_name)) + && ($sgbd->$table_exists_function(($IS_XML ? "" : "#--").$table_name)) ){ $r = $this->data_delete( array(