[fpc-pascal] How to insert a record and get the primary key with sqldb?
Graeme Geldenhuys
graemeg.lists at gmail.com
Mon Oct 24 12:49:58 CEST 2011
On 2011-10-24 12:40, Marcos Douglas wrote:
>
> GUID isn't the key, but a way to know how get the register before insert it.
In our case we use the actual GUID value as the actual primary key. The
GUID is unique in our database and across multiple databases. This is
very important to us, because we merge multiple databases (250+) into
one large database on a monthly basis for data analysis and statistics.
eg: Here is a insert statement our application would have generated.
INSERT INTO ADDRESS (OID, OWNER_OID, ADDRESSTYPE_OID, LINES, CITY,
PROVINCE, POSTCODE, COUNTRY_OID) VALUES
('CDB0C8A3-8AB7-42E9-BC12-6C3B48A3EEB0',
'FCE0EB83-9DED-4DEA-92A2-60504A8C2912',
'C30AE79B-CD60-49D1-AB4C-76C8BD08AC7E', 'PO BOX 2617', 'SOMERSETWEST',
'', '7129', 'ZA');
We also use the actual data fields for things like sorting, filtering
etc., not the primary key. The end-user will never ever see the GUID in
the application UI.
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the fpc-pascal
mailing list