|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58627 Improve support for binary large objects
Submitted: 2009-04-09 13:39 UTC Modified: 2018-08-27 09:37 UTC
From: kolar dot radim at gmail dot com Assigned: vnkbabu (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.2.4 OS: Ubuntu 8.04 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kolar dot radim at gmail dot com
New email:
PHP Version: OS:


 [2009-04-09 13:39 UTC] kolar dot radim at gmail dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-13 04:16 UTC] abhargav at in dot ibm dot com

Thanks for using our driver and you suggestions. 

Can you provide us a sample, which is using all these functions/APIs (the way you are expecting it)? Also provide the information about the contain of the tables and the expected output of that sample. 

I will look into it and will try to add these APIs.

Ambrish Bhargava
 [2010-08-05 14:18 UTC] kolar dot radim at gmail dot com
Here is testcase for my proposed new functions

Database setup;

drop table b1;
create table b1 (id integer not null, data blob not null);
insert into b1 (id,data) values(10,blob('--binary-blob-here--'));

$conn = db2_connect('SAMPLE);
$stmt = db2_prepare($conn,'select data from b1 where id=10');

// 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

    returns 20;

// get lob object handle
$lobj = db2_lob_open($stmt,1);
    returns large object handle
     returns '--';

	 returns 'bi';

db2_lob_seek($lobj, 0);
	  returns true; // returns boolean value - sucess
	  returns '--';
	  returns true; // boolean - success
	  returns 'na'

	  returns true;
	  returns 'un';
	  returns true; // success
 [2011-07-05 03:33 UTC] hsn at sendmail dot cz
i just looked at package documentation and there is already 
function db2_lob_read. I propose to make functions, 
compatible with current lob API.

boolean db2_lob_write ( resource $stmt , int $colnum , 
string  $data )
writes data into large object

int db2_lob_seek ( resource $stmt , int $colnum , int   
$offset )
changes offset in LOB object for reading/writing. returns 
new offset

function for truncating lob object
int db2_lob_set_size ( resource $stmt , int $colnum , int   
$size )
sets LOB size to $size. if lob is larger it will get 
truncated. returns new offset

returns size of lob object
int db2_lob_get_size($stmt,int $colnum);
 [2018-08-27 09:37 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: vnkbabu
 [2018-08-27 09:37 UTC]
As this issue is very old, Closing this.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 21 02:03:36 2021 UTC