jatpat / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

TIMESTAMP field set inconsistently using CURRENT_TIMESTAMP #245

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create table t(id INTEGER,dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
2.insert row with id value 1, dt value CURRENT_TIMESTAMP
3.dt is now set to 'CURRENT_TIMESTAMP'

What is the expected output? What do you see instead?

dt should have a proper timestamp, like 2014-02-07 16:06:03

What version of the product are you using? On what operating system? Which
Database Extension (PDO/SQLiteDatabase/SQLiteDatabase3 - see Database
structure-tab in phpLiteAdmin)?

Version 1.9.5. Windows 7

Please provide any additional information below.

This *does* work using the Insert option.

Fails to work if a row is edited and saved as a new row.

Original issue reported on code.google.com by ahn...@gmail.com on 7 Feb 2014 at 4:18

GoogleCodeExporter commented 9 years ago
Thanks for reporting, I can confirm this.
It works using insert (as you say), but not using "insert as a new row" from 
edit.

Note that when fixing this, it should not only work with CURRENT_TIMESTAMP but 
any default value that is not a string.

Original comment by crazy4ch...@gmail.com on 7 Feb 2014 at 4:58

GoogleCodeExporter commented 9 years ago
Okay, when we fix this, we should really remove the redundant code here. There 
are 2 places where rows are created which do almost exactly the same thing.
1. action "row_edit"  if(isset($_POST['new_row'])
2. action "row_create"

Probably time to move actions into methods because currently it is not easy to 
trigger the 2nd action from the first one.

Original comment by crazy4ch...@gmail.com on 7 Feb 2014 at 5:10

GoogleCodeExporter commented 9 years ago
Fixed this with revision a09c27fe026f0431771ffc2ebddb46956e52c0ee.
Unfortunately not enough time to remove the redundancy now, so I more or less 
copied the code from "insert" to "insert as new" so it behaves the same way.

Original comment by crazy4ch...@gmail.com on 28 Dec 2014 at 2:49