dotancohen / squeal

Database explorer with a focus on breadth, not depth.
2 stars 0 forks source link

Last row fails when primary keys are not auto_incremented. #10

Open dotancohen opened 10 years ago

dotancohen commented 10 years ago

The last row shown is incorrect in the case where a table has a non-auto_increment primary key, such as if that primary key is a phone number. In these cases, squeal should check if there are any datetime columns or timestamp columns, and if there is exactly one then that column should be sorted on for purpose of last record. If there are more than one then ask the user one which column to sort.

Here is an example of a non-auto_increment primary key:

+-----------------+--------------+------+-----+---------+-------+
| Field           | Type         | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| phone           | char(10)     | NO   | PRI |         |       |

Here is an example of an auto_increment primary key:

+--------------+-------------+------+-----+---------+----------------+
| Field        | Type        | Null | Key | Default | Extra          |
+--------------+-------------+------+-----+---------+----------------+
| id           | int(11)     | NO   | PRI | None    | auto_increment |
dotancohen commented 10 years ago

Depends on Issue #11.