首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用createEntityTables时出错

使用createEntityTables时出错
EN

Stack Overflow用户
提问于 2012-08-24 06:25:59
回答 1查看 821关注 0票数 1

当我包含$installer->createEntityTables( $ this ->getTable('red/red') )时,我会得到这个错误;

我正在使用Enterprise1.11,我也看到了替代的方法,即类型,每一件东西都是非常耗时的。有人能告诉我谁能让这个功能发挥作用吗?

代码语言:javascript
复制
    [previous:Exception:private] => 
    [xdebug_message] => ( ! ) Mage_Eav_Exception: Can't create table: red_faqs_eavexample in C:\wamp\www\ubt.onlocal.com.au\app\Mage.php on line 549
Call Stack
#TimeMemoryFunctionLocation
10.0003690528{main}(  )..\index.php:0
20.00271167384Mage::run(  )..\index.php:81
30.01012776112Mage_Core_Model_App->run(  )..\Mage.php:640
40.02304545784Mage_Core_Model_App->_initModules(  )..\App.php:338
50.46364871080Mage_Core_Model_Resource_Setup::applyAllUpdates(  )..\App.php:412
60.528411772936Mage_Core_Model_Resource_Setup->applyUpdates(  )..\Setup.php:235
70.528611769664Mage_Core_Model_Resource_Setup->_installResourceDb(  )..\Setup.php:327
80.528611769824Mage_Core_Model_Resource_Setup->_modifyResourceDb(  )..\Setup.php:421
90.529511778144include( 'C:\wamp\www\ubt.onlocal.com.au\app\code\local\Magelocal\Red\sql\red_setup\install-0.1.0.php' )..\Setup.php:624
100.529711778712Mage_Eav_Model_Entity_Setup->createEntityTables(  )..\install-0.1.0.php:6

)
Error in file: "C:\wamp\www\ubt.onlocal.com.au\app\code\local\Magelocal\Red\sql\red_setup\install-0.1.0.php" - Can't create table: red_faqs_eavexample

#0 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\Resource\Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\Resource\Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '0.1.0')
#2 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\Resource\Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb('0.1.0')
#3 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\Resource\Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\App.php(412): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 C:\wamp\www\ubt.onlocal.com.au\app\code\core\Mage\Core\Model\App.php(338): Mage_Core_Model_App->_initModules()
#6 C:\wamp\www\ubt.onlocal.com.au\app\Mage.php(640): Mage_Core_Model_App->run(Array)
#7 C:\wamp\www\ubt.onlocal.com.au\index.php(81): Mage::run('', 'store')
#8 {main}
EN

回答 1

Stack Overflow用户

发布于 2012-09-23 02:14:40

这是一个错误在不应该触发的时候触发的问题。长话短说,MySQL不支持DDL事务,在方法过程中,在SQL中找到DDL例程并引发错误。

简单的答案是把这一行注释掉:

lib/Varien/Db/Adapter/PDO/Mysql.php

代码语言:javascript
复制
protected function _checkDdlTransaction($sql)
{
    if (is_string($sql) && $this->getTransactionLevel() > 0) {
        $startSql = strtolower(substr(ltrim($sql), 0, 3));
        if (in_array($startSql, $this->_ddlRoutines)) {
            // comment this out: trigger_error(Varien_Db_Adapter_Interface::ERROR_DDL_MESSAGE, E_USER_ERROR);
        }
    }
}

这样做可以让您的模块安装。显然,侵入核心文件是个糟糕的主意。您应该扩展该方法或允许运行MySQL,然后将生成的SQL转换为Magento,如核心MySQL设置脚本中所示。后者是一个很大的痛苦。更好的办法是扩展该方法。

背景信息和故障排除方面的更多在这里

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12104178

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档