オラクルにデータがあり、codeigniterから取得します
$this->db->select('detail');
$r = $this->db->get($tableName);
$result = $r->result();
print_r($ result):
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)
なぜ最初のデータが3番目のデータの価値を持っているのですか?そして3番目のデータは空になりますか?