|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-04-09 13:39 UTC] kolar dot radim at gmail dot com
Description: ------------ For my next application i need better interface to large objects. I need following functions: int db2_lob_length(resource $stmt , int $colnum ); return size of blob object in bytes. We probably need some way to get large object handle such as lobj db2_lob_open ( resource $stmt , int $colnum ) int db2_lob_close ( lobj $obj ) to implement functionality i need: int db2_lob_write ( lobj $obj , string $data ); write data to large object string db2_lob_read ( lobj $obj , int $length ) read data from lob int db2_lob_seek ( lobj $obj, int $offset); change offset in lob for reading and writing PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 04:00:01 2025 UTC |
Here is testcase for my proposed new functions Database setup; drop table b1; commit; create table b1 (id integer not null, data blob not null); insert into b1 (id,data) values(10,blob('--binary-blob-here--')); commit; $conn = db2_connect('SAMPLE); $stmt = db2_prepare($conn,'select data from b1 where id=10'); db2_execute($stmt); db2_fetch_row($stmt); // first function is easy get length of blob // but entire blob should not travel over wire to db2 client because // i plan to about 700 MB big blobs db2_lob_length($stmt,1); returns 20; // get lob object handle $lobj = db2_lob_open($stmt,1); returns large object handle db2_lob_read($lobj,2); returns '--'; db2_lob_read($lobj,2); returns 'bi'; db2_lob_seek($lobj, 0); returns true; // returns boolean value - sucess db2_lob_read($lobj,2); returns '--'; db2_lob_write($lobj,'un'); returns true; // boolean - success db2_lob_read($lobj,2); returns 'na' db2_lob_seek($lobj,2); returns true; db2_lob_read($lobj,2); returns 'un'; db2_lob_close($lobj); returns true; // success