【问题标题】:YII User Management Module install error - General error: 2014YII 用户管理模块安装错误 - 一般错误:2014
【发布时间】:2011-11-13 08:55:59
【问题描述】:

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

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

在运行查询之前。 环顾四周,但告诉的解决方案对我不起作用。我在这里遗漏了什么吗?这里的任何帮助将不胜感激。

【问题讨论】:

标签: yii


【解决方案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(); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-12
    相关资源
    最近更新 更多