|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 14:00:01 2025 UTC |
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(...); }