Home » Database » DB_DataObject » Bug #547
Does't work properly with primary key on two fields
Details
| Submitted | 2004-01-08 14:11 UTC |
|---|---|
| From | michal at a1 dot pl |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | Irrelevant |
| OS | Linux & Windows XP |
| Roadmaps | (Not assigned) |
Comments
[2004-01-08 14:11 UTC] michal at a1 dot pl
Description:
------------
DB_DataObject 1.4 does not work properly with tables which have primary key based on two fields, such as the following one:
CREATE TABLE `page_module` (
`page_id` mediumint(8) unsigned NOT NULL default '0',
`module_id` mediumint(8) unsigned NOT NULL default '0',
`place` tinyint(3) unsigned NOT NULL default '0',
`title` varchar(50) NOT NULL default '',
`position` varchar(10) NOT NULL default 'top',
PRIMARY KEY (`page_id`,`module_id`)
) TYPE=MyISAM;
However it worked well with such tables, at least in version 1.2. Removing key definition for 'page_module' table from db.ini file would also work, but would cause other problems.
Reproduce code:
---------------
$page_module=&new Model_Page_module;
$page_module->page_id=1;
$page_module->module_id=1;
$page_module->position='top';
$page_module->insert();
Expected result:
----------------
DB_DataObject should execute the following code:
INSERT INTO page_module (page_id, module_id, position) VALUES (1,1,'top')
Actual result:
--------------
DB_DataObject executes the following code:
INSERT INTO page_module (module_id, position) VALUES (1,'top')