[Lazarus] Returning value from a Firebird (embedded) generator into Lazarus code
brian
brian at meadows.pair.com
Sat Apr 25 16:52:21 CEST 2015
On Sat, 25 Apr 2015 14:12:44 +0000, you wrote:
>brian wrote:
>> Hi folks,
>>
>> Can someone please give me a hint with this problem. I'm new to
>> Firebird, but I needed a database which could be used in embedded
>> fashion, and seemed to have a choice of one under Linux.
>>
>> What I need to do is to return a value generated by a Firebird
>> generator into my Pascal code. Doing it what seemed to me to be the
>> obvious way returns zero rows, do I need to update an interim table
>> and then query that table? Or is there some other method which I've
>> missed?
>
>Embedded in what way? I use Firebird on occasion as an alternative to
>PostgreSQL (i.e. in a client-server scenario), but I'd have thought for
>a single-system application SQLite would have been worth a look.
>
Embedded as in there is no requirement for the user to do anything
except unpack a zip file and run the executable. No installation of
any kind of server on the host system.
>Having said that, apart from Firebird's poor documentation I've had no
>significant problem querying and updating tables. What exactly are you
>trying to do?
>
Retrieve a value generated by a Firebird generator (in other words, an
autoincremented value stored within the database) and get that
incremented value into a Pascal variable. The SQL code to increment
the value in the Firebird database is
SELECT (<generator>,<increment>) FROM RDB$DATABASE;
but I'm struggling to find a way to retrieve that incremented value.
Simply attaching a data source to the query returns zero rows when the
SQL is executed. I'm wondering whether I need to use a dummy table and
then use the generator to update a field, then retrieve the data with
a separate query.
Brian.
More information about the Lazarus
mailing list