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 // ###################################################################
78 * Wrapper: mysqli_connect
82 * @param string Server name
83 * @param string User name
84 * @param string Password
85 * @param string Database
87 * @return integer DB-Link
89 function command_mysqli_connect($server, $user, $password, $database)
91 return mysqli_connect($server, $user, $password, $database);
94 // ###################################################################
96 * Not supported: unescape binary string
100 * @param string Escaped data
102 * @return string Same data
104 function command_unescape_binary($string)
109 // ###################################################################
111 * Starts a database transaction
115 function transaction_start()
117 $this->query("START TRANSACTION");
120 // ###################################################################
122 * Saves current transaction steps as a savepoint
126 * @param string Named savepoint
128 function transaction_savepoint($name)
130 $this->query("SAVEPOINT $name");
133 // ###################################################################
135 * Reverts a transaction back to a given savepoint
139 * @param string Named savepoint
141 function transaction_rollback($name = null
)
143 $this->query("ROLLBACK" . ($name != null ?
" TO SAVEPOINT $name" : ""));
146 // ###################################################################
148 * Commits a database transaction
152 function transaction_commit()
154 $this->query("COMMIT");
158 /*=====================================================================*\
159 || ###################################################################
162 || ###################################################################
163 \*=====================================================================*/