From 364f28341799ca4e0e67b628e3a920c084c42838 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Sat, 30 Oct 2004 15:57:32 +0000 Subject: [PATCH] CS and add a check on the file pointer # I was going to fix #22871 but it was already done :) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@171650 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../ibase/functions/ibase-blob-import.xml | 25 +++++++++++-------- reference/ibase/functions/ibase-execute.xml | 23 +++++++++-------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/reference/ibase/functions/ibase-blob-import.xml b/reference/ibase/functions/ibase-blob-import.xml index 3524c222a5..b1365c683c 100644 --- a/reference/ibase/functions/ibase-blob-import.xml +++ b/reference/ibase/functions/ibase-blob-import.xml @@ -1,5 +1,5 @@ - + @@ -34,17 +34,22 @@ $dbh = ibase_connect($host, $username, $password); $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 } ?> ]]> diff --git a/reference/ibase/functions/ibase-execute.xml b/reference/ibase/functions/ibase-execute.xml index 6317b3d366..28ef543f9a 100644 --- a/reference/ibase/functions/ibase-execute.xml +++ b/reference/ibase/functions/ibase-execute.xml @@ -1,5 +1,5 @@ - + @@ -33,19 +33,20 @@ '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); - } ?> ]]>