placing a new row (from dataprovider.appendrow) at the end of the table

Howdy,

Is there a way to always append a row to the end of a table, if we cannot guarantee that its ID will be greater than all existing IDs (in otherwords, we cant simply rely on ordering the rows by ID)?

Our database is generating the IDs for us, rather than the app we're developing. This means rows created viadataprovider.appendRow() only *usually* appear at the end. This would confuse most of the users the app is aimed towards.

Thanks,

Tristan

[491 byte] By [apersona] at [2007-11-26 14:53:51]
# 1

Hi There,

Im not sure I understand your question.

Maybe one way of making sure the row is always appeneded to the end of the table is to use time stamp also as primary key, if ID alone is not sufficient.

If this is not what you are looking for, please explian in more detail.

Thanks

K

kish@suna at 2007-7-8 8:42:14 > top of Java-index,Development Tools,Java Tools...
# 2

You coud try to append ORDER BY <<column>> at the end of the sql statement. This way you control the order the rows are shown.

For example:

SELECT first_name, last_name

FROM customer

ORDER BY id;

Usually, we can indeed rely on the database generated ID (the database documentation will clarify this one.)

In case you can磘 rely on the generated ID you can add a timestamp to the table and then make the ordering by this column.

For example, having the following table

CREATE TABLE customer(

ID serial,

first_name varchar(50),

lastname varchar(50),

added timestamp DEFAULT current_timestamp);

order by added

SELECT first_name, last_name

FROM customer

ORDER BY added;

Victor_Munoza at 2007-7-8 8:42:14 > top of Java-index,Development Tools,Java Tools...