]>
src.bluestatic.org Git - isso.git/blob - db_mysqli.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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.
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
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 \*=====================================================================*/
23 * MySQLi Database Abstraction Layer
29 $this->load('db', null);
32 * MySQLi Database Abstraction Layer
34 * This framework is a function wrapper for MySQLi functions so we can have
35 * better error reporting and query reporting.
38 * @copyright Copyright ©2002 - [#]year[#], Blue Static
43 class DB_MySQLi
extends DB_Abstract
46 * Command mapping list
49 private $commands = array(
50 'pconnect' => '$this->command_mysqli_connect',
51 'connect' => '$this->command_mysqli_connect',
52 'query' => 'mysqli_query',
53 'error_num' => 'mysqli_errno',
54 'error_str' => 'mysqli_error',
55 'escape_string' => 'mysqli_real_escape_string',
56 'escape_binary' => 'mysqli_real_escape_string',
57 'unescape_binary' => '$this->command_unescape_binary',
58 'fetch_assoc' => 'mysqli_fetch_assoc',
59 'fetch_row' => 'mysqli_fetch_row',
60 'fetch_object' => 'mysqli_fetch_object',
61 'free_result' => 'mysqli_free_result',
62 'insert_id' => 'mysqli_insert_id',
63 'num_rows' => 'mysqli_num_rows',
64 'affected_rows' => 'mysqli_affected_rows'
67 // ###################################################################
71 function __construct(&$registry)
73 parent
::__construct($registry);
76 // ###################################################################
80 function DB_MySQLi(&$registry)
82 $this->__construct($registry);
85 // ###################################################################
87 * Wrapper: mysqli_connect
91 * @param string Server name
92 * @param string User name
93 * @param string Password
94 * @param string Database
96 * @return integer DB-Link
98 function command_mysqli_connect($server, $user, $password, $database)
100 return mysqli_connect($server, $user, $password, $database);
103 // ###################################################################
105 * Not supported: unescape binary string
109 * @param string Escaped data
111 * @return string Same data
113 function command_unescape_binary($string)
118 // ###################################################################
120 * Starts a database transaction
124 function transaction_start()
126 $this->query("START TRANSACTION");
129 // ###################################################################
131 * Saves current transaction steps as a savepoint
135 * @param string Named savepoint
137 function transaction_savepoint($name)
139 $this->query("SAVEPOINT $name");
142 // ###################################################################
144 * Reverts a transaction back to a given savepoint
148 * @param string Named savepoint
150 function transaction_rollback($name = null)
152 $this->query("ROLLBACK
" . ($name != null ? " TO SAVEPOINT
$name" : ""));
155 // ###################################################################
157 * Commits a database transaction
161 function transaction_commit()
163 $this->query("COMMIT");
167 /*=====================================================================*\
168 || ###################################################################
171 || ###################################################################
172 \*=====================================================================*/