View Issue Details

IDProjectCategoryView StatusLast Update
356PHPOF2Defaultpublic24 Nov 2011 21:09
Reportersamadams83 Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version0.12.0 
Summary356: DBRow->store(): Problem inserting row if auto-inc and primary key set
DescriptionIf a row's primary key is set, and that field is auto-incrementing, but the row doesn't already exists, it will not be inserted.
e.g.:
1: Empty table with one column `id` which is auto inc and primary key.
2: Populate a row object with id set to '2' and run 'store' function
3: No row was inserted because of this code:
if ($this->table->key_auto_increment) {
    if ($this->primaryKeyFilled()) {
        $this->update();
    } else {
        $this->insert();
    }
} else {
...
}
see additional info for potential solution (just added $this->rowExists() to condition).
Additional Informationif ($this->table->key_auto_increment) {
    if ($this->primaryKeyFilled() && $this->rowExists()) {
        $this->update();
    } else {
        $this->insert();
    }
} else {
...
}
TagsNo tags attached.

Activities

timj

24 Nov 2011 21:09

manager   ~411

If the row is set to auto-increment, surely setting the ID manually should not really be happening?

Issue History

Date Modified Username Field Change
5 Jul 2010 15:01 samadams83 New Issue
24 Nov 2011 21:09 timj Note Added: 411