Issue Details (XML | Word | Printable)

Key: CORE-4403
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Adriano dos Santos Fernandes
Reporter: Dmitry Yemanov
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Allow referencing cursors as record variables in PSQL

Created: 24/Apr/14 02:52 PM   Updated: 01/Jun/15 06:01 PM
Component/s: Engine
Affects Version/s: None
Fix Version/s: 3.0 Beta 1

Issue Links:
Duplicate
 

QA Status: Done successfully


 Description  « Hide
Either explicit (DECLARE AS CURSOR) or implicit (FOR SELECT) PSQL cursors could make their current record available via the cursor name similar to OLD/NEW trigger contexts, thus making the INTO clause optional. In FOR SELECT loops, it requires AS CURSOR clause to be specified. For example:

for
  select rdb$relation_id as id, rdb$relation_name as name
  from rdb$relations
  where rdb$view_blr is null
  as cursor tables
do begin
  out_id = tables.id;
  out_name = tables.name;
  suspend;
end

To avoid ambiguities, the colon prefix could be used.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Zotov added a comment - 24/May/14 08:03 PM
It will be useful to implement ability to reference record variable via cursor like this:

execute block as
begin
  for
    select id, x from t1 as cursor c1
  do begin
    for select id, x from t2 where x = :c1.x as cursor c2 do
    begin
          /* . . . */
    end
  end
end

Currently this leads to error: "column unknown C1.X"

Adriano dos Santos Fernandes added a comment - 26/May/14 03:36 PM
I'll check it.

Adriano dos Santos Fernandes added a comment - 26/May/14 11:10 PM
Please test the fix.

Pavel Zotov added a comment - 27/May/14 11:24 AM
Checked on LI-T6.3.0.31152. Seems that OK.