Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
55433144
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,发现更多精彩内容 >>
未验证
提交
55433144
编写于
3月 15, 2022
作者:
A
Anastasiya
提交者:
GitHub
3月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#15829 add Oracle Sequences DDL tab (#15838)
上级
1a33a440
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
101 addition
and
43 deletion
+101
-43
plugins/org.jkiss.dbeaver.ext.oracle.ui/plugin.xml
plugins/org.jkiss.dbeaver.ext.oracle.ui/plugin.xml
+1
-0
plugins/org.jkiss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/actions/CompileHandler.java
...g/jkiss/dbeaver/ext/oracle/ui/actions/CompileHandler.java
+5
-0
plugins/org.jkiss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/editors/OracleSourceDeclarationEditor.java
.../ext/oracle/ui/editors/OracleSourceDeclarationEditor.java
+5
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSequenceManager.java
.../jkiss/dbeaver/ext/oracle/edit/OracleSequenceManager.java
+2
-40
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSequence.java
...rc/org/jkiss/dbeaver/ext/oracle/model/OracleSequence.java
+86
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSourceType.java
.../org/jkiss/dbeaver/ext/oracle/model/OracleSourceType.java
+2
-1
未找到文件。
plugins/org.jkiss.dbeaver.ext.oracle.ui/plugin.xml
浏览文件 @
55433144
...
...
@@ -196,6 +196,7 @@
<objectType
name=
"org.jkiss.dbeaver.ext.oracle.model.OracleTableIndex"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.oracle.model.OracleJavaClass"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.oracle.model.OracleJob"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.oracle.model.OracleSequence"
/>
</editor>
<editor
id=
"source.definition"
class=
"org.jkiss.dbeaver.ext.oracle.ui.editors.OracleSourceDefinitionEditor"
label=
"%editor.package.body.name"
description=
"%editor.package.body.description"
icon=
"#sql_text"
position=
"additions_middle"
...
...
plugins/org.jkiss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/actions/CompileHandler.java
浏览文件 @
55433144
...
...
@@ -27,6 +27,7 @@ import org.eclipse.ui.IWorkbenchPart;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.eclipse.ui.menus.UIElement
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleObjectPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleSequence
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleUtils
;
import
org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject
;
import
org.jkiss.dbeaver.model.DBPEvent
;
...
...
@@ -205,6 +206,10 @@ public class CompileHandler extends OracleTaskHandler
{
final
DBEPersistAction
[]
compileActions
=
unit
.
getCompileActions
(
monitor
);
if
(
ArrayUtils
.
isEmpty
(
compileActions
))
{
if
(
unit
instanceof
OracleSequence
)
{
// Sequence can not be compiled
return
false
;
}
throw
new
DBCException
(
"No compile actions associated with "
+
unit
.
getSourceType
().
name
());
}
...
...
plugins/org.jkiss.dbeaver.ext.oracle.ui/src/org/jkiss/dbeaver/ext/oracle/ui/editors/OracleSourceDeclarationEditor.java
浏览文件 @
55433144
...
...
@@ -19,9 +19,12 @@ package org.jkiss.dbeaver.ext.oracle.ui.editors;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleConstants
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleJob
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleSequence
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleTableBase
;
import
org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObjectWithScript
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -50,7 +53,8 @@ public class OracleSourceDeclarationEditor extends SQLSourceViewer<OracleSourceO
@Override
protected
boolean
isReadOnly
()
{
return
false
;
DBSObjectWithScript
sourceObject
=
getSourceObject
();
return
sourceObject
instanceof
OracleSequence
||
sourceObject
instanceof
OracleJob
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSequenceManager.java
浏览文件 @
55433144
...
...
@@ -68,7 +68,7 @@ public class OracleSequenceManager extends SQLObjectEditor<OracleSequence, Oracl
@Override
protected
void
addObjectCreateActions
(
DBRProgressMonitor
monitor
,
DBCExecutionContext
executionContext
,
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
,
Map
<
String
,
Object
>
options
)
{
String
sql
=
buildStatement
(
command
.
getObject
(),
false
);
String
sql
=
command
.
getObject
().
buildStatement
(
false
);
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create Sequence"
,
sql
));
String
comment
=
buildComment
(
command
.
getObject
());
...
...
@@ -79,7 +79,7 @@ public class OracleSequenceManager extends SQLObjectEditor<OracleSequence, Oracl
@Override
protected
void
addObjectModifyActions
(
DBRProgressMonitor
monitor
,
DBCExecutionContext
executionContext
,
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
,
Map
<
String
,
Object
>
options
)
{
String
sql
=
buildStatement
(
command
.
getObject
(),
true
);
String
sql
=
command
.
getObject
().
buildStatement
(
true
);
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Alter Sequence"
,
sql
));
String
comment
=
buildComment
(
command
.
getObject
());
...
...
@@ -95,44 +95,6 @@ public class OracleSequenceManager extends SQLObjectEditor<OracleSequence, Oracl
actions
.
add
(
action
);
}
private
String
buildStatement
(
OracleSequence
sequence
,
Boolean
forUpdate
)
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
forUpdate
)
{
sb
.
append
(
"ALTER SEQUENCE "
);
}
else
{
sb
.
append
(
"CREATE SEQUENCE "
);
}
sb
.
append
(
sequence
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
)).
append
(
" "
);
if
(
sequence
.
getIncrementBy
()
!=
null
)
{
sb
.
append
(
"INCREMENT BY "
).
append
(
sequence
.
getIncrementBy
()).
append
(
" "
);
}
if
(
sequence
.
getMinValue
()
!=
null
)
{
sb
.
append
(
"MINVALUE "
).
append
(
sequence
.
getMinValue
()).
append
(
" "
);
}
if
(
sequence
.
getMaxValue
()
!=
null
)
{
sb
.
append
(
"MAXVALUE "
).
append
(
sequence
.
getMaxValue
()).
append
(
" "
);
}
if
(
sequence
.
isCycle
())
{
sb
.
append
(
"CYCLE "
);
}
else
{
sb
.
append
(
"NOCYCLE "
);
}
if
(
sequence
.
getCacheSize
()
>
0
)
{
sb
.
append
(
"CACHE "
).
append
(
sequence
.
getCacheSize
()).
append
(
" "
);
}
else
{
sb
.
append
(
"NOCACHE "
);
}
if
(
sequence
.
isOrder
())
{
sb
.
append
(
"ORDER "
);
}
else
{
sb
.
append
(
"NOORDER "
);
}
return
sb
.
toString
();
}
private
String
buildComment
(
OracleSequence
sequence
)
{
if
(!
CommonUtils
.
isEmpty
(
sequence
.
getDescription
()))
{
return
"COMMENT ON SEQUENCE "
+
sequence
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
)
+
" IS "
+
SQLUtils
.
quoteString
(
sequence
,
sequence
.
getDescription
());
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSequence.java
浏览文件 @
55433144
...
...
@@ -17,18 +17,26 @@
package
org.jkiss.dbeaver.ext.oracle.model
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.oracle.model.source.OracleSourceObject
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObjectState
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSSequence
;
import
java.math.BigDecimal
;
import
java.sql.ResultSet
;
import
java.util.Map
;
/**
* Oracle sequence
*/
public
class
OracleSequence
extends
OracleSchemaObject
implements
DBSSequence
{
public
class
OracleSequence
extends
OracleSchemaObject
implements
DBSSequence
,
OracleSourceObject
{
private
BigDecimal
minValue
;
private
BigDecimal
maxValue
;
...
...
@@ -38,6 +46,8 @@ public class OracleSequence extends OracleSchemaObject implements DBSSequence {
private
boolean
flagCycle
;
private
boolean
flagOrder
;
private
String
sourceText
;
public
OracleSequence
(
OracleSchema
schema
,
String
name
)
{
super
(
schema
,
name
,
false
);
this
.
minValue
=
null
;
...
...
@@ -138,4 +148,79 @@ public class OracleSequence extends OracleSchemaObject implements DBSSequence {
public
void
setOrder
(
boolean
flagOrder
)
{
this
.
flagOrder
=
flagOrder
;
}
public
String
buildStatement
(
boolean
forUpdate
)
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
forUpdate
)
{
sb
.
append
(
"ALTER SEQUENCE "
);
}
else
{
sb
.
append
(
"CREATE SEQUENCE "
);
}
sb
.
append
(
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
)).
append
(
" "
);
if
(
getIncrementBy
()
!=
null
)
{
sb
.
append
(
"INCREMENT BY "
).
append
(
getIncrementBy
()).
append
(
" "
);
}
if
(
getMinValue
()
!=
null
)
{
sb
.
append
(
"MINVALUE "
).
append
(
getMinValue
()).
append
(
" "
);
}
if
(
getMaxValue
()
!=
null
)
{
sb
.
append
(
"MAXVALUE "
).
append
(
getMaxValue
()).
append
(
" "
);
}
if
(
isCycle
())
{
sb
.
append
(
"CYCLE "
);
}
else
{
sb
.
append
(
"NOCYCLE "
);
}
if
(
getCacheSize
()
>
0
)
{
sb
.
append
(
"CACHE "
).
append
(
getCacheSize
()).
append
(
" "
);
}
else
{
sb
.
append
(
"NOCACHE "
);
}
if
(
isOrder
())
{
sb
.
append
(
"ORDER "
);
}
else
{
sb
.
append
(
"NOORDER "
);
}
return
sb
.
toString
();
}
@Override
public
OracleSourceType
getSourceType
()
{
return
OracleSourceType
.
SEQUENCE
;
}
@Override
public
DBEPersistAction
[]
getCompileActions
(
DBRProgressMonitor
monitor
)
throws
DBCException
{
// No compilation for the sequence
return
new
DBEPersistAction
[
0
];
}
@NotNull
@Override
public
DBSObjectState
getObjectState
()
{
return
DBSObjectState
.
NORMAL
;
}
@Override
public
void
refreshObjectState
(
@NotNull
DBRProgressMonitor
monitor
)
throws
DBCException
{
// Do nothing
}
@Override
public
void
setObjectDefinitionText
(
String
source
)
{
this
.
sourceText
=
source
;
}
@Override
public
String
getObjectDefinitionText
(
DBRProgressMonitor
monitor
,
Map
<
String
,
Object
>
options
)
throws
DBException
{
if
(
sourceText
==
null
)
{
sourceText
=
buildStatement
(
false
);
}
return
sourceText
;
}
}
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSourceType.java
浏览文件 @
55433144
...
...
@@ -30,7 +30,8 @@ public enum OracleSourceType {
VIEW
(
true
),
MATERIALIZED_VIEW
(
true
),
JAVA_SOURCE
(
false
),
JOB
(
false
);
JOB
(
false
),
SEQUENCE
(
false
);
private
final
boolean
isCustom
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录