| Sebastian Ganschow 2005-10-23, 6:57 pm |
| Hi,
we've got a Problem with getting an id when we call $do->insert().
The Dataobject is configured with ignore_sequence_keys = ALL and the field
id in the table is set as auto_increment. Normaly the method insert should
return the key, which was set to the dataset, but it returns true.
I've locked at the source code of Dataobject and in the method
getSequenceKey()
on line 1944 if found this block:
if (!empty($_DB_DATAOBJECT['CONFIG']['ignor
e_sequence_keys'])) {
$ignore = $_DB_DATAOBJECT['CONFIG']['ignore_sequen
ce_keys'];
if (is_string($ignore) && (strtoupper($ignore) == 'ALL')) {
return
$_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] =
array(false,false,$seqname);
}
if (is_string($ignore)) {
$ignore =
$_DB_DATAOBJECT['CONFIG']['ignore_sequen
ce_keys'] = explode(',',$ignore);
}
if (in_array($this->__table,$ignore)) {
return
$_DB_DATAOBJECT['SEQUENCE'][$this->_database][$this->__table] =
array(false,false,$seqname);
}
}
The array which is returned by getSequenceKey contains the information,
if the native
key should be used at index 1. Here it is set to false, so the insert
method doesn't use
the key return by the Database. If I change array(false,false,$seqname)
into
array($usekey,true,$seqname) I get the key from the insert method.
So is this a bug or do I have an error in my configuration?
Thanks,
Sebastian
|