#36910 [Com]: Cannot retrieve a newly inserted record after calling ibase_commit
| From: | kogut at kogumelo dot com dot br | Date: | Thu, 27 Apr 2006 07:26:28 +0000 |
| Subject: | #36910 [Com]: Cannot retrieve a newly inserted record after calling ibase_commit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96278@lists.php.net to get a copy of this message | ||
ID: 36910
Comment by: kogut at kogumelo dot com dot br
Reported By: arnoldvmartinez at yahoo dot com
Status: No Feedback
Bug Type: InterBase related
Operating System: Windows 2003
PHP Version: 5.1.2
New Comment:
I'm not the owner of this bug, but i´ve got the same problem.
In my situation, as opposed to what the manual says, changing
"$sth=ibase_query($th,$stmt)" to "$sth=ibase_query($dbh,$stmt)" just
after the "insert ... " statement and "ibase_commit($th)" to
"ibase_commit($dbh)" makes it work for me. And if i change to
"ibase_rollback($dbh)", it works fine, too. I don´t know if it is a
Php or a Firebird bug, but that´s weird.
Previous Comments:
------------------------------------------------------------------------
[2006-04-06 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-03-29 13:41:32] tony2001@php.net
And why did you decide it's a problem of PHP?
Are you able to get the expected result using some other tool?
------------------------------------------------------------------------
[2006-03-29 13:08:36] arnoldvmartinez at yahoo dot com
$dbh = ibase_connect($host, $user, $password);
$stmt = 'SELECT * FROM Employees';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo '<br>'.$row->EMPNAME;
}
$th=ibase_trans(IBASE_DEFAULT,$dbh);
$stmt='INSERT statement here...';
$sth = ibase_query($th, $stmt);
ibase_commit($th);
$stmt = 'SELECT * FROM Employees';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo '<br>'.$row->EMPNAME;
}
/* new record not listed */
------------------------------------------------------------------------
[2006-03-29 12:55:24] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-03-29 12:51:51] arnoldvmartinez at yahoo dot com
Description:
------------
First, I run a SELECT command to retrieve records from a table. Then, I
initiated an ibase_trans, inserted a record, and called ibase_commit.
Next, I run another SELECT statement but I noticed that the
newly-inserted record is not being returned. When I checked the
database, however, the record is indeed added in the table.
On the other hand, if i don't run the first SELECT request and
initiated an ibase_trans, inserted a record and called ibase_commit,
then the newly-created record is returned when I do a SELECT request.
It seems like Firebird retrieves from its cache eventhough a
transaction has just been committed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36910&edit=1