提交 eb937cbe authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

Issue 573: Add implementation for Methods "isWrapperFor()" and "unwrap()" in JdbcConnection.java,

patch by BigMichi1
上级 cbccdb6a
...@@ -31,6 +31,8 @@ Change Log ...@@ -31,6 +31,8 @@ Change Log
</li><li>Auto-scale MAX_MEMORY_ROWS and CACHE_SIZE settings by the amount of available RAM. Gives a better </li><li>Auto-scale MAX_MEMORY_ROWS and CACHE_SIZE settings by the amount of available RAM. Gives a better
out of box experience for people with more powerful machines. out of box experience for people with more powerful machines.
</li><li>Handle tabs like 4 spaces in web console, patch by Martin Grajcar </li><li>Handle tabs like 4 spaces in web console, patch by Martin Grajcar
</li><li>Issue 573: Add implementation for Methods "isWrapperFor()" and "unwrap()" in JdbcConnection.java,
patch by BigMichi1
</li></ul> </li></ul>
<h2>Version 1.4.180 Beta (2014-07-13)</h2> <h2>Version 1.4.180 Beta (2014-07-13)</h2>
......
...@@ -1764,23 +1764,27 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1764,23 +1764,27 @@ public class JdbcConnection extends TraceObject implements Connection {
} }
/** /**
* [Not supported] Return an object of this class if possible. * Return an object of this class if possible.
* *
* @param iface the class * @param iface the class
*/ */
@Override @Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException { public <T> T unwrap(Class<T> iface) throws SQLException {
throw unsupported("unwrap"); if (isWrapperFor(iface)) {
return (T) this;
}
throw DbException.getInvalidValueException("iface", iface);
} }
/** /**
* [Not supported] Checks if unwrap can return an object of this class. * Checks if unwrap can return an object of this class.
* *
* @param iface the class * @param iface the class
*/ */
@Override @Override
public boolean isWrapperFor(Class<?> iface) throws SQLException { public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw unsupported("isWrapperFor"); return (iface != null && iface.isAssignableFrom(getClass()));
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论