ID:               22871
 Updated by:       [EMAIL PROTECTED]
 Reported By:      p dot pastori at tiscali dot it
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: all
 PHP Version:      4.3.1
 New Comment:

was fixed a long time ago


Previous Comments:
------------------------------------------------------------------------

[2003-05-02 04:59:33] 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(...);
}

------------------------------------------------------------------------

[2003-04-25 23:53:59] [EMAIL PROTECTED]

Could you come up with some nice ibase examples?

------------------------------------------------------------------------

[2003-03-25 05:06:24] 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.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22871&edit=1

Reply via email to