2
$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()

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

4

1 回答 1

0

也许您正在尝试从同一个流中读取两次,或者只是使用带有错误的旧 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

于 2015-09-28T11:02:29.057 回答