Access field values of a cursor by field name
---------------------------------------------
Key: CORE-4924
URL: http://tracker.firebirdsql.org/browse/CORE-4924
Project: Firebird Core
Issue Type: New Feature
Affects Versions: 3.0 Beta 2, 2.5.4
Environment: All
Reporter: Jonathan Neve
It would be very useful to be able to access the list of field names of a
cursor and the field values by field name. I am specifically interested in
using this functionality for the new/old cursors from within a trigger (not
sure if they are technically cursors or not...). The idea would be to make it
possible to access the field values in an abstract way, without knowing the
field names, for example, in order to get a list of fields that changed.
Something like this:
create trigger tr_mytable for mytable after update
as
declare variable fname varchar(31);
declare variable ftype integer;
begin
for select rdb$field_name, rdb$field_type from rdb$cursor_fields(:new) into
:fname, :ftype do begin
if (rdb$cursor_field_value(:old) is distinct from
rdb$cursor_field_value(:new)) then
begin
/* the field has changed*/
end
end
end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel