yii-user-management icon indicating copy to clipboard operation
yii-user-management copied to clipboard

YumInstallController, the yum_translation.sql produce a mysql pdo error 2014: "MYSQL_ATTR_USE_BUFFERED_QUERY"

Open christiansalazar opened this issue 13 years ago • 4 comments

i need to remove this line and insert the script manually, because it block the automatic script execution, allowing only the users and translation tables to be created, the automatic installer hangs up.

commenting this line will solve the problem,

    $sql = file_get_contents(Yii::getPathOfAlias(
            'application.modules.user.docs') . '/yum_translation.sql');

christiansalazar avatar Jun 14 '12 03:06 christiansalazar

I never got this error, and i can not reproduce it now matter how hard i try. Which versions do you use (php, mysql, yii. apache)? This already happened to someone else, it is noted as the last question of the FAQ section in the install tutorial.

thyseus avatar Jun 14 '12 10:06 thyseus

@christiansalazar, running the SQL script from the mysql console will give you the SQL sentence that is failing. @thyseus, maybe putting a try/catch there might help to avoid the installer stop being executed.

chirvo avatar Jun 14 '12 19:06 chirvo

i dont know why it is happening: YumInstallerController.php::actionInstall() is:

$sql = file_get_contents(Yii::getPathOfAlias('application.modules.user.docs') . '/yum_translation.sql'); $db->createCommand($sql)->execute();

the same sql script runned outside yii, is working fine....but dont from auto installer....misterious... mysql: 5.1.20, php: 5.2.6.

i'll find a way to solve or detect this problem right now, but using a try/catch will bypass it...

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.

AND YES...MYSQL_ATTR_USE_BUFFERED_QUERY Is Active..when calling execute().....now debugging it.

christiansalazar avatar Jun 14 '12 19:06 christiansalazar

SOLVED / BYPASSED:

1-move this etire block to be the last block AFTER the last $transaction->commit().

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

If you try to execute or commit any SQL statment after this then error 2014 occurs. WHY ? I dont know, maybe is related to the SQL script content itself...but moving this entire code block to the end AFTER the transaction->commit, it will by pass the problem without using try/catch.

christiansalazar avatar Jun 14 '12 20:06 christiansalazar