|
Viewing Bug Advanced Details |
[ Jump to Bugnotes ]
[ Bug History ]
[ Print ]
|
|
ID |
Category |
Severity |
Reproducibility |
Date Submitted |
Last Update |
|
0000555 |
core / field option |
major |
always |
2008-09-15 17:55 |
2008-09-15 17:55 |
|
|
|
Reporter |
genio |
View Status |
public |
|
|
Assigned To |
|
|
Priority |
normal |
Resolution |
open |
Platform |
any |
|
Status |
new |
Duplicate ID |
|
OS |
any |
|
Projection |
none |
|
Version |
any |
|
ETA |
none |
|
Product Version |
5.6 (stable) |
|
|
Product Build |
|
|
|
Votes |
1 |
|
|
|
Summary |
CHangelog keycol 0 on auto increment |
|
Description |
Seems like that the changelog function which inserts the colum id when inserting a new row sends 0 when the id is set to autoinrement. This in theory is not wrong as on the form if you set an ID field as autoincrement, it will be 0, and the DB interprets that to be changed to the next available number in a id key field.
However, for the purpose of the change log, this is incorrect.
You currently use;
$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($key_col_val), addslashes(serialize($newvals)));
but in fact should be
$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($this->rec), addslashes(serialize($newvals)));
as this guarantees that the correct field is used, either if in uatoincrement mode, or if the user has assigned itself the id |
|
Steps To Reproduce |
Always, set an autoincremnt ID, add a new row, changelog will report the id as 0 |
|
Additional Information / Solution |
trevial fix, but quite a tricky one as I see numerous posts that have this issue |
|
Attached Files |
|
|
|
|
There are no notes attached to this bug. |
|
|