note 110569 deleted from pdo.lobs by danbrown
| From: | danbrown@php.net | Date: | Thu, 06 Dec 2012 14:21:13 +0000 |
| Subject: | note 110569 deleted from pdo.lobs by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192327@lists.php.net to get a copy of this message | ||
Note Submitter: vicrry at yahoo dot com dot hk
----
In addition to the previous comment, one should always be memory cautious when working with stream.
The handy stream function stream_copy_to_stream() works like a charm in pipe situations.
<?php
$stmt = $pdo->con->prepare( 'select * from filetable' );
$stmt->execute();
$res = $stmt->fetchAll( PDO::FETCH_ASSOC );
for( $i=0; $i<count($res); $i++ ) {
$file = fopen("C:/tmp/".$res[$i]['FILE_ID'].'.xml', 'w');
stream_copy_to_stream($res[$i]['DATA_FILE'], $file);
}
?>