3 class mw_data_auto_crud extends mw_data{
5 function call_data_auto_crud($method_name, $arguments){
10 (substr($method_name, 0, 5) == "desc_")
11 && ($table_name = substr($method_name, 5))
12 && ($sgbd->table_exists("#--".$table_name))
14 $r = $this->data_desc(
16 "table_name" => $table_name
20 // add_<table_name>(array $values)
22 (substr($method_name, 0, 4) == "add_")
23 && ($table_name = substr($method_name, 4))
24 && ($sgbd->table_exists("#--".$table_name))
26 $r = $this->data_insert(
28 "table_name" => $table_name,
29 "values" => $arguments[0]
33 // get_<table_name>(string $index_name, string $index_value)
35 (substr($method_name, 0, 4) == "get_")
36 && ($table_name = substr($method_name, 4))
37 && ($sgbd->table_exists("#--".$table_name))
39 $r = $this->data_read(
41 "table_name" => $table_name,
42 "index_name" => $arguments[0],
43 "index_value" => $arguments[1]
47 // list_<table_name>(array $params)
49 (substr($method_name, 0, 5) == "list_")
50 && ($table_name = substr($method_name, 5))
51 && ($sgbd->table_exists("#--".$table_name))
53 $params = $arguments[0];
54 $params["table_name"] = $table_name;
55 $r = $this->data_list($params);
57 // set_<table_name>(string index_name, string index_value, array $values)
59 (substr($method_name, 0, 4) == "set_")
60 && ($table_name = substr($method_name, 4))
61 && ($sgbd->table_exists("#--".$table_name))
63 $r = $this->data_update(
65 "table_name" => $table_name,
66 "index_name" => $arguments[0],
67 "index_value" => $arguments[1],
68 "values" => $arguments[2]
72 // del_<table_name>(string $index_name, string $index_value)
74 (substr($method_name, 0, 4) == "del_")
75 && ($table_name = substr($method_name, 4))
76 && ($sgbd->table_exists("#--".$table_name))
78 $r = $this->data_delete(
80 "table_name" => $table_name,
81 "index_name" => $arguments[0],
82 "index_value" => $arguments[1]