我在我的 oracle 中有数据并从 codeigniter 中检索它
$this->db->select('detail');
$r = $this->db->get($tableName);
$result = $r->result();
打印_r($结果):
Array
(
[0] => stdClass Object
(
[DETAIL] => OCI-Lob Object
(
[descriptor] => Resource id #80
)
)
[1] => stdClass Object
(
[DETAIL] =>
)
[2] => stdClass Object
(
[DETAIL] => OCI-Lob Object
(
[descriptor] => Resource id #80
)
)
)
数据模型:
function get_ora_blob_value($value)
{
$size = $value->size();
$result = $value->read($size);
return ($result)?$result:NULL;
}
检索数据:
echo $this->data->get_ora_blob_value($result[0][DETAIL]); // should be 'remark1'
echo "<br />";
echo $this->data->get_ora_blob_value($result[1][DETAIL]); // should be null
echo "<br />";
echo $this->data->get_ora_blob_value($result[2][DETAIL]); // should be 'remark2'
打印 :
remark2
(empty)
(empty)
为什么第一个数据具有第三个数据的价值?第三个数据变空?