Bug #11819: Bug with ibase_execute()
| From: | flying at dom dot natm dot ru | Date: | Sun, 01 Jul 2001 08:03:50 +0000 |
| Subject: | Bug #11819: Bug with ibase_execute() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-58596@lists.php.net to get a copy of this message | ||
From: flying@dom.natm.ru
Operating system: Windows 2000
PHP version: 4.0.5
PHP Bug Type: InterBase related
Bug description: Bug with ibase_execute()
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:\db\test.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:\db\test.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:\db\test.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.
--
Edit Bug report at: http://bugs.php.net/?id=11819&edit=1