note 101881 rejected from pdo.lobs by danbrown

From: Date: Sat, 15 Jan 2011 19:27:18 +0000
Subject: note 101881 rejected from pdo.lobs by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175791@lists.php.net to get a copy of this message
Note Submitter: kozy_ligh at yahoo dot com ---- Problem with saving blob from DB2 DB to file. Tried: try{ $stmt = $db->prepare($QSql); $stmt->execute(); $res = $stmt->fetchAll( PDO::FETCH_ASSOC ); } catch (PDOException $e) { echo $e->getMessage(); } $FileName = $res[0]['DOKU_KBESEDA']; $createFile = './Datoteke/'.$FileName; $content = stream_get_contents( $res[0]['DOKU_DOKUMENT'] ); file_put_contents( $createFile, $content ); the file gets created but it is empty. What did work is selecting it as a LOB and doing this with the string it returned: function hextostr($x) { $s=''; foreach(explode("\n",trim(chunk_split($x,2))) as $h) $s.=chr(hexdec($h)); return($s); } This takes too much ram tho, so big files are a no go. Any help is very apriciated! With regards, Marko kozy_ligh@yahoo.com

« previous php.notes (#175791) next »