From: | "Florian Reiser" <florian(dot)reiser(at)ra-bc(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Moving around in a SQL database |
Date: | 2006-04-21 07:00:05 |
Message-ID: | e2a034$1atq$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello Willem,
you are writing an edit mask?
Then do the following. Feed the mask with the data from the record.
If the user changes anything and presses the save button, then issue an
UPDATE .... WHERE ID=<id> to the database.
Always remember: you are working with a database, not with a dbf-file.
If your transaction fails because of power outage or anything else,
postgresql will revert to the consistent state before that transaction.
If you want to batch update the records, then do a
BEGIN TRANSACTION
SELECT .... FOR UPDATE.
After that collect the data you want to change.
Then issue your update statements.
After that do a
COMMIT TRANSACTION.
If anything fails between BEGIN and COMMIT TRANSACTION
all changes will be reverted to the state before the transaction.
With kind regards
Mit freundlichen Grssen
Florian Reiser
--
http://www.ra-bc.de
RA Unternehmensberatung
Fhren durch przise Daten
"WillemF" <jwhferguson(at)zoology(dot)up(dot)ac(dot)za> schrieb im Newsbeitrag
news:1145601779(dot)703719(dot)62700(at)i40g2000cwc(dot)googlegroups(dot)com(dot)(dot)(dot)
> Thank you very much for your reply, Florian. It's probably the best
> that one can do. I have two complicating factors. Firstly, I need to
> udate the records one at a time and, secondly, I am accessing the table
> via a Java front end through JDBC. Loading all the data into memory
> opens the possibility for data corruption since, if anything goes wrong
> on the computer or power supply, there is no guarantee that all updates
> will have been written to file. Writing each update to file upon
> accessing each record again requires working with the whole table when
> manipulating a single record. The use of cursors is an elegant solution
> with the drawback that updates cannot be performed (that is, if I
> unerstand the documentation correctly!). Thank you very much for your
> time. Kind regards. Willem.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Haumer | 2006-04-21 11:58:34 | Porting application with rules and triggers from PG 7.4.x to 8.1.3 |
Previous Message | Tom Lane | 2006-04-20 16:20:34 | Re: At time zone madness! |