After connecting to the oracle database with pdo, obtain multiple pieces of article data. The returned value contains Resourceid. How can I obtain this content? {Code ...} try this way, but the last piece of data is obtained. {code ...} instead of using fetchAll to use fetch, the number of obtained results is always... after connecting to the oracle database with pdo, obtain multiple pieces of article data. The returned value contains the Resource id. How can I obtain the content?
$data_f = $ocl->query($sql);print_r($data = $data_f->fetchAll(PDO::FETCH_ASSOC));
This is an attempt, but the last piece of data is obtained.
foreach($data as $v){ echo stream_get_contents($v['CONTENT']);}
Instead of using fetchAll to use fetch, there is a problem with the number of obtained results. For example, 3 results are output only when 10 results are obtained in an SQL statement.
while($v = $data_f->fetch(PDO::FETCH_ASSOC)){ echo stream_get_contents($v['CONTENT']);}
Reply content:
After connecting to the oracle database with pdo, obtain multiple pieces of article data. The returned value contains the Resource id. How can I obtain the content?
$data_f = $ocl->query($sql);print_r($data = $data_f->fetchAll(PDO::FETCH_ASSOC));
This is an attempt, but the last piece of data is obtained.
foreach($data as $v){ echo stream_get_contents($v['CONTENT']);}
Instead of using fetchAll to use fetch, there is a problem with the number of obtained results. For example, 3 results are output only when 10 results are obtained in an SQL statement.
while($v = $data_f->fetch(PDO::FETCH_ASSOC)){ echo stream_get_contents($v['CONTENT']);}
The last piece of data is obtained. This is a known bug. It has been discussed in php and has no solution.
Is fetch only returns one field? When I use cyclic fetch, it is still normal.
My current code is:
`
while($row=$pStmt->fetch(PDO::FETCH_ASSOC)){ $clobFields=$this->detectClob($row); if(count($clobFields)>0){ $this->retriveClobRow($row,$clobFields); } $rst[]=$row; } protected function retriveClobRow(&$row,$clobFields){ if(count($clobFields)>0){ foreach($clobFields as $colName){ $row[$colName] =stream_get_contents($row[$colName]); } } } `
All in all, oracle pdo is a small toy. Even if this problem is solved, the problem of output parameters cannot be bypassed when the stored procedure is called. Avoid using oracle pdo whenever possible.