Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
034fdea3
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,发现更多精彩内容 >>
提交
034fdea3
编写于
1月 25, 2013
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redundant makeNull from DBDValue
Former-commit-id:
eb226e03
上级
9b545153
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
93 addition
and
105 deletion
+93
-105
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBUtils.java
...iss.dbeaver.core/src/org/jkiss/dbeaver/model/DBUtils.java
+26
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/data/DBDValue.java
...eaver.core/src/org/jkiss/dbeaver/model/data/DBDValue.java
+3
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCArray.java
...src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCArray.java
+0
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBytes.java
.../jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBytes.java
+0
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentChars.java
.../jkiss/dbeaver/model/impl/jdbc/data/JDBCContentChars.java
+0
-8
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentLOB.java
...rg/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentLOB.java
+0
-10
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCursor.java
...rc/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCursor.java
+0
-12
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStruct.java
...rc/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStruct.java
+0
-11
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/runtime/DBRRunnableWithResult.java
...rg/jkiss/dbeaver/model/runtime/DBRRunnableWithResult.java
+34
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
.../src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
+19
-17
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+9
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
...rc/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
+2
-6
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLTypeEnum.java
...l/src/org/jkiss/dbeaver/ext/mysql/data/MySQLTypeEnum.java
+0
-6
plugins/org.jkiss.dbeaver.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleObjectValue.java
.../org/jkiss/dbeaver/ext/oracle/data/OracleObjectValue.java
+0
-6
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBUtils.java
浏览文件 @
034fdea3
...
...
@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.model.exec.*;
import
org.jkiss.dbeaver.model.impl.DBCDefaultValueHandler
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithResult
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.model.struct.rdb.*
;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
...
...
@@ -377,13 +378,32 @@ public final class DBUtils {
return
(
value
==
null
||
(
value
instanceof
DBDValue
&&
((
DBDValue
)
value
).
isNull
()));
}
public
static
Object
makeNullValue
(
Object
value
)
public
static
Object
makeNullValue
(
DBCExecutionContext
context
,
DBDValueHandler
valueHandler
,
DBSTypedObject
type
)
throws
DBCException
{
if
(
value
instanceof
DBDValue
)
{
return
((
DBDValue
)
value
).
makeNull
();
}
else
{
return
null
;
}
return
valueHandler
.
getValueFromObject
(
context
,
type
,
null
,
false
);
}
public
static
Object
makeNullValue
(
final
DBDValueController
valueController
)
{
DBRRunnableWithResult
<
Object
>
runnable
=
new
DBRRunnableWithResult
<
Object
>()
{
@Override
public
void
run
(
DBRProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
DBCExecutionContext
context
=
valueController
.
getDataSource
().
openContext
(
monitor
,
DBCExecutionPurpose
.
UTIL
,
"Set NULL value"
);
try
{
result
=
DBUtils
.
makeNullValue
(
context
,
valueController
.
getValueHandler
(),
valueController
.
getAttributeMetaData
());
}
catch
(
DBCException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
finally
{
context
.
close
();
}
}
};
DBeaverUI
.
runInUI
(
valueController
.
getValueSite
().
getWorkbenchWindow
(),
runnable
);
return
runnable
.
getResult
();
}
public
static
DBDAttributeBinding
getColumnBinding
(
DBCExecutionContext
context
,
DBCAttributeMetaData
attributeMeta
)
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/data/DBDValue.java
浏览文件 @
034fdea3
...
...
@@ -24,15 +24,11 @@ package org.jkiss.dbeaver.model.data;
*/
public
interface
DBDValue
extends
DBDObject
{
boolean
isNull
();
DBDValue
makeNull
();
/**
*
Checks transactional state (transactional values valid only during transaction at which thy were retrieved
* @return
*
check this value is NULL
* @return
true for NULL values
*/
//boolean isTransactiona
l();
boolean
isNul
l
();
/**
* Releases allocated resources. Resets to original value
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCArray.java
浏览文件 @
034fdea3
...
...
@@ -26,7 +26,6 @@ import org.jkiss.dbeaver.model.DBPDataTypeProvider;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.SQLUtils
;
import
org.jkiss.dbeaver.model.data.DBDArray
;
import
org.jkiss.dbeaver.model.data.DBDValue
;
import
org.jkiss.dbeaver.model.data.DBDValueCloneable
;
import
org.jkiss.dbeaver.model.data.DBDValueHandler
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
...
...
@@ -152,12 +151,6 @@ public class JDBCArray implements DBDArray, DBDValueCloneable {
return
contents
==
null
;
}
@Override
public
DBDValue
makeNull
()
{
return
new
JDBCArray
(
type
,
null
);
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBytes.java
浏览文件 @
034fdea3
...
...
@@ -171,12 +171,6 @@ public class JDBCContentBytes extends JDBCContentAbstract implements DBDContent,
return
data
==
null
;
}
@Override
public
JDBCContentBytes
makeNull
()
{
return
new
JDBCContentBytes
(
dataSource
,
null
);
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentChars.java
浏览文件 @
034fdea3
...
...
@@ -43,8 +43,6 @@ import java.sql.SQLException;
*/
public
class
JDBCContentChars
extends
JDBCContentAbstract
implements
DBDContent
,
DBDValueCloneable
,
DBDContentStorage
{
//static final Log log = LogFactory.getLog(JDBCContentChars.class);
private
String
originalData
;
private
String
data
;
...
...
@@ -172,12 +170,6 @@ public class JDBCContentChars extends JDBCContentAbstract implements DBDContent,
return
data
==
null
;
}
@Override
public
JDBCContentChars
makeNull
()
{
return
new
JDBCContentChars
(
dataSource
,
null
);
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentLOB.java
浏览文件 @
034fdea3
...
...
@@ -18,8 +18,6 @@
*/
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.data.DBDContent
;
...
...
@@ -35,8 +33,6 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
*/
public
abstract
class
JDBCContentLOB
extends
JDBCContentAbstract
implements
DBDContent
{
static
final
Log
log
=
LogFactory
.
getLog
(
JDBCContentLOB
.
class
);
private
DBDContentStorage
originalStorage
;
protected
DBDContentStorage
storage
;
...
...
@@ -95,12 +91,6 @@ public abstract class JDBCContentLOB extends JDBCContentAbstract implements DBDC
}
}
@Override
public
JDBCContentLOB
makeNull
()
{
return
createNewContent
();
}
@Override
public
DBDValueCloneable
cloneValue
(
DBRProgressMonitor
monitor
)
throws
DBCException
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCursor.java
浏览文件 @
034fdea3
...
...
@@ -18,11 +18,7 @@
*/
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.model.data.DBDCursor
;
import
org.jkiss.dbeaver.model.data.DBDValue
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCExecutionContext
;
import
org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetImpl
;
...
...
@@ -33,8 +29,6 @@ import java.sql.ResultSet;
*/
public
class
JDBCCursor
extends
JDBCResultSetImpl
implements
DBDCursor
{
static
final
Log
log
=
LogFactory
.
getLog
(
JDBCCursor
.
class
);
public
JDBCCursor
(
JDBCExecutionContext
context
,
ResultSet
original
,
String
description
)
{
super
(
context
,
original
,
description
);
...
...
@@ -46,12 +40,6 @@ public class JDBCCursor extends JDBCResultSetImpl implements DBDCursor {
return
false
;
}
@Override
public
DBDValue
makeNull
()
{
throw
new
IllegalStateException
(
CoreMessages
.
model_jdbc_cant_create_null_cursor
);
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStruct.java
浏览文件 @
034fdea3
...
...
@@ -24,7 +24,6 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.SQLUtils
;
import
org.jkiss.dbeaver.model.data.DBDStructure
;
import
org.jkiss.dbeaver.model.data.DBDValue
;
import
org.jkiss.dbeaver.model.data.DBDValueCloneable
;
import
org.jkiss.dbeaver.model.data.DBDValueHandler
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
...
...
@@ -102,16 +101,6 @@ public class JDBCStruct implements DBDStructure, DBDValueCloneable {
return
contents
==
null
;
}
@Override
public
DBDValue
makeNull
()
{
JDBCStruct
nullStruct
=
new
JDBCStruct
();
nullStruct
.
type
=
this
.
type
;
nullStruct
.
contents
=
null
;
nullStruct
.
values
=
new
LinkedHashMap
<
DBSAttributeBase
,
Object
>();
return
nullStruct
;
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/runtime/DBRRunnableWithResult.java
0 → 100644
浏览文件 @
034fdea3
/*
* Copyright (C) 2010-2012 Serge Rieder
* serge@jkiss.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
org.jkiss.dbeaver.model.runtime
;
/**
*
*/
public
abstract
class
DBRRunnableWithResult
<
TYPE
>
implements
DBRRunnableWithProgress
{
protected
TYPE
result
;
public
TYPE
getResult
()
{
return
result
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
浏览文件 @
034fdea3
...
...
@@ -608,23 +608,25 @@ public class DataSourceDescriptor
// If there are some executions in last savepoint then ask user about commit/rollback
QMMCollector
qmm
=
DBeaverCore
.
getInstance
().
getQueryManager
().
getMetaCollector
();
QMMSessionInfo
qmmSession
=
qmm
.
getSession
(
dataSource
);
QMMTransactionInfo
txn
=
qmmSession
==
null
?
null
:
qmmSession
.
getTransaction
();
QMMTransactionSavepointInfo
sp
=
txn
==
null
?
null
:
txn
.
getCurrentSavepoint
();
if
(
sp
!=
null
&&
(
sp
.
getPrevious
()
!=
null
||
sp
.
getLastExecute
()
!=
null
))
{
// Ask for confirmation
TransactionCloseConfirmer
closeConfirmer
=
new
TransactionCloseConfirmer
();
UIUtils
.
runInUI
(
null
,
closeConfirmer
);
switch
(
closeConfirmer
.
result
)
{
case
IDialogConstants
.
YES_ID
:
context
.
getTransactionManager
().
commit
();
break
;
case
IDialogConstants
.
NO_ID
:
context
.
getTransactionManager
().
rollback
(
null
);
break
;
default
:
return
false
;
if
(
qmm
!=
null
)
{
QMMSessionInfo
qmmSession
=
qmm
.
getSession
(
dataSource
);
QMMTransactionInfo
txn
=
qmmSession
==
null
?
null
:
qmmSession
.
getTransaction
();
QMMTransactionSavepointInfo
sp
=
txn
==
null
?
null
:
txn
.
getCurrentSavepoint
();
if
(
sp
!=
null
&&
(
sp
.
getPrevious
()
!=
null
||
sp
.
getLastExecute
()
!=
null
))
{
// Ask for confirmation
TransactionCloseConfirmer
closeConfirmer
=
new
TransactionCloseConfirmer
();
UIUtils
.
runInUI
(
null
,
closeConfirmer
);
switch
(
closeConfirmer
.
result
)
{
case
IDialogConstants
.
YES_ID
:
context
.
getTransactionManager
().
commit
();
break
;
case
IDialogConstants
.
NO_ID
:
context
.
getTransactionManager
().
rollback
(
null
);
break
;
default
:
return
false
;
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
034fdea3
...
...
@@ -1196,7 +1196,8 @@ public class ResultSetViewer extends Viewer implements IDataSourceProvider, ISpr
@Override
public
void
run
()
{
valueController
.
updateValue
(
DBUtils
.
makeNullValue
(
value
));
valueController
.
updateValue
(
DBUtils
.
makeNullValue
(
valueController
));
}
});
}
...
...
@@ -1771,15 +1772,20 @@ public class ResultSetViewer extends Viewer implements IDataSourceProvider, ISpr
cells
[
i
]
=
metaColumn
.
getValueHandler
().
getValueFromObject
(
context
,
metaColumn
.
getTableColumn
(),
origRow
[
i
],
true
);
}
catch
(
DBCException
e
)
{
log
.
warn
(
e
);
cells
[
i
]
=
DBUtils
.
makeNullValue
(
origRow
[
i
]);
try
{
cells
[
i
]
=
DBUtils
.
makeNullValue
(
context
,
metaColumn
.
getValueHandler
(),
metaColumn
.
getAttribute
());
}
catch
(
DBCException
e1
)
{
log
.
warn
(
e1
);
}
}
}
}
}
else
{
// Initialize new values
for
(
int
i
=
0
;
i
<
metaColumns
.
length
;
i
++)
{
DBDAttributeBinding
metaColumn
=
metaColumns
[
i
];
try
{
cells
[
i
]
=
metaColumns
[
i
].
getValueHandler
().
getValueFromObject
(
context
,
metaColumns
[
i
].
getTableColumn
(),
null
,
false
);
cells
[
i
]
=
DBUtils
.
makeNullValue
(
context
,
metaColumn
.
getValueHandler
(),
metaColumn
.
getAttribute
()
);
}
catch
(
DBCException
e
)
{
log
.
warn
(
e
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
浏览文件 @
034fdea3
...
...
@@ -52,6 +52,7 @@ import org.jkiss.dbeaver.model.navigator.DBNDatabaseNode;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.runtime.jobs.DataSourceJob
;
import
org.jkiss.dbeaver.ui.DBIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
...
...
@@ -370,12 +371,7 @@ public abstract class ValueViewDialog extends Dialog implements DBDValueEditorEx
if
(
buttonId
==
IDialogConstants
.
IGNORE_ID
)
{
if
(!
valueController
.
isReadOnly
())
{
editedValue
=
valueController
.
getValue
();
if
(
editedValue
instanceof
DBDValue
)
{
editedValue
=
((
DBDValue
)
editedValue
).
makeNull
();
}
else
{
editedValue
=
null
;
}
editedValue
=
DBUtils
.
makeNullValue
(
valueController
);
}
super
.
okPressed
();
}
else
{
...
...
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLTypeEnum.java
浏览文件 @
034fdea3
...
...
@@ -58,12 +58,6 @@ public class MySQLTypeEnum implements DBDValue {
return
value
==
null
;
}
@Override
public
DBDValue
makeNull
()
{
return
new
MySQLTypeEnum
(
column
,
null
);
}
@Override
public
void
release
()
{
...
...
plugins/org.jkiss.dbeaver.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleObjectValue.java
浏览文件 @
034fdea3
...
...
@@ -43,12 +43,6 @@ public class OracleObjectValue implements DBDValue{
return
value
==
null
;
}
@Override
public
DBDValue
makeNull
()
{
return
new
OracleObjectValue
(
null
);
}
@Override
public
void
release
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录