YII用户管理模块安装错误 - 常规错误:2014

时间:2011-11-13 08:55:59

标签: yii

过去两天一直在尝试安装此模块。它抛出一个错误

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;

在这些代码行中:\ protected \ modules \ user \ controllers \ YumInstallController.php(134):CDbCommand-> execute()

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

在运行查询之前。 环顾四周,但解决方案告诉我不适合我。我在这里错过了什么吗?在这里有任何帮助将不胜感激。

1 个答案:

答案 0 :(得分: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();