27 #require_once 'Zend/Db/Adapter/Abstract.php'; 32 #require_once 'Zend/Db/Profiler.php'; 37 #require_once 'Zend/Db/Select.php'; 42 #require_once 'Zend/Db/Statement/Mysqli.php'; 110 return "'" . $this->_connection->real_escape_string(
$value) .
"'";
133 $sql =
'SHOW TABLES';
135 while (
$row = $queryResult->fetch_row()) {
138 $queryResult->close();
143 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 185 $sql =
'DESCRIBE ' . $this->
quoteIdentifier(
"$schemaName.$tableName",
true);
195 while (
$row = $queryResult->fetch_assoc()) {
198 $queryResult->close();
203 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 209 $row_defaults = array(
215 'PrimaryPosition' =>
null,
221 $row = array_merge($row_defaults,
$row);
222 if (preg_match(
'/unsigned/',
$row[
'Type'])) {
223 $row[
'Unsigned'] =
true;
225 if (preg_match(
'/^((?:var)?char)\((\d+)\)/',
$row[
'Type'], $matches)) {
226 $row[
'Type'] = $matches[1];
227 $row[
'Length'] = $matches[2];
228 }
else if (preg_match(
'/^decimal\((\d+),(\d+)\)/',
$row[
'Type'], $matches)) {
229 $row[
'Type'] =
'decimal';
230 $row[
'Precision'] = $matches[1];
231 $row[
'Scale'] = $matches[2];
232 }
else if (preg_match(
'/^float\((\d+),(\d+)\)/',
$row[
'Type'], $matches)) {
233 $row[
'Type'] =
'float';
234 $row[
'Precision'] = $matches[1];
235 $row[
'Scale'] = $matches[2];
236 }
else if (preg_match(
'/^((?:big|medium|small|tiny)?int)\((\d+)\)/',
$row[
'Type'], $matches)) {
237 $row[
'Type'] = $matches[1];
243 if (strtoupper(
$row[
'Key']) ==
'PRI') {
244 $row[
'Primary'] =
true;
245 $row[
'PrimaryPosition'] = $p;
246 if (
$row[
'Extra'] ==
'auto_increment') {
247 $row[
'Identity'] =
true;
249 $row[
'Identity'] =
false;
254 'SCHEMA_NAME' =>
null,
257 'COLUMN_POSITION' =>
$i,
258 'DATA_TYPE' =>
$row[
'Type'],
259 'DEFAULT' =>
$row[
'Default'],
260 'NULLABLE' => (
bool) (
$row[
'Null'] ==
'YES'),
261 'LENGTH' =>
$row[
'Length'],
262 'SCALE' =>
$row[
'Scale'],
263 'PRECISION' =>
$row[
'Precision'],
264 'UNSIGNED' =>
$row[
'Unsigned'],
265 'PRIMARY' =>
$row[
'Primary'],
266 'PRIMARY_POSITION' =>
$row[
'PrimaryPosition'],
267 'IDENTITY' =>
$row[
'Identity']
282 if ($this->_connection) {
286 if (!extension_loaded(
'mysqli')) {
290 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 294 if (isset($this->_config[
'port'])) {
295 $port = (integer) $this->_config[
'port'];
300 if (isset($this->_config[
'socket'])) {
301 $socket = $this->_config[
'socket'];
306 $this->_connection = mysqli_init();
308 if(!empty($this->_config[
'driver_options'])) {
309 foreach($this->_config[
'driver_options'] as
$option=>
$value) {
323 $_isConnected = @mysqli_real_connect(
325 $this->_config[
'host'],
326 $this->_config[
'username'],
327 $this->_config[
'password'],
328 $this->_config[
'dbname'],
333 if ($_isConnected ===
false || mysqli_connect_errno()) {
339 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 343 if (!empty($this->_config[
'charset'])) {
344 mysqli_set_charset($this->_connection, $this->_config[
'charset']);
355 return ((
bool) ($this->_connection instanceof mysqli));
366 $this->_connection->close();
368 $this->_connection =
null;
381 $this->_stmt->close();
385 #require_once 'Zend/Loader.php'; 388 $stmt =
new $stmtClass($this, $sql);
389 if ($stmt ===
false) {
392 $stmt->setFetchMode($this->_fetchMode);
393 $this->_stmt = $stmt;
417 return (
string) $mysqli->insert_id;
428 $this->_connection->autocommit(
false);
439 $this->_connection->commit();
440 $this->_connection->autocommit(
true);
451 $this->_connection->rollback();
452 $this->_connection->autocommit(
true);
471 $this->_fetchMode =
$mode;
477 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 484 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 504 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 508 $offset = intval($offset);
513 #require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; 517 $sql .=
" LIMIT $count";
519 $sql .=
" OFFSET $offset";
550 $version = $this->_connection->server_version;
552 $minor = (int) (
$version % 10000 / 100);
554 return $major .
'.' . $minor .
'.' . $revision;
describeTable($tableName, $schemaName=null)
lastInsertId($tableName=null, $primaryKey=null)
limit($sql, $count, $offset=0)
static loadClass($class, $dirs=null)
supportsParameters($type)
getQuoteIdentifierSymbol()
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
query($sql, $bind=array())
quoteIdentifier($ident, $auto=false)