2

我从数据库查询中获取 CLOB 或 Informix 类型的 TEXT 结果(文本),但不知道如何输出。

$preparedStatement = $dbinformix->prepare($sql3);
$preparedStatement->bindColumn(4, $tmp, PDO::PARAM_LOB);
$preparedStatement->execute();
$result = $preparedStatement->fetchAll();
  • 资源 ID #47的echo $tmp结果。
  • Avar_dump($tmp)导致类型(流)的资源(47)。
  • Anfpassthru($tmp)使显示空白。
  • 如果我尝试使用 PDO::PARAM_STR 作为第三个绑定参数,显示仍然是空白的。

所以我不知道如何获取 CLOB 中的文本(它是几 KB,而不是 MB)。有任何想法吗?

4

1 回答 1

1

Do this with the "fetch column" syntax of PDOStatement::fetchAll instead:

$preparedStatement = $dbinformix->prepare($sql3);
$preparedStatement->execute();

$tmp = $preparedStatement->fetchAll(PDO::FETCH_COLUMN, 4);

$tmp will now be an array containing the values of your fifth column.

于 2010-11-21T12:23:20.433 回答