What are the challenges you face when working across database platforms? Take the survey
Options

bug in cuff snippet

JimFJimF Posts: 49 Bronze 3
edited May 19, 2016 4:22PM in SQL Prompt
I just tried the cuff snippet today and I think I found a bug.
/* declare variables */
DECLARE @variable INT

DECLARE $cursor_name$ CURSOR FAST_FORWARD READ_ONLY FOR $select_statement$

OPEN $cursor_name$

FETCH NEXT FROM $cursor_name$ INTO @variable

WHILE @@FETCH_STATUS = 0
BEGIN
    FETCH NEXT FROM $cursor_name$ INTO @variable

    $CURSOR$
END

CLOSE $cursor_name$
DEALLOCATE $cursor_name$

@FETCH_STATUS <> 0). Try this:
/* declare variables */
DECLARE @variable INT

DECLARE $cursor_name$ CURSOR FAST_FORWARD READ_ONLY FOR $select_statement$

OPEN $cursor_name$

FETCH NEXT FROM $cursor_name$ INTO @variable

WHILE @@FETCH_STATUS = 0
BEGIN
    $CURSOR$

    FETCH NEXT FROM $cursor_name$ INTO @variable
END

CLOSE $cursor_name$
DEALLOCATE $cursor_name$

Comments

  • Options
    Hi Jim

    Thanks for posting. You’re absolutely right and moving the $CURSOR$ placeholder as you suggested will fix the issue. We’ll make this change to the default 'curff' snippet in the product for future releases.

    Thanks
    Ali
  • Options
    nate_the_dbanate_the_dba Posts: 6 New member
    This is still not fixed in the current version. Please take a moment to fix it -- it can confuse new DB-Devs and junior DBAs.
  • Options
    Ali DAli D Posts: 56 New member
    Hi

    Thanks for letting us know this is still an issue. We made the fix when the issue was first reported but this change was overwritten during the subsequent overhaul of the snippets manager. We’ll fix the default snippet again and it’ll be in the next release.

    Thanks
    Ali
  • Options
    Ali DAli D Posts: 56 New member
    We’ve just released a new version (v7.2.2) which fixes this issue. If you’ve still got the original (and incorrect) ‘curff’ snippet then it will be updated to the corrected snippet. If you’ve already modified the ‘curff’ snippet in any way then it will not overwrite your changes. New installations of SQL Prompt will use the corrected snippet.

    You can get the latest build by using Check for Updates or by downloading it from here.

    Thanks
    Ali
  • Options
    nate_the_dbanate_the_dba Posts: 6 New member
    Nice! I love how responsive the Redgate team is to user feedback. Keep up the good work! :)
Sign In or Register to comment.