提交 723d005e authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved error message for unsupported features.

上级 3bd2d5c0
......@@ -18,7 +18,10 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Some internal caches did not use the LRU mechanism. Fixed
<ul><li>Improved error message for unsupported features:
now the message says what exactly is not supported.
</li><li>Improved OSGi support.
</li><li>Some internal caches did not use the LRU mechanism. Fixed
(LOB file list, optimizer cost cache, trace system, view indexes, collection keys,
compressed in-memory file system).
</li><li>Command line help of the tools now match the javadocs.
......@@ -34,7 +37,8 @@ Change Log
Getting a connection using the built-in JdbcConnectionPool is now about 70 times faster
than opening connections using DriverManager.getConnection.
</li><li>More bugs in the server-less multi-connection mode have been fixed:
if a process terminated while writing, other open connections were blocked.
If a process terminated while writing, other open connections were blocked.
If two processes were writing to the database, sometimes the database was corrupt after closing.
</li><li>Linked tables to SQLite database can now be created.
</li><li>Nested IN(IN(...)) didn't work.
</li><li>NIO storage: the nio: prefix was using memory mapped files instead of FileChannel.
......
......@@ -163,5 +163,5 @@
90139=The public static Java method was not found\: {0}
HY000=General error\: {0}
HY004=Unknown data type\: {0}
HYC00=Feature not supported
HYC00=Feature not supported\: {0}
HYT00=Timeout trying to lock table {0}
......@@ -45,7 +45,7 @@ public class AlterTableRename extends SchemaCommand {
}
session.getUser().checkRight(oldTable, Right.ALL);
if (oldTable.getTemporary()) {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("TEMP TABLE");
}
db.renameSchemaObject(session, oldTable, newTableName);
return 0;
......
......@@ -296,7 +296,7 @@ public class ErrorCode {
* calling an unsupported JDBC method. See the stack trace
* for details.
*/
public static final int FEATURE_NOT_SUPPORTED = 50100;
public static final int FEATURE_NOT_SUPPORTED_1 = 50100;
/**
* The error with code <code>50200</code> is thrown when
......@@ -1900,7 +1900,7 @@ public class ErrorCode {
case GENERAL_ERROR_1: return "HY000";
case UNKNOWN_DATA_TYPE_1: return "HY004";
case FEATURE_NOT_SUPPORTED: return "HYC00";
case FEATURE_NOT_SUPPORTED_1: return "HYC00";
case LOCK_TIMEOUT_1: return "HYT00";
default:
return "" + errorCode;
......
......@@ -152,7 +152,7 @@ public class FunctionAlias extends DbObjectBase {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("RENAME");
}
/**
......
......@@ -219,7 +219,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
}
public void setPowerOffCount(int count) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("remote");
}
public SessionInterface createSession(ConnectionInfo ci) throws SQLException {
......@@ -307,7 +307,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
// AUTO_SERVER implies AUTO_RECONNECT
autoReconnect |= Boolean.valueOf(ci.getProperty("AUTO_SERVER", "false")).booleanValue();
if (autoReconnect && serverList != null) {
throw Message.getSQLException(ErrorCode.FEATURE_NOT_SUPPORTED);
throw Message.getUnsupportedException("autoReconnect && serverList != null");
}
if (autoReconnect) {
eventListener = ci.getDatabaseEventListenerObject();
......
......@@ -71,7 +71,7 @@ public class Setting extends DbObjectBase {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("RENAME");
}
}
......@@ -74,7 +74,7 @@ public class UserAggregate extends DbObjectBase {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("AGGREGATE");
}
public String getJavaClassName() {
......
......@@ -36,11 +36,11 @@ public class FunctionIndex extends BaseIndex {
}
public void add(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public void remove(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException {
......@@ -52,7 +52,7 @@ public class FunctionIndex extends BaseIndex {
public double getCost(Session session, int[] masks) throws SQLException {
if (masks != null) {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
long expectedRows;
if (functionTable.canGetRowCount()) {
......@@ -64,11 +64,11 @@ public class FunctionIndex extends BaseIndex {
}
public void remove(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public boolean needRebuild() {
......@@ -76,7 +76,7 @@ public class FunctionIndex extends BaseIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public boolean canGetFirstOrLast() {
......@@ -84,7 +84,7 @@ public class FunctionIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public long getRowCount(Session session) {
......
......@@ -150,7 +150,7 @@ public class HashIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("HASH");
}
public long getRowCount(Session session) {
......
......@@ -169,7 +169,7 @@ public class LinkedIndex extends BaseIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LINKED");
}
public boolean needRebuild() {
......@@ -183,7 +183,7 @@ public class LinkedIndex extends BaseIndex {
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
// TODO optimization: could get the first or last value (in any case;
// maybe not optimized)
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LINKED");
}
public void remove(Session session, Row row) throws SQLException {
......
......@@ -35,11 +35,11 @@ public class MetaIndex extends BaseIndex {
}
public void add(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void remove(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException {
......@@ -55,11 +55,11 @@ public class MetaIndex extends BaseIndex {
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void remove(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public int getColumnIndex(Column col) {
......@@ -71,7 +71,7 @@ public class MetaIndex extends BaseIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public boolean needRebuild() {
......@@ -87,7 +87,7 @@ public class MetaIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public long getRowCount(Session session) {
......
......@@ -171,7 +171,7 @@ public class PageBtreeIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("PAGE");
}
public double getCost(Session session, int[] masks) {
......
......@@ -182,7 +182,7 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("PAGE");
}
public double getCost(Session session, int[] masks) throws SQLException {
......@@ -256,7 +256,7 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("PAGE");
}
public Row getRow(Session session, int key) throws SQLException {
......
......@@ -33,11 +33,11 @@ public class RangeIndex extends BaseIndex {
}
public void add(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void remove(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException {
......@@ -57,11 +57,11 @@ public class RangeIndex extends BaseIndex {
}
public void remove(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public boolean needRebuild() {
......@@ -69,7 +69,7 @@ public class RangeIndex extends BaseIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public boolean canGetFirstOrLast() {
......
......@@ -264,7 +264,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SCAN");
}
public boolean needRebuild() {
......@@ -276,7 +276,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SCAN");
}
public Iterator getDelta() {
......
......@@ -74,11 +74,11 @@ public class ViewIndex extends BaseIndex {
}
public void add(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void remove(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
/**
......@@ -246,15 +246,15 @@ public class ViewIndex extends BaseIndex {
}
public void remove(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public boolean needRebuild() {
......@@ -266,7 +266,7 @@ public class ViewIndex extends BaseIndex {
}
public Cursor findFirstOrLast(Session session, boolean first) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void setRecursive(boolean value) {
......
......@@ -280,7 +280,7 @@ public class JdbcArray extends TraceObject implements Array {
private void checkMap(Map map) throws SQLException {
if (map != null && map.size() > 0) {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("map.size > 0");
}
}
......
......@@ -81,7 +81,7 @@ public class JdbcBlob extends TraceObject implements Blob {
*/
public void truncate(long len) throws SQLException {
debugCodeCall("truncate", len);
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -127,7 +127,7 @@ public class JdbcBlob extends TraceObject implements Blob {
*/
public int setBytes(long pos, byte[] bytes) throws SQLException {
debugCode("setBytes("+pos+", bytes);");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -142,7 +142,7 @@ public class JdbcBlob extends TraceObject implements Blob {
*/
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
debugCode("setBytes("+pos+", bytes, "+offset+", "+len+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -170,7 +170,7 @@ public class JdbcBlob extends TraceObject implements Blob {
*/
public OutputStream setBinaryStream(long pos) throws SQLException {
debugCodeCall("setBinaryStream", pos);
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -223,7 +223,7 @@ public class JdbcBlob extends TraceObject implements Blob {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB search");
}
/**
......@@ -256,7 +256,7 @@ public class JdbcBlob extends TraceObject implements Blob {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB subset");
}
/**
......@@ -277,7 +277,7 @@ public class JdbcBlob extends TraceObject implements Blob {
*/
public InputStream getBinaryStream(long pos, long length) throws SQLException {
debugCode("getBinaryStream("+pos+", "+length+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
private void checkClosed() throws SQLException {
......
......@@ -85,7 +85,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public void truncate(long len) throws SQLException {
debugCodeCall("truncate", len);
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -109,7 +109,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public OutputStream setAsciiStream(long pos) throws SQLException {
debugCodeCall("setAsciiStream", pos);
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -132,7 +132,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public Writer setCharacterStream(long pos) throws SQLException {
debugCodeCall("setCharacterStream", pos);
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -177,7 +177,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public int setString(long pos, String str) throws SQLException {
debugCode("setString("+pos+", "+quote(str)+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -185,7 +185,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public int setString(long pos, String str, int offset, int len) throws SQLException {
debugCode("setString("+pos+", "+quote(str)+", "+offset+", "+len+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB update");
}
/**
......@@ -193,7 +193,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public long position(String pattern, long start) throws SQLException {
debugCode("position("+quote(pattern)+", "+start+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB search");
}
/**
......@@ -201,7 +201,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public long position(Clob clobPattern, long start) throws SQLException {
debugCode("position(clobPattern, "+start+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB search");
}
/**
......@@ -217,7 +217,7 @@ public class JdbcClob extends TraceObject implements Clob
*/
public Reader getCharacterStream(long pos, long length) throws SQLException {
debugCode("getCharacterStream("+pos+", "+length+");");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LOB subset");
}
private void checkClosed() throws SQLException {
......
......@@ -1254,6 +1254,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* Check if this connection is closed.
*
* @return true if the session was re-connected
* @throws SQLException if the connection or session is closed
*/
boolean checkClosed() throws SQLException {
......@@ -1390,7 +1391,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*/
/*## Java 1.6 begin ##
public SQLXML createSQLXML() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SQLXML");
}
## Java 1.6 end ##*/
......@@ -1400,7 +1401,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/*## Java 1.6 begin ##
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("createArray");
}
## Java 1.6 end ##*/
......@@ -1410,7 +1411,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/*## Java 1.6 begin ##
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("Struct");
}
## Java 1.6 end ##*/
......@@ -1470,7 +1471,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*/
/*## Java 1.6 begin ##
public String getClientInfo(String name) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("clientInfo");
}
## Java 1.6 end ##*/
......@@ -1481,7 +1482,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*/
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -1492,7 +1493,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*/
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......@@ -1536,7 +1537,7 @@ public class JdbcConnection extends TraceObject implements Connection {
private void checkMap(Map map) throws SQLException {
if (map != null && map.size() > 0) {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("map.size > 0");
}
}
......
......@@ -2550,7 +2550,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(schemaPattern)+", "
+quote(typeNamePattern)+");");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("superTypes");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -2610,7 +2610,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(typeNamePattern)+", "
+quote(attributeNamePattern)+");");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("attributes");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -2752,7 +2752,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
public ResultSet getSchemas(String catalog, String schemaPattern)
throws SQLException {
debugCodeCall("getSchemas");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("getSchemas(., .)");
}
## Java 1.6 end ##*/
......@@ -2781,7 +2781,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
*/
public ResultSet getClientInfoProperties() throws SQLException {
debugCodeCall("getClientInfoProperties");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("clientInfoProperties");
}
/**
......@@ -2790,7 +2790,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -2800,7 +2800,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......@@ -2812,7 +2812,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
String functionNamePattern, String columnNamePattern)
throws SQLException {
debugCodeCall("getFunctionColumns");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("getFunctionColumns");
}
## Java 1.6 end ##*/
......@@ -2823,7 +2823,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
public ResultSet getFunctions(String catalog, String schemaPattern,
String functionNamePattern) throws SQLException {
debugCodeCall("getFunctions");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("getFunctions");
}
## Java 1.6 end ##*/
......
......@@ -221,7 +221,7 @@ implements ParameterMetaData
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -231,7 +231,7 @@ implements ParameterMetaData
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......
......@@ -579,7 +579,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
if (isDebugEnabled()) {
debugCode("setRef("+parameterIndex+", x);");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ref");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -666,7 +666,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
if (isDebugEnabled()) {
debugCode("setUnicodeStream("+parameterIndex+", x, "+length+");");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unicodeStream");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -794,7 +794,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
if (isDebugEnabled()) {
debugCode("setArray("+parameterIndex+", x);");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("setArray");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -959,7 +959,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
if (isDebugEnabled()) {
debugCode("setURL("+parameterIndex+", x);");
}
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("url");
} catch (Exception e) {
throw logAndConvert(e);
}
......@@ -1235,7 +1235,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*/
/*## Java 1.6 begin ##
public void setRowId(int parameterIndex, RowId x) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("rowId");
}
## Java 1.6 end ##*/
......@@ -1402,7 +1402,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*/
/*## Java 1.6 begin ##
public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SQLXML");
}
## Java 1.6 end ##*/
......
......@@ -434,7 +434,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -444,7 +444,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......
......@@ -901,7 +901,7 @@ public class JdbcStatement extends TraceObject implements Statement {
*/
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -910,7 +910,7 @@ public class JdbcStatement extends TraceObject implements Statement {
*/
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......
......@@ -351,7 +351,7 @@ public class JdbcConnectionPool implements DataSource {
*/
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -362,7 +362,7 @@ public class JdbcConnectionPool implements DataSource {
*/
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......
......@@ -343,7 +343,7 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("unwrap");
}
## Java 1.6 end ##*/
......@@ -354,7 +354,7 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("isWrapperFor");
}
## Java 1.6 end ##*/
......
......@@ -158,8 +158,8 @@ public class Message {
*
* @return the SQLException object
*/
public static JdbcSQLException getUnsupportedException() {
return getSQLException(ErrorCode.FEATURE_NOT_SUPPORTED);
public static JdbcSQLException getUnsupportedException(String message) {
return getSQLException(ErrorCode.FEATURE_NOT_SUPPORTED_1, message);
}
/**
......
......@@ -163,5 +163,5 @@
90139=Die (public static) Java Funktion wurde nicht gefunden\: {0}
HY000=Allgemeiner Fehler\: {0}
HY004=Unbekannter Datentyp\: {0}
HYC00=Dieses Feature wird unterst\u00FCtzt
HYC00=Dieses Feature wird unterst\u00FCtzt\: {0}
HYT00=Zeit\u00FCberschreitung beim Versuch die Tabelle {0} zu sperren
......@@ -163,5 +163,5 @@
90139=The public static Java method was not found\: {0}
HY000=General error\: {0}
HY004=Unknown data type\: {0}
HYC00=Feature not supported
HYC00=Feature not supported\: {0}
HYT00=Timeout trying to lock table {0}
......@@ -163,5 +163,5 @@
90139=El metodo Java (publico y estatico) \: {0} no fue encontrado
HY000=Error General \: {0}
HY004=Tipo de dato desconocido \: {0}
HYC00=Caracteristica no soportada
HYC00=Caracteristica no soportada\: {0}
HYT00=Tiempo vencido intentando trabar (lock) la tabla {0}
......@@ -163,5 +163,5 @@
90139=public static\u3067\u3042\u308BJava\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\: {0}
HY000=\u4E00\u822C\u30A8\u30E9\u30FC\: {0}
HY004=\u4E0D\u660E\u306A\u30C7\u30FC\u30BF\u578B\: {0}
HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
HYC00=\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\: {0}
HYT00=\u30C6\u30FC\u30D6\u30EB {0} \u306E\u30ED\u30C3\u30AF\u8A66\u884C\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F
......@@ -163,5 +163,5 @@
90139=\#The public static Java method was not found\: {0}
HY000=Blad ogolny\: {0}
HY004=Nieznany typ danyche\: {0}
HYC00=Cecha nie jest wspierana
HYC00=Cecha nie jest wspierana\: {0}
HYT00=Czas oczekiwania na blokade tabeli {0} sie skonczyl
......@@ -163,5 +163,5 @@
90139=\#The public static Java method was not found\: {0}
HY000=Erro geral\: {0}
HY004=Tipo de dados desconhecido\: {0}
HYC00=Recurso n\u00E3o suportado
HYC00=Recurso n\u00E3o suportado\: {0}
HYT00=Timeout ao tentar bloquear a tabela {0}
......@@ -269,7 +269,7 @@ public class FileSystemDatabase extends FileSystem {
}
public void deleteRecursive(String fileName) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("db");
}
public boolean exists(String fileName) {
......@@ -407,7 +407,7 @@ public class FileSystemDatabase extends FileSystem {
long parentOld = getId(oldName, true);
long parentNew = getId(newName, true);
if (parentOld != parentNew) {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("different parents");
}
newName = getFileName(newName);
long id = getId(oldName, false);
......
......@@ -39,7 +39,7 @@ public class FileSystemZip extends FileSystem {
}
public void copy(String original, String copy) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public void createDirs(String fileName) {
......@@ -47,7 +47,7 @@ public class FileSystemZip extends FileSystem {
}
public boolean createNewFile(String fileName) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public String createTempFile(String prefix, String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException {
......@@ -58,11 +58,11 @@ public class FileSystemZip extends FileSystem {
}
public void delete(String fileName) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public void deleteRecursive(String fileName) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public boolean exists(String fileName) {
......@@ -209,11 +209,11 @@ public class FileSystemZip extends FileSystem {
}
public OutputStream openFileOutputStream(String fileName, boolean append) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public void rename(String oldName, String newName) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("write");
}
public boolean tryDelete(String fileName) {
......
......@@ -93,15 +93,15 @@ public class FunctionTable extends Table {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String comment) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public void removeRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public boolean canDrop() {
......@@ -109,11 +109,11 @@ public class FunctionTable extends Table {
}
public void addRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public void checkSupportAlter() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
public String getTableType() {
......@@ -145,7 +145,7 @@ public class FunctionTable extends Table {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("ALIAS");
}
/**
......
......@@ -548,7 +548,7 @@ public class MetaTable extends Table {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String comment) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void lock(Session session, boolean exclusive, boolean force) {
......@@ -1641,15 +1641,15 @@ public class MetaTable extends Table {
}
public void removeRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void addRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void removeChildrenAndResources(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void close(Session session) {
......@@ -1740,15 +1740,15 @@ public class MetaTable extends Table {
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void checkSupportAlter() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("META");
}
public long getRowCount(Session session) {
......
......@@ -79,23 +79,23 @@ public class RangeTable extends Table {
}
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, int headPos, String comment) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void removeRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void addRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void checkSupportAlter() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public void checkRename() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public boolean canGetRowCount() {
......@@ -153,7 +153,7 @@ public class RangeTable extends Table {
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("SYSTEM_RANGE");
}
public long getMaxDataModificationId() {
......
......@@ -331,7 +331,7 @@ public class TableLink extends Table {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String comment) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LINK");
}
public void lock(Session session, boolean exclusive, boolean force) {
......@@ -438,11 +438,11 @@ public class TableLink extends Table {
}
public void checkSupportAlter() throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LINK");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("LINK");
}
public boolean canGetRowCount() {
......
......@@ -205,24 +205,23 @@ public class TableView extends Table {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String comment) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void removeRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void addRow(Session session, Row row) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void checkSupportAlter() throws SQLException {
// TODO view: alter what? rename is ok
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public void truncate(Session session) throws SQLException {
throw Message.getUnsupportedException();
throw Message.getUnsupportedException("VIEW");
}
public long getRowCount(Session session) {
......
......@@ -11,6 +11,7 @@ import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.ResultSet;
......@@ -956,13 +957,12 @@ public class DataType {
*/
public static Object convertTo(SessionInterface session, JdbcConnection conn, Value v, Class paramClass)
throws SQLException {
if (paramClass == java.sql.Blob.class) {
if (paramClass == Blob.class) {
return new JdbcBlob(conn, v, 0);
} else if (paramClass == Clob.class) {
return new JdbcClob(conn, v, 0);
} else {
throw Message.getUnsupportedException();
}
throw Message.getUnsupportedException(paramClass.getName());
}
}
......@@ -433,11 +433,11 @@ public abstract class Value {
* @return the result
*/
public Value add(Value v) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
public int getSignum() throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
/**
......@@ -446,7 +446,7 @@ public abstract class Value {
* @return the negative
*/
public Value negate() throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
/**
......@@ -456,7 +456,7 @@ public abstract class Value {
* @return the result
*/
public Value subtract(Value v) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
/**
......@@ -466,7 +466,7 @@ public abstract class Value {
* @return the result
*/
public Value divide(Value v) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
/**
......@@ -476,7 +476,7 @@ public abstract class Value {
* @return the result
*/
public Value multiply(Value v) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
/**
......@@ -988,4 +988,14 @@ public abstract class Value {
return getTraceSQL();
}
/**
* Throw the exception that the feature is not support for the given data type.
*
* @return the exception
* @throws SQLException
*/
protected SQLException throwUnsupportedExceptionForType() throws SQLException {
throw Message.getUnsupportedException(DataType.getDataType(getType()).name);
}
}
......@@ -8,8 +8,6 @@ package org.h2.value;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.h2.message.Message;
import org.h2.util.MathUtils;
/**
......@@ -99,7 +97,7 @@ public class ValueArray extends Value {
}
public void set(PreparedStatement prep, int parameterIndex) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
public String getSQL() {
......
......@@ -112,7 +112,7 @@ public class ValueResultSet extends Value {
}
protected int compareSecure(Value v, CompareMode mode) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
public boolean equals(Object other) {
......@@ -132,7 +132,7 @@ public class ValueResultSet extends Value {
}
public void set(PreparedStatement prep, int parameterIndex) throws SQLException {
throw Message.getUnsupportedException();
throw throwUnsupportedExceptionForType();
}
public String getSQL() {
......
......@@ -284,10 +284,6 @@ java org.h2.test.TestAll timer
Console, Server, and Shell do not extend Tool yet.
DatabaseH2PoolTest.java
file_lock=serialized and then go back to auto_server=true
throws an exception "method not supported".
documentation: rolling review at roadmap.html:312
create a short 4 pages documentation
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论