Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
1ffc095e
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,发现更多精彩内容 >>
提交
1ffc095e
编写于
6月 28, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Context init fixed.
Datasource composite icons fixed. Former-commit-id:
14b12f94
上级
db0ed8a1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
13 deletion
+55
-13
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/AbstractExecutionContext.java
...rg/jkiss/dbeaver/model/impl/AbstractExecutionContext.java
+0
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCExecutionContext.java
...g/jkiss/dbeaver/model/impl/jdbc/JDBCExecutionContext.java
+12
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNDataSource.java
.../src/org/jkiss/dbeaver/model/navigator/DBNDataSource.java
+12
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/sql/SQLQuery.java
...beaver.core/src/org/jkiss/dbeaver/model/sql/SQLQuery.java
+14
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
....core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+17
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/AbstractExecutionContext.java
浏览文件 @
1ffc095e
...
...
@@ -92,7 +92,6 @@ public abstract class AbstractExecutionContext<DATASOURCE extends DBPDataSource>
if
(
bootstrap
.
isIgnoreErrors
())
{
log
.
warn
(
message
);
}
else
{
QMUtils
.
getDefaultHandler
().
handleContextClose
(
this
);
throw
new
DBCException
(
message
,
e
,
dataSource
);
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCExecutionContext.java
浏览文件 @
1ffc095e
...
...
@@ -66,6 +66,7 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
log
.
error
(
"Reopening not-closed connection"
);
close
();
}
boolean
connectionReadOnly
=
dataSource
.
getContainer
().
isConnectionReadOnly
();
ACTIVE_CONTEXT
.
set
(
this
);
try
{
this
.
connection
=
dataSource
.
openConnection
(
monitor
,
purpose
);
...
...
@@ -107,10 +108,18 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
}
}
this
.
initContextBootstrap
(
monitor
,
autoCommit
);
try
{
this
.
initContextBootstrap
(
monitor
,
autoCommit
);
}
catch
(
DBCException
e
)
{
log
.
error
(
"Error while running context bootstrap"
,
e
);
}
// Copy context state
this
.
dataSource
.
initializeContextState
(
monitor
,
this
,
forceActiveObject
);
try
{
// Copy context state
this
.
dataSource
.
initializeContextState
(
monitor
,
this
,
forceActiveObject
&&
!
connectionReadOnly
);
}
catch
(
DBCException
e
)
{
log
.
error
(
"Error while initializing context state"
,
e
);
}
// Add self to context list
this
.
dataSource
.
allContexts
.
add
(
this
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNDataSource.java
浏览文件 @
1ffc095e
...
...
@@ -142,13 +142,18 @@ public class DBNDataSource extends DBNDatabaseNode implements IAdaptable
public
DBPImage
getNodeIcon
()
{
DBPImage
image
=
super
.
getNodeIcon
();
if
(
dataSource
.
isConnectionReadOnly
()
||
dataSource
.
hasNetworkHandlers
())
{
return
new
DBIconComposite
(
image
,
false
,
null
,
dataSource
.
hasNetworkHandlers
()
?
DBIcon
.
OVER_EXTERNAL
:
null
,
dataSource
.
isConnectionReadOnly
()
?
DBIcon
.
OVER_LOCK
:
null
,
null
);
if
(
image
instanceof
DBIconComposite
)
{
((
DBIconComposite
)
image
).
setTopRight
(
dataSource
.
hasNetworkHandlers
()
?
DBIcon
.
OVER_EXTERNAL
:
null
);
((
DBIconComposite
)
image
).
setBottomLeft
(
dataSource
.
isConnectionReadOnly
()
?
DBIcon
.
OVER_LOCK
:
null
);
}
else
{
image
=
new
DBIconComposite
(
image
,
false
,
null
,
dataSource
.
hasNetworkHandlers
()
?
DBIcon
.
OVER_EXTERNAL
:
null
,
dataSource
.
isConnectionReadOnly
()
?
DBIcon
.
OVER_LOCK
:
null
,
null
);
}
}
return
image
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/sql/SQLQuery.java
浏览文件 @
1ffc095e
...
...
@@ -22,7 +22,12 @@ import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import
net.sf.jsqlparser.schema.Database
;
import
net.sf.jsqlparser.schema.Table
;
import
net.sf.jsqlparser.statement.Statement
;
import
net.sf.jsqlparser.statement.alter.Alter
;
import
net.sf.jsqlparser.statement.create.index.CreateIndex
;
import
net.sf.jsqlparser.statement.create.table.CreateTable
;
import
net.sf.jsqlparser.statement.create.view.CreateView
;
import
net.sf.jsqlparser.statement.delete.Delete
;
import
net.sf.jsqlparser.statement.drop.Drop
;
import
net.sf.jsqlparser.statement.insert.Insert
;
import
net.sf.jsqlparser.statement.select.PlainSelect
;
import
net.sf.jsqlparser.statement.select.Select
;
...
...
@@ -105,8 +110,15 @@ public class SQLQuery {
type
=
SQLQueryType
.
UPDATE
;
}
else
if
(
statement
instanceof
Delete
)
{
type
=
SQLQueryType
.
DELETE
;
}
else
{
}
else
if
(
statement
instanceof
Alter
||
statement
instanceof
CreateTable
||
statement
instanceof
CreateView
||
statement
instanceof
Drop
||
statement
instanceof
CreateIndex
)
{
type
=
SQLQueryType
.
DDL
;
}
else
{
type
=
SQLQueryType
.
UNKNOWN
;
}
}
catch
(
Throwable
e
)
{
this
.
type
=
SQLQueryType
.
UNKNOWN
;
...
...
@@ -119,7 +131,7 @@ public class SQLQuery {
* @return true is this query is a plain select
*/
public
boolean
isPlainSelect
()
{
if
(
statement
!=
null
&&
((
Select
)
statement
).
getSelectBody
()
instanceof
PlainSelect
)
{
if
(
statement
instanceof
Select
&&
((
Select
)
statement
).
getSelectBody
()
instanceof
PlainSelect
)
{
PlainSelect
selectBody
=
(
PlainSelect
)
((
Select
)
statement
).
getSelectBody
();
return
selectBody
.
getFromItem
()
!=
null
&&
CommonUtils
.
isEmpty
(
selectBody
.
getIntoTables
())
&&
selectBody
.
getLimit
()
==
null
&&
selectBody
.
getTop
()
==
null
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
1ffc095e
...
...
@@ -59,6 +59,7 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import
org.jkiss.dbeaver.model.sql.SQLQuery
;
import
org.jkiss.dbeaver.model.sql.SQLQueryResult
;
import
org.jkiss.dbeaver.model.sql.SQLQueryTransformer
;
import
org.jkiss.dbeaver.model.sql.SQLQueryType
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSDataSourceContainer
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
...
...
@@ -613,6 +614,22 @@ public class SQLEditor extends SQLEditorBase implements
// Nothing to process
return
;
}
DBSDataSourceContainer
container
=
getDataSourceContainer
();
if
(
container
!=
null
&&
container
.
isConnectionReadOnly
())
{
/*
// Allow only selects
for (SQLQuery query : queries) {
if (query.getType() != SQLQueryType.SELECT && query.getType() != SQLQueryType.UNKNOWN) {
UIUtils.showErrorDialog(
getSite().getShell(),
CoreMessages.editors_sql_error_cant_execute_query_title,
"Read-only connection '" + container.getName() + "' restricts execution of non-select statements. " +
"Query [" + query.getQuery() + "] is " + query.getType() + " and can't be processed");
return;
}
}
*/
}
try
{
checkSession
();
}
catch
(
DBException
ex
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录