2012-08-24 21 views
1

我得到這個錯誤,當我包括 $ installer-> createEntityTables($ this-> getTable('red/red'));錯誤,當使用createEntityTables

我正在使用企業1.11 我也看到了替代方案是每種東西都非常耗時。有人可以告訴我該讓這個功能起作用嗎?

[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} 

回答

1

這是一個錯誤被觸發的問題,當它不應該被觸發時。長話短說,MySQL不支持DDL事務,並且在方法過程中在SQL中找到DDL例程並引發錯誤。

最簡單的答案是,註釋掉該行:


的lib /瓦瑞恩/ DB /適配器/ PDO/Mysql.php

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); 
     } 
    } 
} 

這樣做使你的模塊安裝。顯然黑客核心文件是一個可怕的想法。您應該擴展該方法或允許SQL運行,然後將生成的SQL轉換爲Magento MySQL API,如核心SQL安裝腳本中所示。後者是一個主要的痛苦..更好的想法是擴展該方法。

More here關於背景信息和故障排除。