PHP:PDO在没有绑定的情况下读取clob


php: pdo read clob without bind

$query = "select id, xmldata from xmlcontent where id = '586655' OR id = '671347'"
$db = new PDO(...);
$stmt = $db->prepare($query);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);

输出:

...
["XMLDATA"]=> resource(33) of type (stream)
...

怎么能读到这个?我试试:

stream_get_contents()

但什么都没有

stream_get_contents()

有时阅读一些 litle 文本,我想使用所有 SQL-s 中的通用代码,而无需绑定参数:(

也许您正在尝试从同一流中读取两次,或者只是使用带有错误的旧pdo_oci库(只有最后一个流会在多个记录上返回(。

对于从 Ubuntu 服务器上的 php 源代码编译的最新版本,我只在类中使用延迟加载ActiveRecord

public function getFullText()
{
    if (is_resource($this->fulltext)) {
        $this->fulltext = stream_get_contents($this->fulltext);
    }
    return $this->fulltext;
}

fulltext在哪里CLOB.