Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
dc946a78
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dc946a78
编写于
8月 12, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6326 Index DDL: remove "DRO PEXISTING", fix index DDL reading routine (make it database-specific)
Former-commit-id:
f4621455
上级
3a1da82c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
14 deletion
+19
-14
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerTableIndex.java
...rg/jkiss/dbeaver/ext/mssql/model/SQLServerTableIndex.java
+19
-14
未找到文件。
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerTableIndex.java
浏览文件 @
dc946a78
...
...
@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.ext.mssql.model;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.mssql.SQLServerUtils
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.DBPNamedObject2
;
import
org.jkiss.dbeaver.model.DBUtils
;
...
...
@@ -201,22 +202,22 @@ public class SQLServerTableIndex extends JDBCTableIndex<SQLServerSchema, SQLServ
" 'SORT_IN_TEMPDB = OFF ' + ',' + \n"
+
" CASE WHEN I.ignore_dup_key = 1 THEN ' IGNORE_DUP_KEY = ON ' ELSE ' IGNORE_DUP_KEY = OFF ' END + ',' + \n"
+
" CASE WHEN ST.no_recompute = 0 THEN ' STATISTICS_NORECOMPUTE = OFF ' ELSE ' STATISTICS_NORECOMPUTE = ON ' END + ',' + \n"
+
" -- default value \n"
+
" ' DROP_EXISTING = ON ' + ',' + \n"
+
//
" -- default value \n" +
//
" ' DROP_EXISTING = ON ' + ',' + \n" +
" -- default value \n"
+
" ' ONLINE = OFF ' + ',' + \n"
+
" CASE WHEN I.allow_row_locks = 1 THEN ' ALLOW_ROW_LOCKS = ON ' ELSE ' ALLOW_ROW_LOCKS = OFF ' END + ',' + \n"
+
" CASE WHEN I.allow_page_locks = 1 THEN ' ALLOW_PAGE_LOCKS = ON ' ELSE ' ALLOW_PAGE_LOCKS = OFF ' END + ' )"
+
"\n\t ON [' + \n"
+
" DS.name + ' ] ' [CreateIndexScript] \n"
+
"FROM
sys.indexes
I \n"
+
" JOIN
sys.tables
T ON T.Object_id = I.Object_id \n"
+
" JOIN
sys.sysindexes
SI ON I.Object_id = SI.id AND I.index_id = SI.indid \n"
+
"FROM
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"indexes"
)
+
"
I \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"tables"
)
+
"
T ON T.Object_id = I.Object_id \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"sysindexes"
)
+
"
SI ON I.Object_id = SI.id AND I.index_id = SI.indid \n"
+
" JOIN (SELECT * FROM ( \n"
+
" SELECT IC2.object_id , IC2.index_id , \n"
+
" STUFF((SELECT ' , ' + C.name + CASE WHEN MAX(CONVERT(INT,IC1.is_descending_key)) = 1 THEN ' DESC ' ELSE ' ASC ' END \n"
+
" FROM
sys.index_columns
IC1 \n"
+
" JOIN
Sys.columns
C \n"
+
" FROM
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"index_columns"
)
+
"
IC1 \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"columns"
)
+
"
C \n"
+
" ON C.object_id = IC1.object_id \n"
+
" AND C.column_id = IC1.column_id \n"
+
" AND IC1.is_included_column = 0 \n"
+
...
...
@@ -225,18 +226,18 @@ public class SQLServerTableIndex extends JDBCTableIndex<SQLServerSchema, SQLServ
" GROUP BY IC1.object_id,C.name,index_id \n"
+
" ORDER BY MAX(IC1.key_ordinal) \n"
+
" FOR XML PATH('')), 1, 2, '') KeyColumns \n"
+
" FROM
sys.index_columns
IC2 \n"
+
" FROM
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"index_columns"
)
+
"
IC2 \n"
+
" --WHERE IC2.Object_id = object_id('Person.Address') --Comment for all tables \n"
+
" GROUP BY IC2.object_id ,IC2.index_id) tmp3 )tmp4 \n"
+
" ON I.object_id = tmp4.object_id AND I.Index_id = tmp4.index_id \n"
+
" JOIN
sys.stats
ST ON ST.object_id = I.object_id AND ST.stats_id = I.index_id \n"
+
" JOIN
sys.data_spaces
DS ON I.data_space_id=DS.data_space_id \n"
+
" JOIN
sys.filegroups
FG ON I.data_space_id=FG.data_space_id \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"stats"
)
+
"
ST ON ST.object_id = I.object_id AND ST.stats_id = I.index_id \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"data_spaces"
)
+
"
DS ON I.data_space_id=DS.data_space_id \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"filegroups"
)
+
"
FG ON I.data_space_id=FG.data_space_id \n"
+
" LEFT JOIN (SELECT * FROM ( \n"
+
" SELECT IC2.object_id , IC2.index_id , \n"
+
" STUFF((SELECT ' , ' + C.name \n"
+
" FROM
sys.index_columns
IC1 \n"
+
" JOIN
Sys.columns
C \n"
+
" FROM
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"index_columns"
)
+
"
IC1 \n"
+
" JOIN
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"columns"
)
+
"
C \n"
+
" ON C.object_id = IC1.object_id \n"
+
" AND C.column_id = IC1.column_id \n"
+
" AND IC1.is_included_column = 1 \n"
+
...
...
@@ -244,7 +245,7 @@ public class SQLServerTableIndex extends JDBCTableIndex<SQLServerSchema, SQLServ
" AND IC1.index_id = IC2.index_id \n"
+
" GROUP BY IC1.object_id,C.name,index_id \n"
+
" FOR XML PATH('')), 1, 2, '') IncludedColumns \n"
+
" FROM
sys.index_columns
IC2 \n"
+
" FROM
"
+
SQLServerUtils
.
getSystemTableName
(
getDatabase
(),
"index_columns"
)
+
"
IC2 \n"
+
" --WHERE IC2.Object_id = object_id('Person.Address') --Comment for all tables \n"
+
" GROUP BY IC2.object_id ,IC2.index_id) tmp1 \n"
+
" WHERE IncludedColumns IS NOT NULL ) tmp2 \n"
+
...
...
@@ -259,6 +260,10 @@ public class SQLServerTableIndex extends JDBCTableIndex<SQLServerSchema, SQLServ
}
}
private
SQLServerDatabase
getDatabase
()
{
return
getTable
().
getDatabase
();
}
@Override
public
void
setObjectDefinitionText
(
String
source
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录