小编cmu*_*nch的帖子

在magento的pdo_mysql适配器中缺少"超过锁定等待超时"处理?

如果我比较两个Magento适配器类Varien_Db_Adapter_MysqliVarien_Db_Adapter_Pdo_Mysql,我可以在方法raw_query的查询异常处理中找到一些差异.

<?php

class Varien_Db_Adapter_Mysqli extends Zend_Db_Adapter_Mysqli
{

//....

/**
 * Run RAW Query
 *
 * @param string $sql
 * @return Zend_Db_Statement_Interface
 */
public function raw_query($sql)
{
    $timeoutMessage = 'SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded;      try restarting transaction';
    $tries = 0;
    do {
        $retry = false;
        try {
            $this->clear_result();
            $result = $this->getConnection()->query($sql);
            $this->clear_result();
        } catch (Exception $e) {
            if ($tries < 10 && $e->getMessage() == $timeoutMessage) {
                $retry = true;
                $tries++;
            } else …
Run Code Online (Sandbox Code Playgroud)

php mysql timeout magento

6
推荐指数
1
解决办法
3928
查看次数

标签 统计

magento ×1

mysql ×1

php ×1

timeout ×1