import mtweb.0.4.1
[mtweb] / web / app / data / mw_sgbd.php
1 <?php
2
3   class mw_sgbd
4   {
5     var $sgbd_impl;
6     var $env;
7
8     function mw_sgbd($sgbd_impl, $env)
9     { $this->sgbd_impl = $sgbd_impl;
10       $this->env = $env;
11     }
12
13     function extention_ok() { return $this->sgbd_impl->extention_ok($this->env); }
14
15     function connect($host, $base, $user, $password)
16     { return $this->sgbd_impl->connect($host, $base, $user, $password);
17     }
18
19     function select_db($db_name)
20     { return $this->sgbd_impl->select_db($db_name);
21     }
22
23     # ---------------------------------------------------------------------------------
24     #                                                                               SQL
25     #
26
27     function table_exists($table_name)
28     { return $this->sgbd_impl->table_exists
29       ( ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
30           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name)
31         : $table_name
32       );
33     }
34
35     function query($sql)
36     { return $this->sgbd_impl->query
37       ( ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
38           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $sql)
39         : $sql
40       );
41     }
42
43     function insert_id()
44     { return $this->sgbd_impl->insert_id();
45     }
46
47     function fetch_assoc($rst)
48     { return $this->sgbd_impl->fetch_assoc($rst);
49     }
50
51     function free_result($rst)
52     { return $this->sgbd_impl->free_result($rst);
53     }
54
55     function close()
56     { return $this->sgbd_impl->close();
57     }
58
59     # ---------------------------------------------------------------------------------
60     #                                                                               XML
61     #
62
63     function data_exists($data_path)
64     { return $this->sgbd_impl->data_exists($data_path);
65     }
66
67     function create_data($data_path)
68     { return $this->sgbd_impl->create_data($data_path);
69     }
70
71     function get_data($data_path, $data_id)
72     { return $this->sgbd_impl->get_data($data_path, $data_id);
73     }
74
75     function open_data($data_path, $FETCH = true)
76     { return $this->sgbd_impl->open_data($data_path, $FETCH);
77     }
78
79     function fetch_data($dh)
80     { return $this->sgbd_impl->fetch_data($dh);
81     }
82
83     function add_data($data_path, $data)
84     { return $this->sgbd_impl->add_data($data_path, $data);
85     }
86
87     function last_index($dh)
88     { return $this->sgbd_impl->last_index($dh);
89     }
90
91     function set_data($data_path, $data_id, $data)
92     { return $this->sgbd_impl->set_data($data_path, $data_id, $data);
93     }
94
95     function del_data($data_path, $data_id)
96     { return $this->sgbd_impl->del_data($data_path, $data_id);
97     }
98
99     function close_data($dh)
100     { return $this->sgbd_impl->close_data($dh);
101     }
102
103     function remove_data($data_path)
104     { return $this->sgbd_impl->remove_data($data_path);
105     }
106
107   }
108
109 ?>