View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
356 | PHPOF2 | Default | public | 5 Jul 2010 15:01 | 24 Nov 2011 21:09 |
Reporter | samadams83 | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 0.12.0 | ||||
Summary | 356: DBRow->store(): Problem inserting row if auto-inc and primary key set | ||||
Description | If 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 Information | if ($this->table->key_auto_increment) { if ($this->primaryKeyFilled() && $this->rowExists()) { $this->update(); } else { $this->insert(); } } else { ... } | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
5 Jul 2010 15:01 | samadams83 | New Issue | |
24 Nov 2011 21:09 | timj | Note Added: 411 |