[Lazarus] newbie question: tsqlquery; primarykey; insert.

Kovács László info at kovacsoltvideo.hu
Tue Nov 26 16:02:29 CET 2013


Hi dear list members.

I'm new here. Approximately 17 years ago I worked as a sysadmin, gave 
every day support for 70 peoples how to use their computers. I also made 
numerous small apps, to help the work of the firm. That time I did it 
with Delphi 1, used DBase and Paradox tables.
I did this job for a few years, then the life pushed me away from 
programming, but not too far away from computers.
Now I'm here, and seem to come back.
My friend wants me to create a database app, because the task is just 
too complicated to do by himself in MS Access.

I put my cents on Lazarus, as I can't afford any Delphi (and like) 
available today.
I choosed Firebird (a very cost effective solution as well) as database 
engine, started with embedded, but later when as development progresses 
need move to real client-server.

So, I created my database, that wasn't too hard with IBExpert personal 
(I had to look for something to substitute Database desktop).
I also managed to create my autoinc fields, using Firebirds triggers and 
generators. Each of my tables has its own counters.

But I'm stuck with getting the newly inserted rows ID.
How do you get it?

Or if you generate the ID on the client side, how do you make absolutely 
sure, no other user can get the same ID.

Is there a way to ask Firebird about the next value of a generator? And 
then I could use that ID upon an insert, and would deactivate the 
triggers.

If I'm on a wrong way with this ID thing, any other "Best practices" are 
welcome. ;)

I highly appreciate every help word!

Thank you very much in advance

Laszlo Kovacs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131126/79dbe6dd/attachment-0002.html>


More information about the Lazarus mailing list