← Back to team overview

maria-developers team mailing list archive

Re: MDEV-10598 - bb-10.2-compatibility

 

Hello Jerome,


On 02/27/2017 11:39 PM, jerome brauge wrote:
> Hello Alexander,
> Thanks for the explanation.
> It's something we do not use. I did not think about it.
> I look forward to your patch.

I pushed these tasks:

MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR LOOP
MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop
MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarations
MDEV-12133 sql_mode=ORACLE: table%ROWTYPE in variable declarations

Please clone the branch again.
Git pull will not work, because I recently rebased bb-10.2-compatibility
on top of the latest 10.2.


When implementing cursor%ROWTYPE, I had your patch in mind and made
some refactoring to help us apply MDEV-10598 easier.
Please see a comment to MDEV-12011 in "git log".


Now the tricky thing (when adding your patch) is to make sure that
this work fine:

CREATE PROCEDURE p1
AS
  a INT:=10;
  CURSOR cur1 IS SELECT a;
  rec1 cur1%ROWTYPE;
  CURSOR cur2 IS SELECT rec1.a;
  rec2 cur2%ROWTYPE;
BEGIN
  OPEN cur2;
  FETCH cur2 INTO rec2;
  CLOSE cur2;
  SELECT rec2.a;
END;


I.e. a set of intermixed CURSOR and cursor%ROWTYPE variable
declarations referencing each other recursively.


Thanks.

> 
> Regards,
> Jérôme.
> 
>> -----Message d'origine-----
>> De : Alexander Barkov [mailto:bar@xxxxxxxxxxx]
>> Envoyé : lundi 27 février 2017 11:28
>> À : jerome brauge
>> Cc : maria-developers
>> Objet : Re: MDEV-10598 - bb-10.2-compatibility
>>
>> Hello Jerome,
>>
>>
>> On 02/21/2017 07:18 PM, jerome brauge wrote:
>>> Hello Alexander,
>>> I've done this patch for MDEV-10598.
>>> Can you review it ?
>>
>> It seems we'll have to postpone this patch.
>>
>> I'm currently working on:
>>
>> MDEV-10598 Variable declarations can go after cursor declarations
>> MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarations
>> So the trick with postponing variable declarations using a temporary list might
>> not work properly after adding MDEV-10598 abd MDEV-12011, the order of
>> cursors and variables is important.
>>
>> Example:
>>
>> DECLARE
>>   CURSOR cur1 IS SELECT a,b FROM t1;
>>   v cur1%ROWTYPE;
>>   CURSOR cur2 IS SELECT v.a, v.b FROM DUAL; BEGIN
>>   ...
>> END;
>>
>>
>> So the order of cur1, v and cur2 is important.
>>
>> I'll let you known when I'm ready with %ROWTYPE tasks.
>>
>> Thanks!
>>
>>
>>>
>>> Regards,
>>> Jérôme.
>>>


Follow ups

References