Subject | Re: Cursors |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-07-27T10:05:14Z |
> The Application schould manage a running competitionShould this be a Web application or Swing application (I assume Swing)?
> (www.windberglauf.de) and there ate some Tables for the
> appointments, the results, etc. (Its my first bigger Project and my
> first Java Project with a Database)
> My mayor Problem is to build a living table-model.Here's the sketch of the solution without scrollable/updatable cursors.
> It should contain the formated Data of a Database and the Data
> should be updateable through the Table.
Usually your table contains a primary key (something like record ID).
If you don't have such key (which is most likely a database design
error), you can use RDB$DB_KEY field (it exists in each table, it is a
unique row identifier).
So, each your SELECT statement should contain reference to this
primary key, something like
SELECT user_id, first_name, last_name, age from users_table
Your table model does not show the first column to the user (or you
can show it, however you should disable editing for this column).
Then you read your table data into memory and allow scrolling there.
If size of result set is very big, you can read only its part using
SELECT FIRST n SKIP m syntax.
When somebody updates or deletes record, you execute corresponding
UPDATE or DELETE statement with the ID of the user to update:
UPDATE users_table
SET
first_name = ?,
last_name = ?
WHERE
user_id = ?
or
DELETE FROM users_table WHERE user_id = ?
After updating or deleting the record you should re-read your visible
part of the result set.
> Also you should can insert new Data.This task is performed by simple INSERT command. Only be sure that you
re-read the visibl part of the result set.
Hope this helps.
BTW, did you consider using Borland Delphi or C++ Builder for it?
There are components that emulate cursor scrolling on the client side.
Best regards,
Roman Rokytskyy