[fpc-pascal] Re: How to insert a record and get the primary keywith sqldb?

Ludo Brands ludo.brands at free.fr
Mon Oct 24 15:15:25 CEST 2011


> > Summary:
> > 1. A lot of (or some) people don't like GUID PKs
> > 2. Some (or a lot of) people do.
> >
> > Regardless of being in camp 1 or 2, I think FPC should 
> recognize that 
> > both 1. and 2. are used in practice. Of course, if developers don't 
> > want to contribute code to support 2, that remains there 
> prerogative 
> > ;)
> 
> We will of course support GUID PKs, although in my opinion, 
> there is precious little to support as it will in general be 
> client code that generates the GUID (unless I am much 
> mistaken in what is common 
> practise) ?
> 

Most databases have functions to create GUID's (with different randomness
quality and different storage requirements):

SQLServer: NEWID()
MySQL: uuid()
Oracle:SYS_GUID()

Using these functions has the same problems as sequences: retrieve the key. 

Sqldb is missing ftguid support for most databases leaving the user with the
conversion to TGUID. Fe Oracle returns GUID's as RAW(32) and mysql as
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

Ludo




More information about the fpc-pascal mailing list