Phalconphp - 如何切换到缓冲查询

时间:2014-04-01 16:00:59

标签: php mysql pdo phalcon

我像这样实例化我的数据库适配器:

return new \Phalcon\Db\Adapter\Pdo\MySql(array(
    "host"     => $options["host"],
    "username" => $options["username"],
    "password" => $options["password"],
    "dbname"   => $options["dbname"],
));

我希望能够强制所有查询被强制“缓冲”,如此处所述(pdo部分): http://us1.php.net/manual/en/mysqlinfo.concepts.buffering.php

我如何通过:

$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

到phalcon的pdo适配器?

1 个答案:

答案 0 :(得分:3)

您可以按如下方式传递任何PDO选项:

return new \Phalcon\Db\Adapter\Pdo\MySql(array(
    "host"     => $options["host"],
    "username" => $options["username"],
    "password" => $options["password"],
    "dbname"   => $options["dbname"],
    "options"  => array(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true)
));