mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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
This commit is contained in:
parent
48e7161457
commit
364f283417
2 changed files with 27 additions and 21 deletions
|
@ -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 @@ $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
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue