2011-11-13 60 views
0

過去2天裏一直試圖安裝此模塊。其彈出錯誤YII用戶管理模塊安裝錯誤 - 一般錯誤:2014

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2014  Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.. The SQL statement executed was: CREATE TABLE IF NOT EXISTS `user_group` (
`id` int(11) NOT NULL AUTO_INCREMENT, 
`owner_id` int(11) NOT NULL, 
`participants` text NULL, 
`title` varchar(255) NOT NULL, 
`description` text NOT NULL, 
PRIMARY KEY (`id`) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8; 

在文件的代碼的這些行:\保護\模塊\用戶\控制器\ YumInstallController.php(134):CDbCommand->執行()

if (isset($_POST['installUsergroup'])) { 
        $sql = "CREATE TABLE IF NOT EXISTS `" . $usergroupTable . "` (
         `id` int(11) NOT NULL AUTO_INCREMENT, 
         `owner_id` int(11) NOT NULL, 
         `participants` text NULL, 
         `title` varchar(255) NOT NULL, 
         `description` text NOT NULL, 
         PRIMARY KEY (`id`) 
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; 

        $db->createCommand($sql)->execute(); //throws exception on this line. 
        $createdTables['usergroup']['usergroupTable'] = $usergroupTable; 

我試圖在運行查詢之前使用代碼行

$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); 

。 環顧四周,但解決方案告訴我不適合我。我在這裏錯過了什麼?這裏的任何幫助將不勝感激。

+0

這裏註明爲工作解決類似的問題:http://stackoverflow.com /問題/ 6857378 /警予創建,臨時表和使用,其功能於下查詢產生,一般錯誤 – schmunk

回答

1

我解決了這個由YumInstallController.PHP註釋以下行(當然我沒有打算使用翻譯)

// Insert the translation strings that come with yum 
//$sql = file_get_contents(Yii::getPathOfAlias(
//       'application.modules.user.docs') . '/yum_translation.sql'); 
//$db->createCommand($sql)->execute();