modifications template et tinyMce dans libs
[mtweb] / mw / 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(){
14       return $this->sgbd_impl->extention_ok($this->env);
15     }
16
17     function connect($host, $base, $user, $password){
18       return $this->sgbd_impl->connect($host, $base, $user, $password);
19     }
20
21     function select_db($db_name){
22       return $this->sgbd_impl->select_db($db_name);
23     }
24
25     # ---------------------------------------------------------------------------------
26     #                                                                               SQL
27     #
28
29     function desc_table($table_name){
30       if(!method_exists($this->sgbd_impl, "desc_table")) return false;
31       return $this->sgbd_impl->desc_table(
32         ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
33           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name)
34         : $table_name
35       );
36     }
37
38     function table_exists($table_name){
39       if(!method_exists($this->sgbd_impl, "table_exists")) return false;
40       return $this->sgbd_impl->table_exists(
41         ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
42           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name)
43         : $table_name
44       );
45     }
46
47     function field_exists($table_name, $field_name){
48       if(!method_exists($this->sgbd_impl, "field_exists")) return false;
49       return $this->sgbd_impl->field_exists(
50         (
51           $prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
52           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name)
53         : $table_name,
54         $field_name
55       );
56     }
57
58     function query($sql){
59       if(!method_exists($this->sgbd_impl, "query")) return false;
60       return $this->sgbd_impl->query(
61         ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ?
62           str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $sql)
63         : $sql
64       );
65     }
66
67     function insert_id(){
68       if(!method_exists($this->sgbd_impl, "insert_id")) return false;
69       return $this->sgbd_impl->insert_id();
70     }
71
72     function fetch_assoc($rst){
73       if(!method_exists($this->sgbd_impl, "fetch_assoc")) return false;
74       return $this->sgbd_impl->fetch_assoc($rst);
75     }
76
77     function free_result($rst){
78       if(!method_exists($this->sgbd_impl, "")) return false;
79       return $this->sgbd_impl->free_result($rst);
80     }
81
82     function close(){
83       if(!method_exists($this->sgbd_impl, "")) return false;
84       return $this->sgbd_impl->close();
85     }
86
87     # ---------------------------------------------------------------------------------
88     #                                                                               XML
89     #
90
91     function data_exists($data_path){
92       if(!method_exists($this->sgbd_impl, "data_exists")) return false;
93       return $this->sgbd_impl->data_exists($data_path);
94     }
95
96     function create_data($data_path){
97       if(!method_exists($this->sgbd_impl, "create_data")) return false;
98       return $this->sgbd_impl->create_data($data_path);
99     }
100
101     function get_data($data_path, $data_id){
102       if(!method_exists($this->sgbd_impl, "get_data")) return false;
103       return $this->sgbd_impl->get_data($data_path, $data_id);
104     }
105
106     function open_data($data_path, $FETCH = true){
107       if(!method_exists($this->sgbd_impl, "open_data")) return false;
108       return $this->sgbd_impl->open_data($data_path, $FETCH);
109     }
110
111     function fetch_data($dh){
112       if(!method_exists($this->sgbd_impl, "fetch_data")) return false;
113       return $this->sgbd_impl->fetch_data($dh);
114     }
115
116     function add_data($data_path, $data){
117       if(!method_exists($this->sgbd_impl, "add_data")) return false;
118       return $this->sgbd_impl->add_data($data_path, $data);
119     }
120
121     function last_index($dh){
122       if(!method_exists($this->sgbd_impl, "last_index")) return false;
123       return $this->sgbd_impl->last_index($dh);
124     }
125
126     function set_data($data_path, $data_id, $data){
127       if(!method_exists($this->sgbd_impl, "set_data")) return false;
128       return $this->sgbd_impl->set_data($data_path, $data_id, $data);
129     }
130
131     function del_data($data_path, $data_id){
132       if(!method_exists($this->sgbd_impl, "del_data")) return false;
133       return $this->sgbd_impl->del_data($data_path, $data_id);
134     }
135
136     function close_data($dh){
137       if(!method_exists($this->sgbd_impl, "close_data")) return false;
138       return $this->sgbd_impl->close_data($dh);
139     }
140
141     function remove_data($data_path){
142       if(!method_exists($this->sgbd_impl, "remove_data")) return false;
143       return $this->sgbd_impl->remove_data($data_path);
144     }
145
146   }
147
148 ?>