php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #22871 bad return value for ibase_blob_close() and ibase_blob_import()
Submitted: 2003-03-25 05:06 UTC Modified: 2004-10-30 17:58 UTC
From: p dot pastori at tiscali dot it Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.1 OS: all
Private report: No CVE-ID: None
 [2003-03-25 05:06 UTC] p dot pastori at tiscali dot it
Functions ibase_blob_close() and ibase_blob_import() both returns a string (blob_id_str) on success instead of int (as stated by documentation).
The returned string may contains NULLs, so to update a database record which contains blob field it is necessary to use the ibase_prepare() (with a ? placeholder for blob_id_string instead of '?' ) instead of ibase_query().
It would be nice to have an exaple of blob insertion which involves the following functions:
- ibase_blob_import(), to get the temporary blob_id of just created blob
- ibase_prepare() and ibase_execute() for the query that inserts or updates a database record which contains blob (this last step may be in transaction while the first not since it is already in a read-only transaction).
Finally into the first example reported on ibase_execute() document page there is an error on the ibase_prepare() where the link_identifier argument is omitted.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-25 23:53 UTC] philip@php.net
Could you come up with some nice ibase examples?
 [2003-05-02 04:59 UTC] p dot pastori at tiscali dot it
Suppose you have tyo add a record to the following:
CREATE TABLE foo (
name VARCHAR(128),
data BLOB
)
and your data is the /tmo/bar file, then you can:
$fname = '/tmp/bar';
if (strlen($fname) > 128) die(...);
if (($fd = fopen($fname, "r")) === FALSE) die(...);
if (($dbh = ibase_connect(...)) === FALSE) die(...);
# import temporary blob and get the blob_id_string
$tbid = ibase_blob_import($dbh, $fd);
fclose($fd);
if (is_string($tbid)) {
  $qry = "INSERT INTO foo(name, data) VALUES('$fname', ?)";
  $qryid = ibase_prepare($dbh, $qry);
  if (! ibase_execute($qryid, $tbid)) {
    # record insertion failed
    ...
  }
} else {
  # import failed
  die(...);
}
 [2004-10-30 17:58 UTC] didou@php.net
was fixed a long time ago
 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of didou
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=364f28341799ca4e0e67b628e3a920c084c42838
Log: CS and add a check on the file pointer # I was going to fix #22871 but it was already done :)
 [2020-02-07 06:12 UTC] phpdocbot@php.net
Automatic comment on behalf of didou
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=374c5930d72bec3dd8f22bc31ec35938635bad18
Log: partially fix #22871
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 21:01:33 2025 UTC