SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Formatting issues

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Formatting issues
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Formatting issues Reply with quote
Given is the following code fragment:
Code:

CREATE DATABASE database_name ON ((NAME = logical_file_name1 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB) ,(NAME = logical_file_name2 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB)) LOG ON ((NAME = logical_file_name3 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB))


and the following two formatting rule:
#1 (...)
Code:

(
    ...
   ,...
    AND ...
    OR  ...
)


#2 create database
Code:

CREATE DATABASE ... ON
(
    (NAME = ... ,FILENAME = ... ,FILEGROWTH = ...)
    ,...
)
LOG ON (
    (NAME = ... ,FILENAME = ... ,FILEGROWTH = ...)
    ,...
)
COLLATE ...


Other formatting settings (in case they're relevant) are set as:
Line Length for Code Wrapping = 230
Line Length for DDL Code Wrapping = 120
Name Length for Aligning = 96


When both rules are enabled, the formatted result is:
Code:

CREATE DATABASE database_name ON
(
    (
        NAME       = logical_file_name1 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB)
        ,(NAME     = logical_file_name2 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB)
)
LOG ON (
    (
    NAME = logical_file_name3 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB)
)

and according to rule #2 this is obviously not what I want.

When rule #2 is disabled, formatting the code makes no changes to it. That's kind of expected.

When rule #1 is disabled, formatting the code results in code loss!!! The second file (logical_file_name2) is formatted into oblivion!
Code:

CREATE DATABASE database_name ON

(
    ( NAME = logical_file_name1
    ,FILENAME = 'os_file_name'
    ,FILEGROWTH = 10 MB
)
)LOG ON ((NAME = logical_file_name3 ,FILENAME = 'os_file_name' ,FILEGROWTH = 10 MB))


Changing the order of rules makes no difference. The last outcome is frightening, though.

I fiddled with rules for a while but found no constellation of rules that would yield a result corresponding to rule #2. I guess the whitespaces between NAME and = are because of the Name Length for Aligning setting, and I don't really care about that. But this tossing of parenthesis is highly undesired. Any hints to how to avoid that?


Last edited by gemisigo on Tue Sep 04, 2018 4:34 pm; edited 1 time in total
Wed Aug 29, 2018 5:32 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7841

Post Reply with quote
Thank you for the detailed description. I have created a ticket for that issue with reference #SA0034588
Wed Aug 29, 2018 7:07 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Having only one file for data also causes the formatting to drop some characters. The code below
Code:

CREATE DATABASE DATAHOUSE_2016_Q1
ON ( NAME = DATAHOUSE_2016_Q1, FILENAME = 'M:\gfsqlArchive\DATAHOUSE_2016_Q1_data.mdf', FILEGROWTH = 10 MB )
LOG ON (NAME = 'DATAHOUSE_2016_Q1_log', FILENAME = 'M:\gfsqlArchive\DATAHOUSE_2016_Q1_log.ldf', FILEGROWTH = 10 MB);
GO
ALTER DATABASE DATAHOUSE_2016_Q1 SET RECOVERY SIMPLE;
GO


formats to:
Code:

CREATE DATABASE DATAHOUSE_2016_Q1 ON
(
    NAME = DATAHOUSE_2016_Q1 ,FILENAME = 'M:\gfsqlArchive\DATAHOUSE_2016_Q1_data.mdf' ,FILEGROWTH = 10 MB)
LOG O
(
    NAME            = 'DATAHOUSE_2016_Q1_log'
    ,FILENAME       = 'M:\gfsqlArchive\DATAHOUSE_2016_Q1_log.ldf'
    ,FILEGROWTH     = 10 MB
)
;
GO
ALTER DATABASE DATAHOUSE_2016_Q1
SET RECOVERY SIMPLE
;
GO



The LOG ON part lost its last character (N)
Thu Aug 30, 2018 6:54 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7841

Post Reply with quote
Quick status update, this ticket is still open, still waiting for the development team to figure out the cause and provide their response. It doesn't seem like a new issue. They are currently very busy with beta version related stuff.
Tue Sep 04, 2018 10:13 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Okay, I'll remove the Beta and version from the title to avoid confusion.
Tue Sep 04, 2018 4:33 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.