Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
christiansalazar opened this issue Jun 14, 2012 · 4 comments

Comments

@christiansalazar
Copy link

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');
@thyseus
Copy link
Owner

thyseus commented Jun 14, 2012

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.

@chirvo
Copy link

chirvo commented Jun 14, 2012

@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.

@christiansalazar
Copy link
Author

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants