AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need a way to maintain sorted records for long periods of ti

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
runescience
Guest





PostPosted: Mon Jan 30, 2006 1:55 pm    Post subject: Need a way to maintain sorted records for long periods of ti Reply with quote



Hi Folks. I have a large number of records that are deliverd for web
view.
This may sound a bit wierd but its a user requirement.

I will have 100,000 records for view to the user. Currently I send
records to a temp tableand view them in a web page in java. There I use
the "<< < 1 2 3 4 5... 99 100 > >>" method at the bottom of the
page to allow the user to view the chunks.

select * from tablename where rowid > first chunk and rowid < next
chunk.

Now the user wishes to do a sort on up to 3 columns. This ruins my old
method of doing things. I cant scroll out chunks, because a select (
Select * from table name order by col8, col6, col3 ) does not reorder
the rowid.

So, then I thought of doing a 'Select into' a new temp table. But,
then I have to keep track of the new temp table name each time. I read
some where, and I hope its correct, that when you create a temp table
any new records are stored in order of the select into.

Every time the user chooses a new way to sort the data from the web
page, I think I should create a new Temptable, unless there is some way
to update the rowid on the original table. The sorted data order must
be maintailed over multiple sessions. there will be only one user, but
when he is done with this I can ditch the temp table till he creates
new data.


Im not sure this is the way to go. But, I need to finish it soon.
Suggestions? solutions?

Back to top
Dhannya
Guest





PostPosted: Mon Jan 30, 2006 2:31 pm    Post subject: Re: Need a way to maintain sorted records for long periods o Reply with quote



Can we access rowid in Sybase?

Back to top
runescience
Guest





PostPosted: Mon Jan 30, 2006 2:51 pm    Post subject: Re: Need a way to maintain sorted records for long periods o Reply with quote



i think so we can, i am using sybase IQ 12.

Back to top
runescience
Guest





PostPosted: Mon Jan 30, 2006 3:02 pm    Post subject: Re: Need a way to maintain sorted records for long periods o Reply with quote

How would a scrollable cursor help here?

I would hae to make a new cursor each time for each time the sort is
re-done.

The cursor is not persistant from java session to java session, I think
I would have to resort them each time.

I need to have the rowID updated into a new temp table each time.

Am I missing something? could you maybe re-read the original post?

Back to top
Michael Peppler
Guest





PostPosted: Mon Jan 30, 2006 4:48 pm    Post subject: Re: Need a way to maintain sorted records for long periods o Reply with quote

On Mon, 30 Jan 2006 05:55:34 -0800, runescience wrote:

Quote:
Hi Folks. I have a large number of records that are deliverd for web view.
This may sound a bit wierd but its a user requirement.

I will have 100,000 records for view to the user. Currently I send records
to a temp tableand view them in a web page in java. There I use the "
1 2 3 4 5... 99 100 > >>" method at the bottom of the page to allow
the user to view the chunks.

select * from tablename where rowid > first chunk and rowid < next chunk.

Now the user wishes to do a sort on up to 3 columns. This ruins my old
method of doing things. I cant scroll out chunks, because a select (
Select * from table name order by col8, col6, col3 ) does not reorder the
rowid.

So, then I thought of doing a 'Select into' a new temp table. But, then I
have to keep track of the new temp table name each time. I read some
where, and I hope its correct, that when you create a temp table any new
records are stored in order of the select into.

I would use a secondary table that only has the original row id (or
identity value) for the row, and a second column that has the row id for
the sorted data. Creating this second table should be pretty fast, and you
can then do the retrieves based on the two tables (a simple join with an
order by on the second table's row id).

You can also simplify your code by always using the two table method. For
the original sort you simply have the secondary table with identical
column values.

Michael
--
Michael Peppler [TeamSybase] [email]mpeppler (AT) peppler (DOT) org[/email] - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.