数据库报错

a3563115
2017-07-03 10:58:50 pid:17822 PDOException: SQL:select * from config_rand_name group by `type` SQLSTATE: 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. in /root/workerman-win/vendor/workerman/gateway-worker/src/Lib/DbConnection.php:1766

请问这个是什么问题 要怎么解决呢

3018 2 0
2个回答

walkor 打赏

->row()
->column()
->single()

调用这三个方法的sql里加上limit 1就好了

  • a3563115 2017-07-03

    没有用到这三个方法,都是直接用query

    2017-07-03 15:00:20 pid:21612 PDOException: 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. in /root/workerman-win/vendor/workerman/gateway-worker/src/Lib/DbConnection.php:1732
    Stack trace:

    0 /root/workerman-win/vendor/workerman/gateway-worker/src/Lib/DbConnection.php(1732): PDO->prepare('select * from c...')

    1 /root/workerman-win/vendor/workerman/gateway-worker/src/Lib/DbConnection.php(1820): GatewayWorker\Lib\DbConnection->execute('select * from c...', NULL)

    2 /root/workerman-win/Applications/Todpole/lib/class.CDataBase.php(21): GatewayWorker\Lib\DbConnection->query('select * from c...')

    3 /root/workerman-win/Applications/Todpole/lib/CRandName.php(57): CDataBase::ExeMainSQL('select * from c...')

    4 /root/workerman-win/Applications/Todpole/lib/CRandName.php(12): CRandName->LoadConfigType()

    5 /root/workerman-win/Applications/Todpole/lib/CRandName.php(99): CRandName->LoadConfig()

    6 /root/workerman-win/Applications/Todpole/player/class.rm.CLoginEx.php(502): CRandName::ProductRandName(20)

    7 /root/workerman-win/Applications/Todpole/player/class.rm.CLoginEx.php(470): CLogin->ProductRankName()

    8 /root/workerman-win/Applications/Todpole/player/class.rm.CLoginEx.php(111): CLogin->LoginFail()

    9 /root/workerman-win/Applications/Todpole/player/class.rm.CLoginEx.php(788): CLogin->doLogin()

    10 /root/workerman-win/Applications/Todpole/HttpRequest.php(57): CLogin::Process(1)

    11 /root/workerman-win/Applications/Todpole/Events.php(65): HttpRequest::MsgTypeRequest()

    12 [internal function]: Events::onMessage('7f0000010a8d000...', '{"userToken":""...')

    13 /root/workerman-win/vendor/workerman/gateway-worker/src/BusinessWorker.php(369): call_user_func('Events::onMessa...', '7f0000010a8d000...', '{"userToken":""...')

    14 [internal function]: GatewayWorker\BusinessWorker->onGatewayMessage(Object(Workerman\Connection\AsyncTcpConnection), Array)

    15 /root/workerman-win/vendor/workerman/workerman/Connection/TcpConnection.php(480): call_user_func(Array, Object(Workerman\Connection\AsyncTcpConnection), Array)

    16 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #73)

    17 /root/workerman-win/vendor/workerman/workerman/Events/Select.php(250): call_user_func_array(Array, Array)

    18 /root/workerman-win/vendor/workerman/workerman/Worker.php(1561): Workerman\Events\Select->loop()

    19 /root/workerman-win/vendor/workerman/gateway-worker/src/BusinessWorker.php(183): Workerman\Worker->run()

    20 /root/workerman-win/vendor/workerman/workerman/Worker.php(959): GatewayWorker\BusinessWorker->run()

    21 /root/workerman-win/vendor/workerman/workerman/Worker.php(922): Workerman\Worker::forkOneWorker(Object(GatewayWorker\BusinessWorker))

    22 /root/workerman-win/vendor/workerman/workerman/Worker.php(430): Workerman\Worker::forkWorkers()

    23 /root/workerman-win/start.php(37): Workerman\Worker::runAll()

    24 {main}

a3563115

报错

  • 暂无评论
年代过于久远,无法发表回答
×
🔝