 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Improper formatting of nested IF statements |
|
The following definition for formatting IF statements has problems formatting nested IFs properly:
Formatting def for IF BEGIN...ELSE:
 |
 |
IF ...
AND ...
OR ...
BEGIN
<stmtList>
END
ELSE
BEGIN
<stmtList>
END
|
Also, there's another formatting definition for simple IF:
 |
 |
IF ...
AND ...
OR ...
...
ELSE
...
|
Code to be formatted:
 |
 |
IF OBJECT_ID('dbo.sp_nyomvonal_tetel_atvetel') IS NOT NULL
BEGIN
PRINT 'DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel'
DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel
IF @@ERROR = 0
PRINT 'PROCEDURE dbo.sp_nyomvonal_tetel_atvetel dropped'
END
|
The desired result:
 |
 |
IF OBJECT_ID('dbo.sp_nyomvonal_tetel_atvetel') IS NOT NULL
BEGIN
PRINT 'DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel'
DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel
IF @@ERROR = 0
PRINT 'PROCEDURE dbo.sp_nyomvonal_tetel_atvetel dropped'
END
|
Actual esult:
 |
 |
IF OBJECT_ID('dbo.sp_nyomvonal_tetel_atvetel') IS NOT NULL
BEGIN
PRINT 'DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel'
DROP PROCEDURE dbo.sp_nyomvonal_tetel_atvetel
IF @@ERROR = 0 PRINT 'PROCEDURE dbo.sp_nyomvonal_tetel_atvetel dropped'
END
|
with the closing END misaligned.
The inner if should be transformed from:
 |
 |
IF @@ERROR = 0 PRINT 'PROCEDURE dbo.sp_nyomvonal_tetel_atvetel dropped'
|
into
 |
 |
IF @@ERROR = 0
PRINT 'PROCEDURE dbo.sp_nyomvonal_tetel_atvetel dropped'
|
as well, but it isn't. This latter might be the result of an incorrect definition for simple IFs but the former should definitely work. Actually, they both should, at least they did so in the previous version (if I recall correctly). It seems that something has been broken.
|
|
Thu Jun 14, 2012 9:14 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you. I can reproduce the same results. We will look into that.
|
|
Thu Jun 14, 2012 10:30 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Seems to be fixed in 6.2.112, thank you very much!
|
|
Fri Jun 22, 2012 4:27 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|