PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject_FormBuilder » Bug #848

Generator.php not null fields wrong keys generation

Details

Submitted2004-02-24 14:31 UTC
Fromxserg at xserg dot ru
StatusDuplicate
PackageDB_DataObject_FormBuilder
PHP Version4.3.4
OSFreeBSD 5.1
Roadmaps(Not assigned)

Comments

[2004-02-24 14:31 UTC] xserg at xserg dot ru

Description:
------------
I have upgrade DB_dataobject to 1.5.3 from 1.3
And my scripts dont work correct because of changing shema file: 1 is turn to 129, 2 to 130

When auto building database shema file, it write this:

[aliases]
id = 129
pid = 129
type = 130
name = 130

[aliases__keys]
id = N

where class file loks like:

class DBO_Aliases extends DB_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */

var $__table = 'aliases'; // table name
var $id; // int(10) not_null primary_key unsigned auto_increment
var $pid; // int(11) not_null multiple_key
var $type; // string(64) not_null
var $name; // string(255) not_null
.....

I have seen source of Generator.php and found that

if (preg_match('/not_null/i',$t->flags)) {
$type += DB_DATAOBJECT_NOTNULL;
}

DB_DATAOBJECT_NOTNULL = 128

Reproduce code:
---------------
if (preg_match('/not_null/i',$t->flags)) {
$type += DB_DATAOBJECT_NOTNULL;
}

Why it is so?

[2004-02-24 14:52 UTC] xserg at xserg dot ru

DB_DATAOBJECT_NOTNULL = 128

is defined in Dataobject.php