pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Reiser <florian.reiser@ra-bc.de>
To: pgsql-sql@postgresql.org
Subject: Re: Moving around in a SQL database
Date: Fri, 21 Apr 2006 09:00:05 +0200
Message-ID: <e2a034$1atq$1@news.hub.org> (raw)
References: <1145533472.685669.176210@i39g2000cwa.googlegroups.com>
	<e27v66$2jvn$1@news.hub.org>
	<1145601779.703719.62700@i40g2000cwc.googlegroups.com>

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 Grüssen

Florian Reiser

-- 
http://www.ra-bc.de
RA Unternehmensberatung
Führen durch präzise Daten

"WillemF" <jwhferguson@zoology.up.ac.za> schrieb im Newsbeitrag 
news:1145601779.703719.62700@i40g2000cwc.googlegroups.com...
> 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.
> 





view thread (3+ messages)  latest in thread

Message-ID: <e2a034$1atq$1@news.hub.org>
Permalink:  ../e2a034$1atq$1@news.hub.org/
Also on:    postgresql.org/message-id/e2a034$1atq$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: florian.reiser@ra-bc.de
  Subject: Re: Moving around in a SQL database
  In-Reply-To: <e2a034$1atq$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox