Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
36fcbd70
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,发现更多精彩内容 >>
提交
36fcbd70
编写于
1月 20, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sQL editor: trailing query delimiter trim (optional)
上级
2b37fc9c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
3 deletion
+16
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
...dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
....core/src/org/jkiss/dbeaver/core/CoreResources.properties
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
...e/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
+3
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLExecute.java
.../org/jkiss/dbeaver/ui/preferences/PrefPageSQLExecute.java
+9
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/ModelPreferences.java
...dbeaver.model/src/org/jkiss/dbeaver/ModelPreferences.java
+2
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
浏览文件 @
36fcbd70
...
...
@@ -825,6 +825,7 @@ public class CoreMessages extends NLS {
public
static
String
pref_page_sql_editor_checkbox_fetch_resultsets
;
public
static
String
pref_page_sql_editor_text_statement_delimiter
;
public
static
String
pref_page_sql_editor_checkbox_ignore_native_delimiter
;
public
static
String
pref_page_sql_editor_checkbox_remove_trailing_delimiter
;
public
static
String
pref_page_sql_editor_checkbox_blank_line_delimiter
;
public
static
String
pref_page_sql_editor_checkbox_enable_sql_parameters
;
public
static
String
pref_page_sql_editor_title_pattern
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
浏览文件 @
36fcbd70
...
...
@@ -832,6 +832,7 @@ pref_page_sql_editor_checkbox_enable_sql_anonymous_parameters = Anonymous SQL pa
pref_page_sql_editor_checkbox_enable_sql_parameters
=
Enable SQL parameters
pref_page_sql_editor_checkbox_fetch_resultsets
=
Fetch resultsets
pref_page_sql_editor_checkbox_ignore_native_delimiter
=
Ignore native delimiter
pref_page_sql_editor_checkbox_remove_trailing_delimiter
=
Remove trailing query delimiter
pref_page_sql_editor_checkbox_reset_cursor
=
Reset cursor after execute
pref_page_sql_editor_checkbox_max_editor_on_script_exec
=
Maximize editor on script execute
pref_page_sql_editor_combo_item_each_line_autocommit
=
After each line (autocommit)
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
浏览文件 @
36fcbd70
...
...
@@ -516,7 +516,9 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
ITextSelection
selection
=
(
ITextSelection
)
getSelectionProvider
().
getSelection
();
String
selText
=
selection
.
getText
();
selText
=
SQLUtils
.
trimQueryStatement
(
getSyntaxManager
(),
selText
,
!
syntaxManager
.
getDialect
().
isDelimiterAfterQuery
());
if
(
getActivePreferenceStore
().
getBoolean
(
ModelPreferences
.
QUERY_REMOVE_TRAILING_DELIMITER
))
{
selText
=
SQLUtils
.
trimQueryStatement
(
getSyntaxManager
(),
selText
,
!
syntaxManager
.
getDialect
().
isDelimiterAfterQuery
());
}
if
(!
CommonUtils
.
isEmpty
(
selText
))
{
SQLScriptElement
parsedElement
=
parseQuery
(
getDocument
(),
selection
.
getOffset
(),
selection
.
getOffset
()
+
selection
.
getLength
(),
selection
.
getOffset
(),
false
,
false
);
if
(
parsedElement
instanceof
SQLControlCommand
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLExecute.java
浏览文件 @
36fcbd70
...
...
@@ -54,6 +54,7 @@ public class PrefPageSQLExecute extends TargetPrefPage
private
Text
statementDelimiterText
;
private
Button
ignoreNativeDelimiter
;
private
Button
blankLineDelimiter
;
private
Button
removeTrailingDelimiter
;
private
Button
enableSQLParameters
;
private
Button
enableSQLAnonymousParameters
;
...
...
@@ -82,6 +83,8 @@ public class PrefPageSQLExecute extends TargetPrefPage
store
.
contains
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER
)
||
store
.
contains
(
ModelPreferences
.
SCRIPT_IGNORE_NATIVE_DELIMITER
)
||
store
.
contains
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER_BLANK
)
||
store
.
contains
(
ModelPreferences
.
QUERY_REMOVE_TRAILING_DELIMITER
)
||
store
.
contains
(
ModelPreferences
.
SQL_PARAMETERS_ENABLED
)
||
store
.
contains
(
ModelPreferences
.
SQL_PARAMETERS_IN_DDL_ENABLED
)
||
store
.
contains
(
ModelPreferences
.
SQL_ANONYMOUS_PARAMETERS_ENABLED
)
||
...
...
@@ -107,7 +110,7 @@ public class PrefPageSQLExecute extends TargetPrefPage
// General settings
{
Composite
commonGroup
=
UIUtils
.
createControlGroup
(
composite
,
CoreMessages
.
pref_page_sql_editor_group_common
,
2
,
GridData
.
FILL_HORIZONTAL
,
0
);
Composite
commonGroup
=
UIUtils
.
createControlGroup
(
composite
,
CoreMessages
.
pref_page_sql_editor_group_common
,
2
,
GridData
.
FILL_HORIZONTAL
|
GridData
.
VERTICAL_ALIGN_BEGINNING
,
0
);
{
invalidateBeforeExecuteCheck
=
UIUtils
.
createCheckbox
(
commonGroup
,
CoreMessages
.
pref_page_sql_editor_label_invalidate_before_execute
,
null
,
false
,
2
);
soundOnQueryEnd
=
UIUtils
.
createCheckbox
(
commonGroup
,
CoreMessages
.
pref_page_sql_editor_label_sound_on_query_end
,
null
,
false
,
2
);
...
...
@@ -180,6 +183,7 @@ public class PrefPageSQLExecute extends TargetPrefPage
//statementDelimiterText.setTextLimit(1);
ignoreNativeDelimiter
=
UIUtils
.
createCheckbox
(
delimGroup
,
CoreMessages
.
pref_page_sql_editor_checkbox_ignore_native_delimiter
,
null
,
false
,
2
);
blankLineDelimiter
=
UIUtils
.
createCheckbox
(
delimGroup
,
CoreMessages
.
pref_page_sql_editor_checkbox_blank_line_delimiter
,
null
,
false
,
2
);
removeTrailingDelimiter
=
UIUtils
.
createCheckbox
(
delimGroup
,
CoreMessages
.
pref_page_sql_editor_checkbox_remove_trailing_delimiter
,
null
,
false
,
2
);
}
return
composite
;
...
...
@@ -204,6 +208,7 @@ public class PrefPageSQLExecute extends TargetPrefPage
statementDelimiterText
.
setText
(
store
.
getString
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER
));
ignoreNativeDelimiter
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
SCRIPT_IGNORE_NATIVE_DELIMITER
));
blankLineDelimiter
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER_BLANK
));
removeTrailingDelimiter
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
QUERY_REMOVE_TRAILING_DELIMITER
));
enableSQLParameters
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
SQL_PARAMETERS_ENABLED
));
enableSQLAnonymousParameters
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
SQL_ANONYMOUS_PARAMETERS_ENABLED
));
...
...
@@ -234,6 +239,7 @@ public class PrefPageSQLExecute extends TargetPrefPage
store
.
setValue
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER
,
statementDelimiterText
.
getText
());
store
.
setValue
(
ModelPreferences
.
SCRIPT_IGNORE_NATIVE_DELIMITER
,
ignoreNativeDelimiter
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER_BLANK
,
blankLineDelimiter
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
QUERY_REMOVE_TRAILING_DELIMITER
,
removeTrailingDelimiter
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
SQL_PARAMETERS_ENABLED
,
enableSQLParameters
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
SQL_ANONYMOUS_PARAMETERS_ENABLED
,
enableSQLAnonymousParameters
.
getSelection
());
...
...
@@ -262,12 +268,13 @@ public class PrefPageSQLExecute extends TargetPrefPage
store
.
setToDefault
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER
);
store
.
setToDefault
(
ModelPreferences
.
SCRIPT_IGNORE_NATIVE_DELIMITER
);
store
.
setToDefault
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER_BLANK
);
store
.
setToDefault
(
ModelPreferences
.
QUERY_REMOVE_TRAILING_DELIMITER
);
store
.
setToDefault
(
ModelPreferences
.
SQL_PARAMETERS_ENABLED
);
store
.
setToDefault
(
ModelPreferences
.
SQL_PARAMETERS_IN_DDL_ENABLED
);
store
.
setToDefault
(
ModelPreferences
.
SQL_ANONYMOUS_PARAMETERS_ENABLED
);
store
.
setToDefault
(
ModelPreferences
.
SQL_ANONYMOUS_PARAMETERS_MARK
);
store
.
setToDefault
(
ModelPreferences
.
SCRIPT_STATEMENT_DELIMITER_BLANK
);
store
.
setToDefault
(
ModelPreferences
.
SQL_NAMED_PARAMETERS_PREFIX
);
store
.
setToDefault
(
SQLPreferenceConstants
.
BEEP_ON_QUERY_END
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/ModelPreferences.java
浏览文件 @
36fcbd70
...
...
@@ -43,6 +43,7 @@ public final class ModelPreferences
public
static
final
String
SCRIPT_STATEMENT_DELIMITER
=
"script.sql.delimiter"
;
//$NON-NLS-1$
public
static
final
String
SCRIPT_IGNORE_NATIVE_DELIMITER
=
"script.sql.ignoreNativeDelimiter"
;
//$NON-NLS-1$
public
static
final
String
SCRIPT_STATEMENT_DELIMITER_BLANK
=
"script.sql.delimiter.blank"
;
//$NON-NLS-1$
public
static
final
String
QUERY_REMOVE_TRAILING_DELIMITER
=
"script.sql.query.remove.trailing.delimiter"
;
//$NON-NLS-1$
public
static
final
String
MEMORY_CONTENT_MAX_SIZE
=
"content.memory.maxsize"
;
//$NON-NLS-1$
public
static
final
String
CONTENT_HEX_ENCODING
=
"content.hex.encoding"
;
//$NON-NLS-1$
...
...
@@ -113,6 +114,7 @@ public final class ModelPreferences
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SCRIPT_STATEMENT_DELIMITER
,
SQLConstants
.
DEFAULT_STATEMENT_DELIMITER
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SCRIPT_IGNORE_NATIVE_DELIMITER
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SCRIPT_STATEMENT_DELIMITER_BLANK
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
QUERY_REMOVE_TRAILING_DELIMITER
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
MEMORY_CONTENT_MAX_SIZE
,
10000
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
META_SEPARATE_CONNECTION
,
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录