Bug #11819 Updated: Bug with ibase_execute()
| From: | flying at dom dot natm dot ru | Date: | Fri, 06 Jul 2001 10:13:44 +0000 |
| Subject: | Bug #11819 Updated: Bug with ibase_execute() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-59071@lists.php.net to get a copy of this message | ||
ID: 11819
User Update by: flying@dom.natm.ru
Status: Bogus
Bug Type: InterBase related
Operating system: Windows 2000
PHP Version: 4.0.6
Description: Bug with ibase_execute()
Look at PHP scripts, I was posted, one more time. You'll see, that this warning was
disappeared, when PHP (!) code was changed (note, nothing else, just PHP code!). And one more
thing: all other programs doesn't cause this warning to appear in the same situation. So, as I
said before, it seems, that PHP itself hadles this situation incorrectly (maybe wrong parameters are
passed to InterBase or something else). And problem is still exists, even into 4.0.6
Previous Comments:
---------------------------------------------------------------------------
[2001-07-01 06:57:03] derick@php.net
This is not a PHP bug. Interbase gives you a warning, and not PHP. (PHP merely shows the warning for
you).
Derick
---------------------------------------------------------------------------
[2001-07-01 04:03:50] flying@dom.natm.ru
Environment:
- Windows 2000 Server
- Apache v1.3.20 (binaries from www.apache.org)
- PHP v4.0.5 (binaries from www.php.net)
- InterBase v6.0.0.627 (binaries from www.borland.com)
1. Create very simple database:
-----------------------------------------------------------------
CREATE DATABASE 'c:dbtest.gdb'
USER 'user' PASSWORD 'password';
CREATE TABLE TABLE_1 (
ID_1 INTEGER NOT NULL);
CREATE TABLE TABLE_2 (
ID_2 INTEGER NOT NULL,
FK INTEGER);
ALTER TABLE TABLE_1 ADD CONSTRAINT PK_1 PRIMARY KEY (ID_1);
ALTER TABLE TABLE_2 ADD CONSTRAINT PK_2 PRIMARY KEY (ID_2);
ALTER TABLE TABLE_2 ADD CONSTRAINT FK_2_1 FOREIGN KEY (FK) REFERENCES TABLE_1 (ID_1);
COMMIT WORK;
-----------------------------------------------------------------
2. Create very simple PHP script:
-----------------------------------------------------------------
<?php
$ib = ibase_connect('c:dbtest.gdb','user','password');
$query = ibase_prepare($ib,'insert into TABLE_2(ID_2, FK) values (?, ?)');
$rs = ibase_execute($query,1,null);
ibase_close($ib);
?>
-----------------------------------------------------------------
3. Run it and look at the following error:
-----------------------------------------------------------------
Warning: InterBase: violation of FOREIGN KEY constraint "FK_2_1" on table
"TABLE_2" in test.php on line 5
-----------------------------------------------------------------
Note, that if we'll insert non-NULL value into TABLE_2.FK, then all will work fine.
4. Rewire our PHP script slightly:
-----------------------------------------------------------------
<?php
$ib = ibase_connect('c:dbtest.gdb','user','password');
$query = ibase_query($ib,"insert into TABLE_2(ID_2, FK) values (1,null)");
ibase_close($ib);
?>
-----------------------------------------------------------------
5. Run it and note, that all works fine!
So, there is a serious bug into ibase_execute() function, which prevents first version of
PHP script from working properly.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=11819