[Lazarus] Postgres database again...

Graeme Geldenhuys graemeg.lists at gmail.com
Tue May 27 10:57:02 CEST 2008


Dave Coventry wrote:
> Damien,
> 
> Thanks for the reply.
> 
> The situation is getting pretty urgent.
> 
> What I'm doing is this:
> The user enters in preliminary information which creates a sequential
> partial record in the database using nextval(''reg_seq'').
> 
> Further information is added to the record later.
> 
> What I need is to populate my form with the fields from the database.
> 
> I need to access the number of the record assigned by
> nextval(''reg_seq''), and then I need to get the fields from the
> record to place in edit boxes so that the user can update them....

I would highly recommend you use GUID's for the unique row identifier. 
It will even be unique across all tables in the database as well.

Pros:
  * You know the ID before you even do the insert.
  * No extra round trips to the database to retrieve the ID
  * Unique ID in the table and across the whole database.
  * Easy to implement
  * Works on all database servers (char(36) to store the GUID)
  * Works great with many concurrent users working on the same table.

Cons:
  * Yes it's longer than an Integer type and uses more space, but with 
today's hard drive sizes that is totally irrelevant.



Regards,
   - Graeme -


_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list