php:pdo 读取 clob 而不绑定
$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 的通用代码而不绑定参数:(
$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);
output:
...
["XMLDATA"]=> resource(33) of type (stream)
...
how i can read this? i try:
stream_get_contents()
but nothing
with
stream_get_contents()
sometimes read some litle text, i would like to use and generic code from all SQL-s without binding params :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您正在尝试从同一个流读取两次,或者只是使用带有错误的旧 pdo_oci 库(多个记录上只会返回最后一个流)。
对于最后一个版本,从 Ubuntu 服务器上的 php 源代码编译,我只是在 ActiveRecord 类中使用延迟加载:
其中
fulltext
是CLOB
。Maybe you're trying to read twice from the same stream or just using old pdo_oci library with a bug (only last stream will be returned on multiple records).
For the last version, compiled from php source on Ubuntu server i just use lazy-load in
ActiveRecord
class:Where
fulltext
isCLOB
.