国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

干嘛我一用自帶的PDO就報(bào)錯(cuò)?。ㄒ呀鉀Q,請(qǐng)老板看下是不是源碼問(wèn)題)。。

chenyeyu

已經(jīng)解決了,我在把GatewayWorker\Lib\DbConnection.php 的$sQuery屬性改成 public,然后在我的業(yè)務(wù)代碼執(zhí)行完single()查詢之后,調(diào)用一下$db1->sQuery->closeCursor();就可以了,代碼如下。。

 $orderCount = $db1->single("select count(*) as count from t2 limit 1;");
 $db1->sQuery->closeCursor();
    $callCount = $db1->single("select count(*) as count from t1 limit 1;");
    $db1->sQuery->closeCursor();

我寫了個(gè)定時(shí)器,就是去查詢訂單總數(shù),然后推送給指定的客戶端。他第一次查詢就沒(méi)問(wèn)題,第二次查詢就會(huì)報(bào)錯(cuò),然后是有時(shí)候沒(méi)問(wèn)題,有時(shí)候報(bào)錯(cuò)
我試了下在這個(gè)function single()函數(shù)renturn的前面加了句代碼

$this->sQuery->closeCursor();
return $this->sQuery->fetchColumn();

他就不報(bào)錯(cuò),但是返回來(lái)的都是flase了。。
看那報(bào)錯(cuò)的代碼是不是在說(shuō)還有查詢?cè)趫?zhí)行的意思啊。。
這是我的定時(shí)器代碼

 \Workerman\Lib\Timer::add(10, function() {
            $config_name = 'XXXX';
            $gate = new \GatewayWorker\Lib\Gateway();
            $db = new \GatewayWorker\Lib\Db();

            $tempClient = array();
            $allSession = $gate->getAllClientSessions();
            foreach ($allSession as $key => $value) {
                if (isset($value) && $value == $config_name) {
                    $tempClient[] = $key;
                }
            }
            //如果存在是XXXX的客戶端
            if (count($tempClient) > 0) {
                $config = Config\Db::$$config_name;
                $db1 = $db->instance($config_name);
                $count = $db1->single("select count(*) as count from {$config}order  limit 1;");
                foreach ($tempClient as $value) {
                    $gate->sendToClient($value, json_encode(array( 'order_count' => $count)));
                }
            }
        });

這是報(bào)錯(cuò)代碼

client:180.136.150.226:60103 gateway:127.0.0.1:7272  client_id:7f0000010b5600000001 session:{"orign":"laikediancan"} onMessage:{"orign":""}
PHP Fatal error:  Uncaught exception 'PDOException' with message '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 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php:1724
Stack trace:
#0 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1724): PDO->prepare('select count(*)...')
#1 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1906): GatewayWorker\Lib\DbConnection->execute('select count(*)...', NULL)
#2 /home/wwwroot/diancan/public_html/im/GatewayWorker/Applications/IM/start_businessworker.php(52): GatewayWorker\Lib\DbConnection->single('select count(*)...')
#3 : {closure}()
#4 /home/wwwroot/diancan/public_html/im/GatewayWorker/Workerman/Event in /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php on line 1724

Fatal error: Uncaught exception 'PDOException' with message '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 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php:1724
Stack trace:
#0 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1724): PDO->prepare('select count(*)...')
#1 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1906): GatewayWorker\Lib\DbConnection->execute('select count(*)...', NULL)
#2 /home/wwwroot/diancan/public_html/im/GatewayWorker/Applications/IM/start_businessworker.php(52): GatewayWorker\Lib\DbConnection->single('select count(*)...')
#3 : {closure}()
#4 /home/wwwroot/diancan/public_html/im/GatewayWorker/Workerman/Event in /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php on line 1724
WORKER EXIT UNEXPECTED E_ERROR Uncaught exception 'PDOException' with message '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 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php:1724
Stack trace:
#0 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1724): PDO->prepare('select count(*)...')
#1 /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php(1906): GatewayWorker\Lib\DbConnection->execute('select count(*)...', NULL)
#2 /home/wwwroot/diancan/public_html/im/GatewayWorker/Applications/IM/start_businessworker.php(52): GatewayWorker\Lib\DbConnection->single('select count(*)...')
#3 : {closure}()
#4 /home/wwwroot/diancan/public_html/im/GatewayWorker/Workerman/Event in /home/wwwroot/diancan/public_html/im/GatewayWorker/GatewayWorker/Lib/DbConnection.php on line 1724
worker exit with status 65280
6396 1 0
1個(gè)回答

walkor 打賞

報(bào)錯(cuò)的意思是返回的結(jié)果集是多行,你只取了1行或者說(shuō)沒(méi)有取完,然后又執(zhí)行查詢,就會(huì)報(bào)錯(cuò)。

可能你哪里調(diào)用了single 或者row sql沒(méi)指定limit 1

  • chenyeyu 2016-08-11

    已經(jīng)指定limit 1了啊

  • chenyeyu 2016-08-11

    select count(*) as count from t2 limit 1;

  • walkor 2016-08-11

    看下其它地方是否調(diào)用了mysql

年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??