Skip to content

Commit

Permalink
Correct work in Mozilla Firefox
Browse files Browse the repository at this point in the history
Bug with equal named dependent objects in one schema
Bug with single quote in single line comments
  • Loading branch information
usharik committed Aug 15, 2017
1 parent 7670a04 commit ed64a61
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 40 deletions.
1 change: 1 addition & 0 deletions MsSqlDependencyBrowser/MsSqlDependencyBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 68,7 @@
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Resources\README.md" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
Expand Down
2 changes: 2 additions & 0 deletions MsSqlDependencyBrowser/MsSqlRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 31,7 @@ class DbDependentObject
public string type_desc { get; set; }
public string base_object_name { get; set; }
public string schema_name { get; set; }
public int num { get; set; }

public string buildSqlServerObjectLink()
{
Expand Down Expand Up @@ -133,6 134,7 @@ public string requestDatabaseObjectInfo(string objectName, string schemaName)
{
Dictionary<string, string> depList = sqlConn
.Query<DbDependentObject>(Resources.queryObjectDependancies_sql, new { objectFullName = $"{schemaName}.{objectName}" })
.Where(dep => dep.num == 1)
.ToDictionary(dep => dep.referenced_entity_name.ToLower(), dep => dep.buildSqlServerObjectLink());

var dependencyProcessor = new DependencyProcessor(depList);
Expand Down
23 changes: 11 additions & 12 deletions MsSqlDependencyBrowser/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions MsSqlDependencyBrowser/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 125,12 @@
<value>web\index.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="keywords1" xml:space="preserve">
<value>select from where order group by insert update delete merge into having exec with declare create function procedure return returns begin end as if while for set try catch drop table view union all case then when cross apply outer inner left join and or on else raiserror throw tran commit rollback pivot unpivot for cursor open is in not null over partition using values varchar tinyint integer int bigint sysname date datetime datetime2 bit numeric char decimal varbinary execute fetch nvarchar revert nocount exists uniqueidentifier output index raiserror print on off nolock open close deallocate goto</value>
<comment>SQL keywords</comment>
<value>select from where order group by insert update delete merge into having exec with declare create function procedure return returns begin end as if while for set try catch drop table view union all case then when cross apply outer inner left join and or on else raiserror throw tran commit rollback pivot unpivot for cursor open is in not null over partition using values varchar tinyint integer int bigint sysname date datetime datetime2 bit numeric char decimal varbinary execute fetch nvarchar revert nocount exists uniqueidentifier output index raiserror print on off nolock open close deallocate goto image ntext top truncate</value>
<comment>SQL keywords 1</comment>
</data>
<data name="keywords2" xml:space="preserve">
<value>sum avg min max count row_number rank isnull coalesce nullif getdate getutcdate day month year left len trim stuff datepart eomonth suser_sname</value>
<value>sum avg min max count row_number rank isnull coalesce nullif getdate getutcdate getdate day month year len trim stuff datepart eomonth suser_sname cast convert db_name dateadd datediff</value>
<comment>SQL keywords 2</comment>
</data>
<data name="main_css" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>web\main.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
Expand Down
5 changes: 4 additions & 1 deletion MsSqlDependencyBrowser/SqlScriptParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 226,10 @@ protected override List<TextBlock> SplitText(string text)
pos = list[index - 1].Index list[index - 1].Length;
}
}
pos = list[index - 1].Index list[index - 1].Length;
if (result.Count > 0)
{
pos = list[index - 1].Index list[index - 1].Length;
}
result.Add(new TextBlock(false, pos, text.Length - pos, text.Substring(pos, text.Length - pos)));
return result;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
SELECT *
SELECT *, num = row_number() over (partition by referenced_entity_name order by schema_name)
FROM (
SELECT DISTINCT
A.referenced_entity_name,
Expand All @@ -10,5 10,6 @@ FROM (
LEFT JOIN sys.synonyms C ON B.object_id = C.object_id
INNER JOIN sys.schemas D on isnull(B.schema_id, C.schema_id) = D.schema_id
WHERE A.referenced_id IS NOT NULL
AND B.type in ('P', 'TF', 'IF', 'FN', 'V', 'U')
) A
ORDER BY LEN(A.referenced_entity_name) desc;
42 changes: 20 additions & 22 deletions MsSqlDependencyBrowser/Web/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 12,51 @@
}

#objectNavigator {
width: 15%;
height: calc(100% - 35px);
position: absolute;
width: 250px;
top: 36px;
bottom: 0px;
white-space: nowrap;
float: left;
outline: 1px solid;
box-sizing: border-box;
}

#objectTypeComboBox, #objFilter {
width: 95%;
width: 245px;
float: left;
margin-left: 3px;
margin-right: 3px;
box-sizing: border-box;
}

#objectNavigator label {
width: 100%;
width: 250px;
float: left;
margin-top: 3px;
padding-left: 3px;
box-sizing: border-box;
}

#objectList {
width: 75%;
width: 250px;
list-style-type: none;
padding: 0 0 0 0;
margin-left: 3px;
box-sizing: border-box;
padding: 0;
padding-left: 3px;
}

#objectListContainer {
width: 100%;
height: calc(100% - 77px);
float: left;
position: absolute;
top: 90px;
bottom: 0px;
overflow: auto;
box-sizing: border-box;
}

pre {
width: 85%;
height: calc(100% - 49px);
overflow: scroll;
float: right;
padding: 5px;
box-sizing: border-box;
position: absolute;
left: 270px;
top: 36px;
right: 0;
bottom: 0;
margin: 0;
tab-size: 4;
}

.is-hidden {
Expand Down Expand Up @@ -136,4 134,4 @@ tr {
td {
border: 1px solid black;
padding: 3px;
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 17,8 @@ Simple tool to browse between dependent objects on MS SQL Server
* Microsoft Internet Explorer 11
* Microsoft Edge
* Google Chrome
* Mozilla Firefox

### To-do list
* SQL authentication
* Mozilla Firefox support
* T-SQL parser improvement

0 comments on commit ed64a61

Please sign in to comment.