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

Laravel Admin Csv导出功能易现的 MySQL General error 2014 错误 #46

Open
wilbur-yu opened this issue Aug 26, 2020 · 5 comments
Open

Comments

@wilbur-yu
Copy link
Contributor

[2020-08-26 15:31:00] production.ERROR: 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. (SQL: select * from `points` order by `score` desc, `score` desc limit 100 offset 0) {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY000): 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. (SQL: select * from `points` order by `score` desc, `score` desc limit 100 offset 0) at /web/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671)
[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDOException(code: HY000): 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. at /web/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:66)
[previous exception] [object] (PDOException(code: HY000): 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. at /web/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:64)
[2020-08-26 15:31:08] production.ERROR: swoole exit {"exception":"[object] (Swoole\\ExitException(code: 0): swoole exit at /web/project/vendor/encore/laravel-admin/src/Grid/Exporters/CsvExporter.php:171)
@huang-yi
Copy link
Owner

huang-yi commented Aug 26, 2020

我看Laravel Admin导出csv或者excel的方法里面调用了exit,这个兼容不了。当调用exit时,swoole会抛出一个ExitException,就会走Laravel的异常处理逻辑了,这个还真不好处理。

前面的sql报错是因为数据量大吗?你的数据量有多大呢?提供给我模拟测试看看。

@wilbur-yu
Copy link
Contributor Author

嗯, 数据量也不是特别大, 18588条吧. 是两个一对一关联表

@iblues
Copy link

iblues commented Aug 28, 2020

提个实现的意见. 部分功能如果无法兼容. 可以考虑写个转发黑名单.
名单内的api请求. 转发fpm处理. 这样可以最大程度进行适配,

@huang-yi
Copy link
Owner

@iblues 很好的建议,不过目前还不会计划在Shadowfax里面添加这个功能,可自行使用nginx实现这个功能。

@hanchikang
Copy link

之前也有研究过,写了一个兼容扩展,可以参考试试:
https://github.com/hanchikang/laravel-admin-shadowfax

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

4 participants