didou Sat Oct 30 11:57:33 2004 EDT
Modified files: /phpdoc/en/reference/ibase/functions ibase-blob-import.xml ibase-execute.xml Log: CS and add a check on the file pointer # I was going to fix #22871 but it was already done :) http://cvs.php.net/diff.php/phpdoc/en/reference/ibase/functions/ibase-blob-import.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/ibase/functions/ibase-blob-import.xml diff -u phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.6 phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.7 --- phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.6 Wed Sep 22 04:55:45 2004 +++ phpdoc/en/reference/ibase/functions/ibase-blob-import.xml Sat Oct 30 11:57:32 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/ibase.xml, last change in rev 1.39 --> <refentry id='function.ibase-blob-import'> <refnamediv> @@ -34,17 +34,22 @@ $filename = '/tmp/bar'; $fd = fopen($filename, 'r'); -$blob = ibase_blob_import($dbh, $fd); -fclose($fd); +if ($fd) { -if (!is_string($blob)) { - // import failed -} else { - $query = "INSERT INTO foo (name, data) VALUES ('$filename', ?)"; - $prepared = ibase_prepare($dbh, $query); - if (!ibase_execute($prepared, $blob)) { - // record insertion failed + $blob = ibase_blob_import($dbh, $fd); + fclose($fd); + + if (!is_string($blob)) { + // import failed + } else { + $query = "INSERT INTO foo (name, data) VALUES ('$filename', ?)"; + $prepared = ibase_prepare($dbh, $query); + if (!ibase_execute($prepared, $blob)) { + // record insertion failed + } } +} else { + // unable to open the data file } ?> ]]> http://cvs.php.net/diff.php/phpdoc/en/reference/ibase/functions/ibase-execute.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc/en/reference/ibase/functions/ibase-execute.xml diff -u phpdoc/en/reference/ibase/functions/ibase-execute.xml:1.8 phpdoc/en/reference/ibase/functions/ibase-execute.xml:1.9 --- phpdoc/en/reference/ibase/functions/ibase-execute.xml:1.8 Wed Sep 22 04:42:45 2004 +++ phpdoc/en/reference/ibase/functions/ibase-execute.xml Sat Oct 30 11:57:32 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/ibase.xml, last change in rev 1.2 --> <refentry id="function.ibase-execute"> <refnamediv> @@ -33,19 +33,20 @@ <![CDATA[ <?php - $dbh = ibase_connect($host, $username, $password); +$dbh = ibase_connect($host, $username, $password); - $updates = array( - 1 => 'Eric', - 5 => 'Filip', - 7 => 'Larry' - ); +$updates = array( + 1 => 'Eric', + 5 => 'Filip', + 7 => 'Larry' +); - $query = ibase_prepare($dbh, "UPDATE FOO SET BAR = ? WHERE BAZ = ?"); +$query = ibase_prepare($dbh, "UPDATE FOO SET BAR = ? WHERE BAZ = ?"); + +while (list($baz, $bar) = each($updates)) { + ibase_execute($query, $bar, $baz); +} - while (list($baz, $bar) = each($updates)) { - ibase_execute($query, $bar, $baz); - } ?> ]]> </programlisting>