PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #274

insert will not set primary key value

Details

Submitted2003-11-19 13:20 UTC
Fromalexander dot schilling at med dot uni-tuebingen dot de
StatusBogus
PackageDB_DataObject
PHP Version4.3.1
OSLinux
Roadmaps(Not assigned)

Comments

[2003-11-19 13:20 UTC] alexander dot schilling at med dot uni-tuebingen dot de

Description:
------------
SInce upgrade from DBO 1.2 to 1.3 insert statements for the mysql DB will miss the primary key element.
The value is set correctly in the DBO (made a dump) before using DBO->insert() but the resulting sql statement missed the primary key column.
I had a look into the DataObject.php->insert() sunction and found that it is not set because $tryAutoIncrement is set to TRUE. But my primary key column is no auto_increment field, it's a varchar field.

What can I do?

Reproduce code:
---------------
mysql table
==========
PRI name varchar(32) NOT NULL
description varchar(255) NOT NULL
other fields...

$dbo->name = 'test';
$dbo->description = 'any text';
$dbo->insert();

Expected result:
----------------
name | description
------------------------------
'test' | 'any text'

Actual result:
--------------
name | description
------------------------------
| 'any text'

[2003-11-19 14:29 UTC] alexander dot schilling at med dot uni-tuebingen dot de

thanks, that will do it