提交 d4362134 authored 作者: Thomas Mueller's avatar Thomas Mueller

The database can now be compiled with Java 7.

上级 daa2d409
...@@ -18,14 +18,17 @@ Change Log ...@@ -18,14 +18,17 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Issue 289: Railroads (BNF) for "Column Definition" was incorrect. <ul><li>The database can now be compiled with Java 7.
Stub methods for the new JDBC 4.1 methods have been implemented,
but the new features can't be used yet.
</li><li>Issue 289: Railroads (BNF) for "Column Definition" was incorrect.
</li><li>Issue 287: Railroads (BNF) is not readable for certain web-browser configurations (dark background). </li><li>Issue 287: Railroads (BNF) is not readable for certain web-browser configurations (dark background).
</li><li>Executing a CSVREAD query multiple times could result in an exception if the data was changed on disk. </li><li>Executing a CSVREAD query multiple times could result in an exception if the data was changed on disk.
</li><li>SQL railroad diagrams: improved images for people with black background settings. </li><li>SQL railroad diagrams: improved images for people with black background settings.
</li><li>Build-in documentation search: improved results if searching for multiple words. </li><li>Build-in documentation search: improved results if searching for multiple words.
</li><li>DatabaseMetaData.getColumns: there is a typo in the JDBC specification, so that the column #19 is named </li><li>DatabaseMetaData.getColumns: there is a typo in the JDBC specification, so that the column #19 is named
SCOPE_CATLOG instead of SCOPE_CATALOG. For compatibility with the specification, this column is now also SCOPE_CATLOG instead of SCOPE_CATALOG. For compatibility with the specification, a new column #24
named SCOPE_CATLOG in H2. A new column named SCOPE_CATALOG is appended as column #24. named SCOPE_CATLOG is added. This typo is fixed in the JDBC 4.1 specification.
Please note that MySQL only supports SCOPE_CATALOG, while other databases only support SCOPE_CATLOG. Please note that MySQL only supports SCOPE_CATALOG, while other databases only support SCOPE_CATLOG.
</li><li>Build: jar files are now downloaded using Maven if possible (and cached in the local Maven repository). </li><li>Build: jar files are now downloaded using Maven if possible (and cached in the local Maven repository).
Unfortunately, in many cases this will download more data from the Maven repository. Unfortunately, in many cases this will download more data from the Maven repository.
......
...@@ -17,6 +17,10 @@ import org.h2.message.DbException; ...@@ -17,6 +17,10 @@ import org.h2.message.DbException;
import org.h2.message.TraceSystem; import org.h2.message.TraceSystem;
import org.h2.upgrade.DbUpgrade; import org.h2.upgrade.DbUpgrade;
/*## Java 1.7 begin ##
import java.util.logging.Logger;
## Java 1.7 end ##*/
/** /**
* The database driver. An application should not use this class directly. The * The database driver. An application should not use this class directly. The
* only thing the application needs to do is load the driver. This can be done * only thing the application needs to do is load the driver. This can be done
...@@ -131,6 +135,15 @@ public class Driver implements java.sql.Driver { ...@@ -131,6 +135,15 @@ public class Driver implements java.sql.Driver {
return true; return true;
} }
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public Logger getParentLogger() {
return null;
}
## Java 1.7 end ##*/
/** /**
* INTERNAL * INTERNAL
*/ */
......
...@@ -1478,6 +1478,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call ...@@ -1478,6 +1478,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* [Not supported]
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(int parameterIndex, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
/**
* [Not supported]
*
* @param parameterName the parameter name
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(String parameterName, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
private ResultSetMetaData getCheckedMetaData() throws SQLException { private ResultSetMetaData getCheckedMetaData() throws SQLException {
ResultSetMetaData meta = getMetaData(); ResultSetMetaData meta = getMetaData();
if (meta == null) { if (meta == null) {
......
...@@ -49,6 +49,10 @@ import java.sql.SQLXML; ...@@ -49,6 +49,10 @@ import java.sql.SQLXML;
import java.sql.SQLClientInfoException; import java.sql.SQLClientInfoException;
//## Java 1.6 end ## //## Java 1.6 end ##
/*## Java 1.7 begin ##
import java.util.concurrent.Executor;
## Java 1.7 end ##*/
/** /**
* <p> * <p>
* Represents a connection (session) to a database. * Represents a connection (session) to a database.
...@@ -1667,6 +1671,58 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -1667,6 +1671,58 @@ public class JdbcConnection extends TraceObject implements Connection {
return v; return v;
} }
/**
* [Not supported]
*
* @param schema the schema
*/
/*## Java 1.7 begin ##
public void setSchema(String schema) {
// not supported
}
## Java 1.7 end ##*/
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public String getSchema() {
return null;
}
## Java 1.7 end ##*/
/**
* [Not supported]
*
* @param executor the executor used by this method
*/
/*## Java 1.7 begin ##
public void abort(Executor executor) {
// not supported
}
## Java 1.7 end ##*/
/**
* [Not supported]
*
* @param executor the executor used by this method
* @param milliseconds the TCP connection timeout
*/
/*## Java 1.7 begin ##
public void setNetworkTimeout(Executor executor, int milliseconds) {
// not supported
}
## Java 1.7 end ##*/
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public int getNetworkTimeout() {
return 0;
}
## Java 1.7 end ##*/
private static void checkMap(Map<String, Class<?>> map) { private static void checkMap(Map<String, Class<?>> map) {
if (map != null && map.size() > 0) { if (map != null && map.size() > 0) {
throw DbException.getUnsupportedException("map.size > 0"); throw DbException.getUnsupportedException("map.size > 0");
......
...@@ -197,13 +197,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -197,13 +197,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* <li>16 CHAR_OCTET_LENGTH (int) unused </li> * <li>16 CHAR_OCTET_LENGTH (int) unused </li>
* <li>17 ORDINAL_POSITION (int) the column index (1,2,...) </li> * <li>17 ORDINAL_POSITION (int) the column index (1,2,...) </li>
* <li>18 IS_NULLABLE (String) "NO" or "YES" </li> * <li>18 IS_NULLABLE (String) "NO" or "YES" </li>
* <li>19 SCOPE_CATLOG (String) always null * <li>19 SCOPE_CATALOG (String) always null </li>
* (the typo is on purpose, for compatibility with the specification)</li>
* <li>20 SCOPE_SCHEMA (String) always null </li> * <li>20 SCOPE_SCHEMA (String) always null </li>
* <li>21 SCOPE_TABLE (String) always null </li> * <li>21 SCOPE_TABLE (String) always null </li>
* <li>22 SOURCE_DATA_TYPE (short) null </li> * <li>22 SOURCE_DATA_TYPE (short) null </li>
* <li>23 IS_AUTOINCREMENT (String) "NO" or "YES" </li> * <li>23 IS_AUTOINCREMENT (String) "NO" or "YES" </li>
* <li>24 SCOPE_CATALOG (String) always null </li> * <li>24 SCOPE_CATLOG (String) always null
* (the typo is on purpose, for compatibility with the JDBC specification prior to 4.1)</li>
* </ul> * </ul>
* *
* @param catalogPattern null (to get all objects) or the catalog name * @param catalogPattern null (to get all objects) or the catalog name
...@@ -246,12 +246,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -246,12 +246,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH, " + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH, "
+ "ORDINAL_POSITION, " + "ORDINAL_POSITION, "
+ "IS_NULLABLE IS_NULLABLE, " + "IS_NULLABLE IS_NULLABLE, "
+ "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATLOG, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATALOG, "
+ "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_SCHEMA, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_SCHEMA, "
+ "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_TABLE, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_TABLE, "
+ "SOURCE_DATA_TYPE, " + "SOURCE_DATA_TYPE, "
+ "CASE WHEN SEQUENCE_NAME IS NULL THEN 'NO' ELSE 'YES' END IS_AUTOINCREMENT, " + "CASE WHEN SEQUENCE_NAME IS NULL THEN 'NO' ELSE 'YES' END IS_AUTOINCREMENT, "
+ "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATALOG " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATLOG "
+ "FROM INFORMATION_SCHEMA.COLUMNS " + "FROM INFORMATION_SCHEMA.COLUMNS "
+ "WHERE TABLE_CATALOG LIKE ? ESCAPE '\\' " + "WHERE TABLE_CATALOG LIKE ? ESCAPE '\\' "
+ "AND TABLE_SCHEMA LIKE ? ESCAPE '\\' " + "AND TABLE_SCHEMA LIKE ? ESCAPE '\\' "
...@@ -2848,6 +2848,33 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat ...@@ -2848,6 +2848,33 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public boolean generatedKeyAlwaysReturned() {
return true;
}
## Java 1.7 end ##*/
/**
* [Not supported]
*
* @param catalog null (to get all objects) or the catalog name
* @param schemaPattern null (to get all objects) or a schema name
* (uppercase for unquoted names)
* @param tableNamePattern null (to get all objects) or a table name
* (uppercase for unquoted names)
* @param columnNamePattern null (to get all objects) or a column name
* (uppercase for unquoted names)
*/
/*## Java 1.7 begin ##
public ResultSet getPseudoColumns(String catalog, String schemaPattern,
String tableNamePattern, String columnNamePattern) {
return null;
}
## Java 1.7 end ##*/
/** /**
* INTERNAL * INTERNAL
*/ */
......
...@@ -3421,6 +3421,30 @@ public class JdbcResultSet extends TraceObject implements ResultSet { ...@@ -3421,6 +3421,30 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* [Not supported]
*
* @param columnIndex the column index (1, 2, ...)
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(int columnIndex, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
/**
* [Not supported]
*
* @param columnName the column name
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(String columnName, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
/** /**
* INTERNAL * INTERNAL
*/ */
......
...@@ -870,6 +870,24 @@ public class JdbcStatement extends TraceObject implements Statement { ...@@ -870,6 +870,24 @@ public class JdbcStatement extends TraceObject implements Statement {
} }
//## Java 1.4 end ## //## Java 1.4 end ##
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public void closeOnCompletion() {
// not supported
}
## Java 1.7 end ##*/
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public boolean isCloseOnCompletion() {
return true;
}
## Java 1.7 end ##*/
// ============================================================= // =============================================================
/** /**
......
...@@ -35,6 +35,10 @@ import javax.sql.PooledConnection; ...@@ -35,6 +35,10 @@ import javax.sql.PooledConnection;
import org.h2.message.DbException; import org.h2.message.DbException;
//## Java 1.6 end ## //## Java 1.6 end ##
/*## Java 1.7 begin ##
import java.util.logging.Logger;
## Java 1.7 end ##*/
/** /**
* A simple standalone JDBC connection pool. * A simple standalone JDBC connection pool.
* It is based on the * It is based on the
...@@ -318,4 +322,14 @@ public class JdbcConnectionPool implements DataSource, ConnectionEventListener { ...@@ -318,4 +322,14 @@ public class JdbcConnectionPool implements DataSource, ConnectionEventListener {
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public Logger getParentLogger() {
return null;
}
## Java 1.7 end ##*/
} }
...@@ -26,6 +26,10 @@ import org.h2.jdbc.JdbcConnection; ...@@ -26,6 +26,10 @@ import org.h2.jdbc.JdbcConnection;
import org.h2.message.TraceObject; import org.h2.message.TraceObject;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
/*## Java 1.7 begin ##
import java.util.logging.Logger;
## Java 1.7 end ##*/
/** /**
* A data source for H2 database connections. It is a factory for XAConnection * A data source for H2 database connections. It is a factory for XAConnection
* and Connection objects. This class is usually registered in a JNDI naming * and Connection objects. This class is usually registered in a JNDI naming
...@@ -387,6 +391,15 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -387,6 +391,15 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* [Not supported]
*/
/*## Java 1.7 begin ##
public Logger getParentLogger() {
return null;
}
## Java 1.7 end ##*/
/** /**
* INTERNAL * INTERNAL
*/ */
......
...@@ -2123,6 +2123,30 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData { ...@@ -2123,6 +2123,30 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
} }
//## Java 1.6 end ## //## Java 1.6 end ##
/**
* INTERNAL
*
* @param columnIndex the column index (1, 2, ...)
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(int columnIndex, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
/**
* INTERNAL
*
* @param columnName the column name
* @param type the class of the returned value
*/
/*## Java 1.7 begin ##
public <T> T getObject(String columnName, Class<T> type) {
return null;
}
## Java 1.7 end ##*/
/** /**
* Set the auto-close behavior. If enabled (the default), the result set is * Set the auto-close behavior. If enabled (the default), the result set is
* closed after reading the last row. * closed after reading the last row.
......
...@@ -667,7 +667,7 @@ public class TestMetaData extends TestBase { ...@@ -667,7 +667,7 @@ public class TestMetaData extends TestBase {
assertResultSetMeta(rs, 24, new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", assertResultSetMeta(rs, 24, new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE",
"TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS",
"COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION",
"IS_NULLABLE", "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "SCOPE_CATALOG" }, "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "SCOPE_CATLOG" },
new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER,
Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER,
......
...@@ -63,21 +63,31 @@ public class SwitchSource { ...@@ -63,21 +63,31 @@ public class SwitchSource {
disable.add("Java 1.4"); disable.add("Java 1.4");
disable.add("Java 1.5"); disable.add("Java 1.5");
disable.add("Java 1.6"); disable.add("Java 1.6");
disable.add("Java 1.7");
} else if ("1.4".equals(version)) { } else if ("1.4".equals(version)) {
disable.add("Java 1.3 only"); disable.add("Java 1.3 only");
enable.add("Java 1.4"); enable.add("Java 1.4");
disable.add("Java 1.5"); disable.add("Java 1.5");
disable.add("Java 1.6"); disable.add("Java 1.6");
disable.add("Java 1.7");
} else if ("1.5".equals(version)) { } else if ("1.5".equals(version)) {
disable.add("Java 1.3 only"); disable.add("Java 1.3 only");
enable.add("Java 1.4"); enable.add("Java 1.4");
enable.add("Java 1.5"); enable.add("Java 1.5");
disable.add("Java 1.6"); disable.add("Java 1.6");
} else if (version.compareTo("1.6") >= 0) { disable.add("Java 1.7");
} else if ("1.6".equals(version)) {
disable.add("Java 1.3 only"); disable.add("Java 1.3 only");
enable.add("Java 1.4"); enable.add("Java 1.4");
enable.add("Java 1.5"); enable.add("Java 1.5");
enable.add("Java 1.6"); enable.add("Java 1.6");
disable.add("Java 1.7");
} else if (version.compareTo("1.7") >= 0) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5");
enable.add("Java 1.6");
enable.add("Java 1.7");
} else { } else {
throw new IllegalArgumentException("version: " + version); throw new IllegalArgumentException("version: " + version);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论