In mail.php, we don't want to double encode fields so in send() create local variable...
[isso.git] / db_mysqli.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * MySQLi Database Abstraction Layer
24 * db_mysqli.php
25 *
26 * @package ISSO
27 */
28
29 $this->load('db', null);
30
31 /**
32 * MySQLi Database Abstraction Layer
33 *
34 * This framework is a function wrapper for MySQLi functions so we can have
35 * better error reporting and query reporting.
36 *
37 * @author Blue Static
38 * @copyright Copyright ©2002 - [#]year[#], Blue Static
39 * @version $Revision$
40 * @package ISSO
41 *
42 */
43 class DB_MySQLi extends DB_Abstract
44 {
45 /**
46 * Command mapping list
47 * @var array
48 * @access private
49 */
50 var $commands = array(
51 'pconnect' => '$this->command_mysqli_connect',
52 'connect' => '$this->command_mysqli_connect',
53 'query' => 'mysqli_query',
54 'error_num' => 'mysqli_errno',
55 'error_str' => 'mysqli_error',
56 'escape_string' => 'mysqli_real_escape_string',
57 'escape_binary' => 'mysqli_real_escape_string',
58 'unescape_binary' => '$this->command_unescape_binary',
59 'fetch_assoc' => 'mysqli_fetch_assoc',
60 'fetch_row' => 'mysqli_fetch_row',
61 'fetch_object' => 'mysqli_fetch_object',
62 'free_result' => 'mysqli_free_result',
63 'insert_id' => 'mysqli_insert_id',
64 'num_rows' => 'mysqli_num_rows',
65 'affected_rows' => 'mysqli_affected_rows'
66 );
67
68 // ###################################################################
69 /**
70 * Constructor
71 */
72 function __construct(&$registry)
73 {
74 parent::__construct($registry);
75 }
76
77 // ###################################################################
78 /**
79 * (PHP 4) Constructor
80 */
81 function DB_MySQLi(&$registry)
82 {
83 $this->__construct($registry);
84 }
85
86 // ###################################################################
87 /**
88 * Wrapper: mysqli_connect
89 *
90 * @access protected
91 *
92 * @param string Server name
93 * @param string User name
94 * @param string Password
95 * @param string Database
96 *
97 * @return integer DB-Link
98 */
99 function command_mysqli_connect($server, $user, $password, $database)
100 {
101 return mysqli_connect($server, $user, $password, $database);
102 }
103
104 // ###################################################################
105 /**
106 * Not supported: unescape binary string
107 *
108 * @access protected
109 *
110 * @param string Escaped data
111 *
112 * @return string Same data
113 */
114 function command_unescape_binary($string)
115 {
116 return $string;
117 }
118
119 // ###################################################################
120 /**
121 * Starts a database transaction
122 *
123 * @access public
124 */
125 function transaction_start()
126 {
127 $this->query("START TRANSACTION");
128 }
129
130 // ###################################################################
131 /**
132 * Saves current transaction steps as a savepoint
133 *
134 * @access public
135 *
136 * @param string Named savepoint
137 */
138 function transaction_savepoint($name)
139 {
140 $this->query("SAVEPOINT $name");
141 }
142
143 // ###################################################################
144 /**
145 * Reverts a transaction back to a given savepoint
146 *
147 * @access public
148 *
149 * @param string Named savepoint
150 */
151 function transaction_rollback($name = null)
152 {
153 $this->query("ROLLBACK" . ($name != null ? " TO SAVEPOINT $name" : ""));
154 }
155
156 // ###################################################################
157 /**
158 * Commits a database transaction
159 *
160 * @access public
161 */
162 function transaction_commit()
163 {
164 $this->query("COMMIT");
165 }
166 }
167
168 /*=====================================================================*\
169 || ###################################################################
170 || # $HeadURL$
171 || # $Id$
172 || ###################################################################
173 \*=====================================================================*/
174 ?>