On Mon, 7 Mar 2011, Graeme Geldenhuys wrote:
On 7 March 2011 18:33, <michael.vancanneyt@*****wrote:
But for getting the next value of a generator you don't need a stored
procedure.
Just do a
SELECT gen_id(StaffelNr_GEN, 1) AS THEID FROM RDB$DATABASE;
As an alternative:
Or even easier, generate a GUID in your application, and simply assign
it as the primary key to whatever record. ;-) One less query to the
database, you know the primary key before the data is saved (great for
master-detail records), and it is guaranteed to be unique, even across
tables and across databases.
Correct. (well, not 100%, because GUIDs are never guaranteed to be unique,
however, the possibility that 2 of them are the same is very small indeed).
A noticeable downside is that indexes are WAY bigger, and the queries joining
different tables are slower, and you loose the order of creation of records.
Michael.
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus