]>
src.bluestatic.org Git - isso.git/blob - DbMySqlI.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2005-2008 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 2 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 Layer (DbMySqlI.php)
28 require_once(ISSO
. '/Db.php');
31 * MySQLi Database Layer
33 * This framework is a function wrapper for MySQLi functions so we can have
34 * better error reporting and query reporting.
37 * @copyright Copyright (c)2005 - 2008, Blue Static
41 class BSDbMySqlI
extends BSDb
44 * Wrapper: mysql_connect
46 protected function _connect($server, $user, $password, $database)
48 return @mysqli_connect($server, $user, $password, $database);
52 * Wrapper: mysql_query
54 protected function _query($string)
56 return mysqli_query($this->dblink
, $string);
60 * Wrapper: mysql_escape_string
62 protected function _escapeBinary($binary)
64 return mysqli_real_escape_string($this->dblink
, $binary);
68 * Wrapper: mysql(_real)_escape_string
70 protected function _escapeString($string)
72 return mysqli_real_escape_string($this->dblink
, $string);
76 * Not supported: unescape binary string
78 protected function _unescapeBinary($string)
84 * Wrapper: mysql_insert_id
86 protected function _insertId()
88 return mysqli_insert_id($this->dblink
);
92 * Wrapper: mysql_affected_rows
94 protected function _affectedRows($result)
96 return mysqli_affected_rows($this->dblink
);
100 * Starts a database transaction
102 public function begin()
104 $this->query("START TRANSACTION");
108 * Reverts a transaction back to a given savepoint
110 public function rollback()
112 $this->query("ROLLBACK");
116 * Commits a database transaction
118 public function commit()
120 $this->query("COMMIT");
124 * Returns the error number
126 * @return integer Error number
128 public function _errorNumber()
130 return mysqli_errno($this->dblink
);
134 * Returns the error string
136 * @return string Error string
138 public function _errorString()
140 return mysqli_error($this->dblink
);
147 * This class holds result information for a database result
150 * @copyright Copyright (c)2005 - 2008, Blue Static
154 class BSDbMySqlIResult
extends BSDbResult
157 * Wrapper: mysql_fetch_assoc
159 protected function _fetchAssocArray($result)
161 return mysqli_fetch_assoc($result);
165 * Wrapper: mysql_fetch_row
167 protected function _fetchRowArray($result)
169 return mysqli_fetch_row($result);
173 * Wrapper: mysql_fetch_object
175 public function _fetchObject($result)
177 return mysqli_fetch_object($result);
181 * Wrapper: mysql_free_result
183 protected function _freeResult($result)
185 mysqli_free_result($result);
189 * Wrapper: mysql_num_rows
191 protected function _numRows($result)
193 return mysqli_num_rows($result);