yii-user-management
yii-user-management copied to clipboard
YumInstallController, the yum_translation.sql produce a mysql pdo error 2014: "MYSQL_ATTR_USE_BUFFERED_QUERY"
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');
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.
@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.
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.
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.