提交 78e7ad72 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
#Sat Mar 29 10:53:56 CET 2008
benchmark.drivers.dir=C\:/data/java
javac=javac
jdk=1.4
path.lucene.jar=C\:/data/classpath/lucene-core-2.2.0.jar
path.servlet.jar=C\:/data/classpath/servlet-api.jar
version.name.maven=1.0.69
<project name="h2" default="all" basedir=".">
<!-- dependencies (optional):
http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
(actually any servlet api)
http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar
(or newer)
-->
<property file="ant-build.properties" />
<!-- jar files required by the benchmark -->
......@@ -17,10 +11,9 @@
</fileset>
</path>
<target name="all" depends="jar,javadoc,docs">
<target name="all" depends="jar, javadoc, docs">
<delete includeemptydirs="true">
<fileset dir="bin" includes="**/*.txt"/>
<fileset dir="bin" includes="h2-test.exe"/>
<fileset dir="bin" includes="org/**/*"/>
<fileset dir="bin" includes="org"/>
<fileset dir="bin" includes="META-INF/**/*"/>
......@@ -51,43 +44,7 @@
</delete>
</target>
<target name="codeswitchPrepare" depends="clean">
<javac executable="${javac}" srcdir="src/tools" destdir="bin" debug="true" includes="org/h2/build/code/CodeSwitch.java"/>
</target>
<target name="codeswitchAndroid" depends="codeswitchPrepare">
<java classname="org.h2.build.code.CodeSwitch" classpath="bin">
<arg line="+JDK13 -JDK14 -JDK16 -AWT src/main/org/h2 -set ant-build.properties jdk 1.3"/>
</java>
</target>
<target name="codeswitchJdk13" depends="codeswitchPrepare">
<java classname="org.h2.build.code.CodeSwitch" classpath="bin">
<arg line="+JDK13 -JDK14 -JDK16 +AWT src/main/org/h2 -set ant-build.properties jdk 1.3"/>
</java>
</target>
<target name="codeswitchJdk14" depends="codeswitchPrepare">
<java classname="org.h2.build.code.CodeSwitch" classpath="bin">
<arg line="-JDK13 +JDK14 -JDK16 +AWT src/main/org/h2 -set ant-build.properties jdk 1.4"/>
</java>
</target>
<target name="codeswitchJdk16" depends="codeswitchPrepare">
<java classname="org.h2.build.code.CodeSwitch" classpath="bin">
<arg line="-JDK13 +JDK14 +JDK16 +AWT src/main/org/h2 -set ant-build.properties jdk 1.6"/>
</java>
</target>
<target name="codeswitchJdk14Auto" if="codeswitch.14">
<antcall target="codeswitchJdk14" />
</target>
<target name="codeswitchJdk16Auto" if="codeswitch.16">
<antcall target="codeswitchJdk16" />
</target>
<target name="compileResources" depends="clean, codeswitchJdk14Auto, codeswitchJdk16Auto">
<target name="compileResources" depends="clean">
<javac executable="${javac}" srcdir="src/main" destdir="bin" debug="true" includes="org/h2/util/Resources.java"/>
<java classname="org.h2.util.Resources" classpath="bin"/>
<delete>
......@@ -99,44 +56,13 @@
</delete>
</target>
<target name="compileFullTextLucene" depends="compileFullTextLuceneTest, compile" if="lucene.jar.present">
<javac executable="${javac}" srcdir="src/main" destdir="bin" debug="true">
<classpath location="${path.lucene.jar}" />
<include name="org/h2/fulltext/FullTextLucene.java"/>
</javac>
</target>
<target name="compileFullTextLuceneTest" depends="init" unless="lucene.jar.present">
<echo message="Lucene jar not found, LuceneFullText not compiled."/>
<echo message="Please set ant-build.properties / path.lucene.jar"/>
</target>
<target name="compileServlet" depends="compileServletTest, compile" if="servlet.jar.present">
<javac executable="${javac}" destdir="bin" debug="true">
<src path="src/main"/>
<src path="src/test"/>
<classpath location="${path.servlet.jar}" />
<include name="org/h2/server/web/WebServlet.java"/>
<include name="org/h2/server/web/DbStarter.java"/>
<include name="org/h2/test/unit/TestServlet.java"/>
</javac>
</target>
<target name="compileServletTest" depends="init" unless="servlet.jar.present">
<echo message="Servlet API jar not found, console servlet not compiled."/>
<echo message="Please set ant-build.properties / path.servlet.jar"/>
</target>
<target name="compile" depends="compileResources">
<echo message="build-jdk:${java.specification.version} ant-build.properties/jdk:${jdk}"></echo>
<target name="compile" depends="compileResources, switchSourceAuto, downloadServletJar, downloadLuceneJar">
<javac executable="${javac}" destdir="bin" debug="true">
<classpath location="ext/servlet-api-2.4.jar" />
<classpath location="ext/lucene-core-2.2.0.jar" />
<src path="src/main"/>
<src path="src/test"/>
<src path="src/tools"/>
<exclude name="org/h2/fulltext/FullTextLucene.java"/>
<exclude name="org/h2/server/web/WebServlet.java"/>
<exclude name="org/h2/server/web/DbStarter.java"/>
<exclude name="org/h2/test/unit/TestServlet.java"/>
</javac>
<copy todir="bin" overwrite="true">
<fileset dir="src/main" includes="META-INF/**/*"/>
......@@ -174,27 +100,24 @@
<java classname="org.h2.build.doc.XMLChecker" classpath="bin"/>
<java classname="org.h2.build.doc.SpellChecker" classpath="bin"/>
</target>
<target name="downloadServletJar" depends="init" unless="servlet.jar.present">
<get dest="ext/servlet-api-2.4.jar"
src="http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar" />
</target>
<target name="downloadLuceneJar" depends="init" unless="lucene.jar.present">
<get dest="ext/lucene-core-2.2.0.jar"
src="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar" />
</target>
<target name="init">
<available file="${path.servlet.jar}" property="servlet.jar.present"/>
<available file="${path.lucene.jar}" property="lucene.jar.present"/>
<condition property="codeswitch.14">
<and>
<equals arg1="${java.specification.version}" arg2="1.4"/>
<equals arg1="${jdk}" arg2="1.6"/>
</and>
</condition>
<condition property="codeswitch.16">
<and>
<equals arg1="${java.specification.version}" arg2="1.6"/>
<not>
<equals arg1="${jdk}" arg2="1.6"/>
</not>
</and>
</condition>
<mkdir dir="ext"/>
<available file="ext/servlet-api-2.4.jar" property="servlet.jar.present"/>
<available file="ext/lucene-core-2.2.0.jar" property="lucene.jar.present"/>
</target>
<target name="jar" depends="compile, compileServlet, compileFullTextLucene, manifest">
<target name="jar" depends="compile, manifest">
<manifest file="bin/META-INF/MANIFEST.MF" mode="update">
<attribute name="Main-Class" value="org.h2.tools.Console"/>
</manifest>
......@@ -316,6 +239,40 @@
<arg value="-DpomFile=bin/pom.xml"/>
</exec>
</target>
<target name="switchSourcePrepare" depends="clean">
<javac executable="${javac}" srcdir="src/tools" destdir="bin" debug="true" includes="org/h2/build/code/SwitchSource.java"/>
</target>
<target name="switchSourceAndroid" depends="switchSourcePrepare">
<java classname="org.h2.build.code.SwitchSource" classpath="bin">
<arg line="-version 1.3 -AWT -dir src/main/org/h2"/>
</java>
</target>
<target name="switchSourceAuto" depends="switchSourcePrepare">
<java classname="org.h2.build.code.SwitchSource" classpath="bin">
<arg line="-auto -dir src/main/org/h2"/>
</java>
</target>
<target name="switchSourceJdk13" depends="switchSourcePrepare">
<java classname="org.h2.build.code.SwitchSource" classpath="bin">
<arg line="-version 1.3 +AWT -dir src/main/org/h2"/>
</java>
</target>
<target name="switchSourceJdk14" depends="switchSourcePrepare">
<java classname="org.h2.build.code.SwitchSource" classpath="bin">
<arg line="-version 1.4 +AWT -dir src/main/org/h2"/>
</java>
</target>
<target name="switchSourceJdk16" depends="switchSourcePrepare">
<java classname="org.h2.build.code.SwitchSource" classpath="bin">
<arg line="-version 1.6 +AWT -dir src/main/org/h2"/>
</java>
</target>
<target name="test" depends="compile">
<java classname="org.h2.test.TestAll" fork="true" classpath="bin" />
......@@ -327,39 +284,13 @@
</java>
</target>
<target name="warConsole" depends="compileServlet, jar">
<fail unless="servlet.jar.present" message="Servlet API jar not found"/>
<target name="warConsole" depends="jar">
<war destfile="bin/h2console.war" webxml="src/tools/WEB-INF/web.xml" basedir="src/tools/WEB-INF" includes="console.html">
<lib file="bin/h2.jar" />
</war>
</target>
<target name="zip">
<delete includeemptydirs="true">
<fileset dir="dist" includes="**/*"/>
</delete>
<copy todir="dist">
<fileset dir=".." includes="h2/build.xml"/>
<fileset dir=".." includes="h2/ant-build.properties"/>
<fileset dir=".." includes="h2/bin/**/*"/>
<fileset dir=".." includes="h2/docs/**/*"/>
<fileset dir=".." includes="h2/service/**/*"/>
<fileset dir=".." includes="h2/src/**/*"/>
</copy>
<tar destfile="../h2.tar">
<fileset dir="dist" includes="**/*.java,**/*.css,**/*.js" />
<fileset dir="dist" includes="**/*.xml" />
<fileset dir="dist" includes="**/*.html,**/*.jsp" />
<fileset dir="dist" includes="**/*.csv,**/*.txt,**/*.properties" />
<fileset dir="dist" includes="**/*.sql,**/*.bat" />
<fileset dir="dist" excludes="**/*.java,,**/*.css,**/*.js,**/*.xml,**/*.html,**/*.jsp,**/*.csv,**/*.txt,**/*.properties,**/*.sql,**/*.bat" />
</tar>
<bzip2 destfile="../h2.tar.bz2" src="../h2.tar" />
<zip destfile="../h2.zip">
<fileset dir=".." includes="h2/build.xml"/>
<fileset dir=".." includes="h2/ant-build.properties"/>
......
......@@ -14,7 +14,26 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>.
<ul><li>The autocomplete in the H2 Console has been improved a bit.
</li><li>The tools in the H2 Console are now translatable.
</li><li>Invalid inline views threw confusing SQL exceptions.
</li><li>The Japanese translation of the error messages and the
H2 Console has been improved. Thanks a lot to Masahiro IKEMOTO.
</li><li>Optimization for MIN() and MAX() when using MVCC.
</li><li>To protect against remote brute force password attacks,
the delay after each unsuccessful login now gets double as long.
New system properties h2.delayWrongPasswordMin
and h2.delayWrongPasswordMax.
</li><li>After setting the query timeout and then resetting it, the next query
would still timeout. Fixed.
</li><li>Adding a IDENTITY column to a table with data threw a lock timeout.
</li><li>OutOfMemoryError could occur when using EXISTS or IN(SELECT ..).
</li><li>The built-in connection pool is not called JdbcConnectionPool.
The API and documentation has been changed.
</li><li>The ConvertTraceFile tool now generates SQL statement statistics
at the end of the SQL script file (similar to the profiling data
generated when using java -Xrunhprof).
</li><li>Nested joins are now supported (A JOIN B JOIN C ON .. ON ..)
</li></ul>
<h2>Version 1.0.69 (2008-03-29)</h2>
......
......@@ -401,6 +401,9 @@ Roadmap
</li><li>Maven: upload source code and javadocs as well
</li><li>Write (log) to system table before adding to internal data structures
</li><li>Support very large deletes and updates
</li><li>Doclet (javadocs): constructors are not listed
</li><li>Support direct lookup for MIN and MAX when using WHERE (see todo.txt / Direct Lookup)
</li><li>Support other array types (String[], double[]) in PreparedStatement.setObject(int, Object);
</li></ul>
<h2>Not Planned</h2>
......
......@@ -1296,7 +1296,7 @@ public class ErrorCode {
* the source code is not compiled for the Java platform used.
* At runtime, the existence of the class java.sql.Savepoint is checked.
* To run this database in JDK 1.3, it is first required to switch the
* source code to JDK 1.3 using ant codeswitchJdk13.
* source code to JDK 1.3 using ant switchSourceJdk13.
*/
public static final int UNSUPPORTED_JAVA_VERSION = 90092;
......
......@@ -21,7 +21,7 @@ package org.h2.engine;
* set classpath=
* ant javadoc
* ant javadocImpl (to find missing javadocs)
* ant codeswitchJdk14
* ant switchSourceJdk14
* ant javadocImpl
*
* - Change version and build number in
......@@ -53,7 +53,7 @@ package org.h2.engine;
* - table of contents
* - Switch off auto-build
* - ant all
* - Make sure FullTextLucene is included in h2.jar
* - Make sure external jars are not included
* - Copy the pdf file to h2/docs
* - Make sure the build files are removed
* - ant zip
......
......@@ -5,7 +5,7 @@
*/
package org.h2.fulltext;
//#ifdef JDK14
//## Java 1.4 begin ##
import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
......@@ -39,18 +39,18 @@ import org.h2.store.fs.FileSystem;
import org.h2.tools.SimpleResultSet;
import org.h2.util.ByteUtils;
import org.h2.util.StringUtils;
//#endif
//## Java 1.4 end ##
/**
* This class implements the full text search based on Apache Lucene.
*/
public class FullTextLucene extends FullText
//#ifdef JDK14
//## Java 1.4 begin ##
implements Trigger
//#endif
//## Java 1.4 end ##
{
//#ifdef JDK14
//## Java 1.4 begin ##
private static HashMap indexers = new HashMap();
private static final String FIELD_DATA = "DATA";
private static final String FIELD_QUERY = "QUERY";
......@@ -64,7 +64,7 @@ implements Trigger
private String[] columnNames;
private int[] dataTypes;
private IndexModifier indexer;
//#endif
//## Java 1.4 end ##
/**
* Create a new full text index for a table and column list. Each table may
......@@ -75,7 +75,7 @@ implements Trigger
* @param table the table name
* @param columnList the column list (null for all columns)
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException {
init(conn);
PreparedStatement prep = conn.prepareStatement("INSERT INTO "+SCHEMA+".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)");
......@@ -86,14 +86,14 @@ implements Trigger
createTrigger(conn, schema, table);
indexExistingRows(conn, schema, table);
}
//#endif
//## Java 1.4 end ##
/**
* Re-creates the full text index for this database
*
* @param conn the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static void reindex(Connection conn) throws SQLException {
init(conn);
removeAllTriggers(conn);
......@@ -107,21 +107,21 @@ implements Trigger
indexExistingRows(conn, schema, table);
}
}
//#endif
//## Java 1.4 end ##
/**
* Drops all full text indexes from the database.
*
* @param conn the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static void dropAll(Connection conn) throws SQLException {
Statement stat = conn.createStatement();
stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA);
removeAllTriggers(conn);
removeIndexFiles(conn);
}
//#endif
//## Java 1.4 end ##
/**
* Initializes full text search functionality for this database. This adds
......@@ -145,7 +145,7 @@ implements Trigger
*
* @param conn
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static void init(Connection conn) throws SQLException {
Statement stat = conn.createStatement();
stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA);
......@@ -156,12 +156,12 @@ implements Trigger
stat.execute("CREATE ALIAS IF NOT EXISTS FTL_REINDEX FOR \"" + FullTextLucene.class.getName() + ".reindex\"");
stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_ALL FOR \"" + FullTextLucene.class.getName() + ".dropAll\"");
}
//#endif
//## Java 1.4 end ##
/**
* INTERNAL
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException {
init(conn);
this.schemaName = schemaName;
......@@ -212,12 +212,12 @@ implements Trigger
indexColumns = new int[indexList.size()];
setColumns(indexColumns, indexList, columnList);
}
//#endif
//## Java 1.4 end ##
/**
* INTERNAL
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException {
if (oldRow != null) {
delete(oldRow);
......@@ -226,7 +226,7 @@ implements Trigger
insert(newRow);
}
}
//#endif
//## Java 1.4 end ##
/**
* Searches from the full text index for this database. The result contains
......@@ -247,11 +247,11 @@ implements Trigger
* @param offset the offset or 0 for no offset
* @return the result set
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException {
return search(conn, text, limit, offset, true);
}
//#endif
//## Java 1.4 end ##
/**
* Searches from the full text index for this database.
......@@ -267,7 +267,7 @@ implements Trigger
* @param offset the offset or 0 for no offset
* @return the result set
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException {
return search(conn, text, limit, offset, false);
}
......@@ -602,6 +602,6 @@ implements Trigger
index[i] = found;
}
}
//#endif
//## Java 1.4 end ##
}
......@@ -15,13 +15,11 @@ import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.NClob;
import java.sql.SQLXML;
import java.sql.RowId;
*/
//#endif
## Java 1.6 end ##*/
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
......@@ -608,35 +606,29 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(int parameterIndex) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(String parameterName) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setRowId(String parameterName, RowId x) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
......@@ -655,13 +647,11 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setNClob(String parameterName, NClob value) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
......@@ -687,58 +677,48 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(int parameterIndex) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(String parameterName) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setSQLXML(String parameterName, SQLXML xmlObject)
throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(int parameterIndex) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(String parameterName) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
......
......@@ -20,21 +20,17 @@ import org.h2.message.TraceObject;
import org.h2.util.IOUtils;
import org.h2.value.Value;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.NClob;
*/
//#endif
## Java 1.6 end ##*/
/**
* Represents a CLOB value.
*/
public class JdbcClob extends TraceObject implements Clob
//#ifdef JDK16
/*
, NClob
*/
//#endif
/*## Java 1.6 begin ##
, NClob
## Java 1.6 end ##*/
{
private Value value;
......
......@@ -41,15 +41,13 @@ import org.h2.value.ValueLob;
import org.h2.value.ValueNull;
import org.h2.value.ValueString;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.Array;
import java.sql.NClob;
import java.sql.Struct;
import java.sql.SQLXML;
import java.sql.SQLClientInfoException;
*/
//#endif
## Java 1.6 end ##*/
/**
* Represents a connection (session) to a database.
......@@ -70,9 +68,10 @@ public class JdbcConnection extends TraceObject implements Connection {
private CommandInterface setLockMode, getLockMode;
private CommandInterface setQueryTimeout, getQueryTimeout;
private Exception openStackTrace;
//#ifdef JDK14
//## Java 1.4 begin ##
private int savepointId;
//#endif
//## Java 1.4 end ##
private Trace trace;
private JdbcConnectionListener listener;
private boolean isInternal;
......@@ -785,7 +784,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*
* @return the new savepoint
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public Savepoint setSavepoint() throws SQLException {
try {
int id = getNextId(TraceObject.SAVEPOINT);
......@@ -802,14 +801,14 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
/**
* Creates a new named savepoint.
*
* @return the new savepoint
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public Savepoint setSavepoint(String name) throws SQLException {
try {
int id = getNextId(TraceObject.SAVEPOINT);
......@@ -825,12 +824,12 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
/**
* Rolls back to a savepoint.
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public void rollback(Savepoint savepoint) throws SQLException {
try {
JdbcSavepoint sp = convertSavepoint(savepoint);
......@@ -841,12 +840,12 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
/**
* Releases a savepoint.
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
try {
debugCode("releaseSavepoint(savepoint);");
......@@ -863,7 +862,7 @@ public class JdbcConnection extends TraceObject implements Connection {
}
return (JdbcSavepoint) savepoint;
}
//#endif
//## Java 1.4 end ##
/**
* Creates a prepared statement with the specified result set type,
......@@ -1006,11 +1005,11 @@ public class JdbcConnection extends TraceObject implements Connection {
private void checkJavaVersion() throws SQLException {
try {
//#ifdef JDK14
//## Java 1.4 begin ##
// check for existence of this class (avoiding Class . forName)
Class clazz = java.sql.Savepoint.class;
clazz.getClass();
//#endif
//## Java 1.4 end ##
} catch (Throwable e) {
throw Message.getSQLException(ErrorCode.UNSUPPORTED_JAVA_VERSION);
}
......@@ -1210,12 +1209,12 @@ public class JdbcConnection extends TraceObject implements Connection {
private void checkHoldability(int resultSetHoldability) throws SQLException {
// TODO compatibility / correctness: DBPool uses
// ResultSet.HOLD_CURSORS_OVER_COMMIT
//#ifdef JDK14
//## Java 1.4 begin ##
if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT
&& resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw Message.getInvalidValueException("" + resultSetHoldability, "resultSetHoldability");
}
//#endif
//## Java 1.4 end ##
}
void checkClosed() throws SQLException {
......@@ -1326,8 +1325,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*
* @return the object
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob createNClob() throws SQLException {
try {
int id = getNextId(TraceObject.CLOB);
......@@ -1339,43 +1337,36 @@ public class JdbcConnection extends TraceObject implements Connection {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Create a new empty SQLXML object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML createSQLXML() throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Create a new empty Array object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Create a new empty Struct object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns true if this connection is still valid.
......@@ -1398,36 +1389,30 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* [Not supported] Set a client property.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setClientInfo(String name, String value)
throws SQLClientInfoException {
throw new SQLClientInfoException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Set the client properties.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setClientInfo(Properties properties) throws SQLClientInfoException {
throw new SQLClientInfoException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Get the client properties.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public Properties getClientInfo() throws SQLClientInfoException {
throw new SQLClientInfoException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Set a client property.
......@@ -1441,26 +1426,22 @@ public class JdbcConnection extends TraceObject implements Connection {
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
Value createClob(Reader x, long length) throws SQLException {
if (x == null) {
......
......@@ -9,11 +9,9 @@ import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.RowIdLifetime;
*/
//#endif
## Java 1.6 end ##*/
import java.sql.SQLException;
import org.h2.constant.SysProperties;
......@@ -2524,23 +2522,23 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* CLOSE_CURSORS_AT_COMMIT
* @return true if the holdability is ResultSet.CLOSE_CURSORS_AT_COMMIT
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public boolean supportsResultSetHoldability(int holdability) {
debugCodeCall("supportsResultSetHoldability", holdability);
return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
//#endif
//## Java 1.4 end ##
/**
* Gets the result set holdability.
* @return ResultSet.CLOSE_CURSORS_AT_COMMIT
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public int getResultSetHoldability() {
debugCodeCall("getResultSetHoldability");
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
//#endif
//## Java 1.4 end ##
/**
* Gets the major version of the database.
......@@ -2582,12 +2580,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* Gets the SQL State type.
* @return DatabaseMetaData.sqlStateSQL99
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public int getSQLStateType() {
debugCodeCall("getSQLStateType");
return DatabaseMetaData.sqlStateSQL99;
}
//#endif
//## Java 1.4 end ##
/**
* Does the database make a copy before updating.
......@@ -2635,14 +2633,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* Get the lifetime of a rowid.
* @return ROWID_UNSUPPORTED
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowIdLifetime getRowIdLifetime() {
debugCodeCall("getRowIdLifetime");
return RowIdLifetime.ROWID_UNSUPPORTED;
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Gets the list of schemas.
......@@ -2681,26 +2677,22 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/**
* [Not supported] Return an object of this class if possible.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Gets the list of function columns.
......
......@@ -19,9 +19,9 @@ import org.h2.message.TraceObject;
* Information about the parameters of a prepared statement.
*/
public class JdbcParameterMetaData extends TraceObject
//#ifdef JDK14
//## Java 1.4 begin ##
implements ParameterMetaData
//#endif
//## Java 1.4 end ##
{
private JdbcPreparedStatement prep;
......@@ -48,7 +48,7 @@ implements ParameterMetaData
*
* @return parameterModeIn
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public int getParameterMode(int param) throws SQLException {
try {
debugCodeCall("getParameterMode", param);
......@@ -58,7 +58,7 @@ implements ParameterMetaData
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
/**
* Returns the parameter type.
......@@ -192,26 +192,22 @@ implements ParameterMetaData
/**
* [Not supported] Return an object of this class if possible.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -12,10 +12,10 @@ import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
//#ifdef JDK14
//## Java 1.4 begin ##
import java.sql.ParameterMetaData;
import java.sql.Statement;
//#endif
//## Java 1.4 end ##
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
......@@ -50,13 +50,11 @@ import org.h2.value.ValueString;
import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.RowId;
import java.sql.NClob;
import java.sql.SQLXML;
*/
//#endif
## Java 1.6 end ##*/
/**
* Represents a prepared statement.
......@@ -1050,9 +1048,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
next = e;
}
logAndConvert(e);
//#ifdef JDK14
//## Java 1.4 begin ##
result[i] = Statement.EXECUTE_FAILED;
//#endif
//## Java 1.4 end ##
error = true;
}
}
......@@ -1193,7 +1191,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
* @return the meta data
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public ParameterMetaData getParameterMetaData() throws SQLException {
try {
int id = getNextId(TraceObject.PARAMETER_META_DATA);
......@@ -1207,7 +1205,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
// =============================================================
......@@ -1231,13 +1229,11 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/**
* [Not supported] Sets the value of a parameter as a row id.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setRowId(int parameterIndex, RowId x) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Sets the value of a parameter.
......@@ -1297,8 +1293,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* @param x the value
* @throws SQLException if this object is closed
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setNClob(int parameterIndex, NClob x) throws SQLException {
try {
if (debug()) {
......@@ -1316,8 +1311,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Sets the value of a parameter as a Clob.
......@@ -1402,13 +1396,11 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/**
* [Not supported] Sets the value of a parameter as a SQLXML object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -25,13 +25,11 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLXML;
*/
//#endif
## Java 1.6 end ##*/
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
......@@ -3030,26 +3028,22 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
*
* @param columnIndex (1,2,...)
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(int columnIndex) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Returns the value of the specified column as a row id.
*
* @param columnName the name of the column label
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(String columnName) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Updates a column in the current or insert row.
......@@ -3057,13 +3051,11 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
* @param columnIndex (1,2,...)
* @param x the value
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateRowId(int columnIndex, RowId x) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Updates a column in the current or insert row.
......@@ -3071,13 +3063,11 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
* @param columnName the name of the column label
* @param x the value
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateRowId(String columnName, RowId x) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns the current result set holdability.
......@@ -3148,8 +3138,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(int columnIndex, NClob x) throws SQLException {
try {
if (debug()) {
......@@ -3160,14 +3149,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(int columnIndex, Reader x) throws SQLException {
try {
if (debug()) {
......@@ -3178,14 +3165,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(int columnIndex, Reader x, long length)
throws SQLException {
try {
......@@ -3197,14 +3182,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(String columnName, Reader x)
throws SQLException {
try {
......@@ -3216,14 +3199,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(String columnName, Reader x, long length)
throws SQLException {
try {
......@@ -3235,14 +3216,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported]
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(String columnName, NClob x) throws SQLException {
try {
if (debug()) {
......@@ -3253,8 +3232,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
......@@ -3264,8 +3242,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(int columnIndex) throws SQLException {
try {
int id = getNextId(TraceObject.CLOB);
......@@ -3276,8 +3253,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns the value of the specified column as a Clob.
......@@ -3286,8 +3262,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(String columnName) throws SQLException {
try {
int id = getNextId(TraceObject.CLOB);
......@@ -3298,54 +3273,45 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw logAndConvert(e);
}
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Returns the value of the specified column as a SQLXML object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(int columnIndex) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Returns the value of the specified column as a SQLXML object.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(String columnName) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Updates a column in the current or insert row.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateSQLXML(int columnIndex, SQLXML xmlObject)
throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Updates a column in the current or insert row.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateSQLXML(String columnName, SQLXML xmlObject)
throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns the value of the specified column as a String.
......@@ -3506,26 +3472,22 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* [Not supported] Return an object of this class if possible.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCode("unwrap");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCode("isWrapperFor");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -429,26 +429,22 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
/**
* [Not supported] Return an object of this class if possible.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
debugCodeCall("unwrap");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
debugCodeCall("isWrapperFor");
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -37,9 +37,9 @@ public class JdbcSQLException extends SQLException {
this.cause = cause;
this.trace = trace;
buildMessage();
//#ifdef JDK14
//## Java 1.4 begin ##
initCause(cause);
//#endif
//## Java 1.4 end ##
}
/**
......@@ -77,13 +77,11 @@ public class JdbcSQLException extends SQLException {
public void printStackTrace(PrintWriter s) {
if (s != null) {
super.printStackTrace(s);
//#ifdef JDK13
/*
/*## Java 1.3 only begin ##
if (cause != null) {
cause.printStackTrace(s);
}
*/
//#endif
## Java 1.3 only end ##*/
// getNextException().printStackTrace(s) would be very very slow
// if many exceptions are joined
SQLException next = getNextException();
......@@ -105,13 +103,11 @@ public class JdbcSQLException extends SQLException {
public void printStackTrace(PrintStream s) {
if (s != null) {
super.printStackTrace(s);
//#ifdef JDK13
/*
/*## Java 1.3 only begin ##
if (cause != null) {
cause.printStackTrace(s);
}
*/
//#endif
## Java 1.3 only end ##*/
// getNextException().printStackTrace(s) would be very very slow
// if many exceptions are joined
SQLException next = getNextException();
......
......@@ -6,9 +6,9 @@
package org.h2.jdbc;
import java.sql.SQLException;
//#ifdef JDK14
//## Java 1.4 begin ##
import java.sql.Savepoint;
//#endif
//## Java 1.4 end ##
import org.h2.constant.ErrorCode;
import org.h2.message.Message;
......@@ -22,9 +22,9 @@ import org.h2.util.StringUtils;
* back in this case.
*/
public class JdbcSavepoint extends TraceObject
//#ifdef JDK14
//## Java 1.4 begin ##
implements Savepoint
//#endif
//## Java 1.4 end ##
{
static final String SYSTEM_SAVEPOINT_PREFIX = "SYSTEM_SAVEPOINT_";
......
......@@ -610,9 +610,9 @@ public class JdbcStatement extends TraceObject implements Statement {
result[i] = executeUpdate(sql);
} catch (SQLException e) {
logAndConvert(e);
//#ifdef JDK14
//## Java 1.4 begin ##
result[i] = Statement.EXECUTE_FAILED;
//#endif
//## Java 1.4 end ##
error = true;
}
}
......@@ -797,7 +797,7 @@ public class JdbcStatement extends TraceObject implements Statement {
*
* @return the holdability
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public int getResultSetHoldability() throws SQLException {
try {
debugCodeCall("getResultSetHoldability");
......@@ -807,7 +807,7 @@ public class JdbcStatement extends TraceObject implements Statement {
throw logAndConvert(e);
}
}
//#endif
//## Java 1.4 end ##
// =============================================================
......@@ -861,24 +861,20 @@ public class JdbcStatement extends TraceObject implements Statement {
/**
* [Not supported] Return an object of this class if possible.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns whether this object is poolable.
......
......@@ -30,11 +30,9 @@ import javax.sql.ConnectionEventListener;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import org.h2.message.Message;
*/
//#endif
## Java 1.6 end ##*/
/**
* A simple standalone JDBC connection pool.
......@@ -304,25 +302,21 @@ public class JdbcConnectionPool implements DataSource {
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
}
......@@ -11,7 +11,7 @@ import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
//#ifdef JDK14
//## Java 1.4 begin ##
import java.io.Serializable;
import javax.naming.NamingException;
import javax.naming.Reference;
......@@ -22,16 +22,14 @@ import javax.sql.DataSource;
import javax.sql.PooledConnection;
import javax.sql.XAConnection;
import javax.sql.XADataSource;
//#endif
//## Java 1.4 end ##
import org.h2.jdbc.JdbcConnection;
import org.h2.message.TraceObject;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import org.h2.message.Message;
*/
//#endif
//## Java 1.4 end ##
/**
* A data source for H2 database connections. It is a factory for XAConnection
......@@ -67,9 +65,9 @@ import org.h2.message.Message;
* well; this may be a security problem in some cases.
*/
public class JdbcDataSource extends TraceObject
//#ifdef JDK14
//## Java 1.4 begin ##
implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Referenceable
//#endif
//## Java 1.4 end ##
{
private static final long serialVersionUID = 1288136338451857771L;
......@@ -246,7 +244,7 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*
* @return the new reference
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public Reference getReference() throws NamingException {
debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName();
......@@ -257,20 +255,20 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
return ref;
}
//#endif
//## Java 1.4 end ##
/**
* Open a new XA connection using the current URL, user name and password.
*
* @return the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public XAConnection getXAConnection() throws SQLException {
debugCodeCall("getXAConnection");
int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, url, user, password);
}
//#endif
//## Java 1.4 end ##
/**
* Open a new XA connection using the current URL and the specified user
......@@ -280,7 +278,7 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @param password the password
* @return the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public XAConnection getXAConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getXAConnection("+quote(user)+", "+quote(password)+");");
......@@ -288,19 +286,19 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, url, user, password);
}
//#endif
//## Java 1.4 end ##
/**
* Open a new pooled connection using the current URL, user name and password.
*
* @return the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public PooledConnection getPooledConnection() throws SQLException {
debugCodeCall("getPooledConnection");
return getXAConnection();
}
//#endif
//## Java 1.4 end ##
/**
* Open a new pooled connection using the current URL and the specified user
......@@ -310,40 +308,36 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @param password the password
* @return the connection
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public PooledConnection getPooledConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getPooledConnection("+quote(user)+", "+quote(password)+");");
}
return getXAConnection(user, password);
}
//#endif
//## Java 1.4 end ##
/**
* [Not supported] Return an object of this class if possible.
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* [Not supported] Checks if unwrap can return an object of this class.
*
* @param iface the class
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class< ? > iface) throws SQLException {
throw Message.getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -7,12 +7,12 @@ package org.h2.jdbcx;
import java.util.Hashtable;
//#ifdef JDK14
//## Java 1.4 begin ##
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
//#endif
//## Java 1.4 end ##
import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
......@@ -24,9 +24,9 @@ import org.h2.message.TraceSystem;
* An application should not use this class directly.
*/
public class JdbcDataSourceFactory
//#ifdef JDK14
//## Java 1.4 begin ##
implements ObjectFactory
//#endif
//## Java 1.4 end ##
{
private static TraceSystem traceSystem;
......@@ -57,7 +57,7 @@ implements ObjectFactory
* @return the new JdbcDataSource, or null if the reference class name is
* not JdbcDataSource.
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
if (trace.debug()) {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment);
......@@ -74,7 +74,7 @@ implements ObjectFactory
}
return null;
}
//#endif
//## Java 1.4 end ##
TraceSystem getTraceSystem() {
return traceSystem;
......
......@@ -8,9 +8,9 @@ package org.h2.jdbcx;
import java.sql.SQLException;
import java.util.StringTokenizer;
//#ifdef JDK14
//## Java 1.4 begin ##
import javax.transaction.xa.Xid;
//#endif
//## Java 1.4 end ##
import org.h2.constant.ErrorCode;
import org.h2.message.Message;
......@@ -21,9 +21,9 @@ import org.h2.util.ByteUtils;
* An object of this class represents a transaction id.
*/
public class JdbcXid extends TraceObject
//#ifdef JDK14
//## Java 1.4 begin ##
implements Xid
//#endif
//## Java 1.4 end ##
{
private static final String PREFIX = "XID";
......
......@@ -131,14 +131,12 @@ public class Message {
}
public static Error getInternalError(String s, Exception e) {
//#ifdef JDK14
//## Java 1.4 begin ##
Error e2 = new Error(s, e);
//#endif
//#ifdef JDK13
/*
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
Error e2 = new Error(s);
*/
//#endif
## Java 1.3 only end ##*/
TraceSystem.traceThrowable(e2);
return e2;
}
......@@ -200,9 +198,9 @@ public class Message {
}
}
IOException io = new IOException(e.toString());
//#ifdef JDK14
//## Java 1.4 begin ##
io.initCause(e);
//#endif
//## Java 1.4 end ##
return io;
}
......
......@@ -63,7 +63,7 @@ public class SecureSocketFactory {
public Socket createSocket(InetAddress address, int port) throws IOException {
Socket socket = null;
//#ifdef JDK14
//## Java 1.4 begin ##
setKeystore();
SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket secureSocket = (SSLSocket) f.createSocket(address, port);
......@@ -73,13 +73,13 @@ public class SecureSocketFactory {
secureSocket.setEnabledCipherSuites(list);
}
socket = secureSocket;
//#endif
//## Java 1.4 end ##
return socket;
}
public ServerSocket createServerSocket(int port) throws IOException, SQLException {
ServerSocket socket = null;
//#ifdef JDK14
//## Java 1.4 begin ##
setKeystore();
ServerSocketFactory f = SSLServerSocketFactory.getDefault();
SSLServerSocket secureSocket;
......@@ -95,11 +95,11 @@ public class SecureSocketFactory {
secureSocket.setEnabledCipherSuites(list);
}
socket = secureSocket;
//#endif
//## Java 1.4 end ##
return socket;
}
//#ifdef JDK14
//## Java 1.4 begin ##
private static byte[] getBytes(String hex) throws SQLException {
return ByteUtils.convertStringToBytes(hex);
}
......@@ -183,6 +183,6 @@ public class SecureSocketFactory {
return newList;
}
//#endif
//## Java 1.4 end ##
}
......@@ -1501,7 +1501,7 @@ class WebThread extends Thread implements DatabaseEventListener {
// TODO meta data: more supports methods (I'm tired now)
rs.addRow(new String[] { "meta.usesLocalFilePerTable", "" + meta.usesLocalFilePerTable() });
rs.addRow(new String[] { "meta.usesLocalFiles", "" + meta.usesLocalFiles() });
//#ifdef JDK14
//## Java 1.4 begin ##
rs.addRow(new String[] { "conn.getHoldability", "" + conn.getHoldability() });
rs.addRow(new String[] { "meta.getDatabaseMajorVersion", "" + meta.getDatabaseMajorVersion() });
rs.addRow(new String[] { "meta.getDatabaseMinorVersion", "" + meta.getDatabaseMinorVersion() });
......@@ -1511,7 +1511,7 @@ class WebThread extends Thread implements DatabaseEventListener {
rs.addRow(new String[] { "meta.getSQLStateType", "" + meta.getSQLStateType() });
rs.addRow(new String[] { "meta.supportsGetGeneratedKeys", "" + meta.supportsGetGeneratedKeys() });
rs.addRow(new String[] { "meta.locatorsUpdateCopy", "" + meta.locatorsUpdateCopy() });
//#endif
//## Java 1.4 end ##
return rs;
} else if (sql.startsWith("@CATALOGS")) {
return meta.getCatalogs();
......@@ -1555,7 +1555,7 @@ class WebThread extends Thread implements DatabaseEventListener {
return meta.getUDTs(p[1], p[2], p[3], types);
} else if (sql.startsWith("@TYPE_INFO")) {
return meta.getTypeInfo();
//#ifdef JDK14
//## Java 1.4 begin ##
} else if (sql.startsWith("@SUPER_TYPES")) {
String[] p = split(sql);
return meta.getSuperTypes(p[1], p[2], p[3]);
......@@ -1565,7 +1565,7 @@ class WebThread extends Thread implements DatabaseEventListener {
} else if (sql.startsWith("@ATTRIBUTES")) {
String[] p = split(sql);
return meta.getAttributes(p[1], p[2], p[3], p[4]);
//#endif
//## Java 1.4 end ##
}
return null;
}
......@@ -1664,9 +1664,9 @@ class WebThread extends Thread implements DatabaseEventListener {
session.addCommand(sql);
if (generatedKeys) {
rs = null;
//#ifdef JDK14
//## Java 1.4 begin ##
rs = stat.getGeneratedKeys();
//#endif
//## Java 1.4 end ##
} else {
if (!isResultSet) {
buff.append("${text.result.updateCount}: " + stat.getUpdateCount());
......
......@@ -33,7 +33,7 @@ public class FileObjectMemory implements FileObject {
private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2];
private static final byte[] COMPRESSED_BLOCK;
//#ifdef JDK14
//## Java 1.4 begin ##
static class Cache extends LinkedHashMap {
private static final long serialVersionUID = 5549197956072850355L;
private int size;
......@@ -69,18 +69,18 @@ public class FileObjectMemory implements FileObject {
}
}
private static final Cache COMPRESS_LATER = new Cache(CACHE_SIZE);
//#endif
//## Java 1.4 end ##
private static void compressLater(byte[][] data, int l) {
//#ifdef JDK14
//## Java 1.4 begin ##
CompressItem c = new CompressItem();
c.data = data;
c.l = l;
synchronized (LZF) {
COMPRESS_LATER.put(c, c);
}
//#endif
//## Java 1.4 end ##
}
private static void expand(byte[][] data, int i) {
......
......@@ -5,7 +5,7 @@
*/
package org.h2.tools;
//#ifdef AWT
//## AWT begin ##
import java.awt.Button;
import java.awt.Dimension;
import java.awt.Font;
......@@ -32,7 +32,7 @@ import org.h2.util.IOUtils;
import java.io.IOException;
import java.io.InputStream;
//#endif
//## AWT end ##
import java.sql.SQLException;
import org.h2.constant.SysProperties;
......@@ -47,17 +47,17 @@ import org.h2.util.StartBrowser;
* @author Thomas Mueller, Ridvan Agar
*/
public class Console implements
//#ifdef AWT
//## AWT begin ##
ActionListener, MouseListener,
//#endif
//## AWT end ##
ShutdownHandler {
//#ifdef AWT
//## AWT begin ##
private Font font;
private Image icon16, icon24;
private Frame frame;
private Button startBrowser;
//#endif
//## AWT end ##
private static final int EXIT_ERROR = 1;
private Server web, tcp, pg;
private boolean isWindows;
......@@ -112,7 +112,7 @@ ShutdownHandler {
System.out.println(pg.getStatus());
}
}
//#ifdef AWT
//## AWT begin ##
if (!GraphicsEnvironment.isHeadless()) {
if (isWindows) {
font = new Font("Dialog", Font.PLAIN, 11);
......@@ -129,7 +129,7 @@ ShutdownHandler {
e.printStackTrace();
}
}
//#endif
//## AWT end ##
// start browser anyway (even if the server is already running)
// because some people don't look at the output,
......@@ -170,16 +170,16 @@ ShutdownHandler {
pg.stop();
pg = null;
}
//#ifdef AWT
//## AWT begin ##
if (frame != null) {
frame.dispose();
frame = null;
}
//#endif
//## AWT end ##
System.exit(0);
}
//#ifdef AWT
//## AWT begin ##
private boolean createTrayIcon() {
try {
// SystemTray.isSupported();
......@@ -329,12 +329,12 @@ ShutdownHandler {
StartBrowser.openURL(web.getURL());
}
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if ("exit".equals(command)) {
......@@ -348,49 +348,49 @@ ShutdownHandler {
startBrowser();
}
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
startBrowser();
}
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void mouseEntered(MouseEvent e) {
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void mouseExited(MouseEvent e) {
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void mousePressed(MouseEvent e) {
}
//#endif
//## AWT end ##
/**
* INTERNAL
*/
//#ifdef AWT
//## AWT begin ##
public void mouseReleased(MouseEvent e) {
}
//#endif
//## AWT end ##
}
......@@ -511,9 +511,9 @@ public class Csv implements SimpleRowSource {
private SQLException convertException(String message, Exception e) {
SQLException s = new SQLException(message, "CSV");
//#ifdef JDK14
//## Java 1.4 begin ##
s.initCause(e);
//#endif
//## Java 1.4 end ##
return s;
}
......
......@@ -26,13 +26,11 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Map;
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLXML;
*/
//#endif
## Java 1.6 end ##*/
/**
* This class is a simple result set and meta data implementation.
......@@ -1565,57 +1563,49 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(int columnIndex) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public RowId getRowId(String columnName) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateRowId(int columnIndex, RowId x) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateRowId(String columnName, RowId x) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* Returns the current result set holdability.
*
* @return the holdability
*/
//#ifdef JDK14
//## Java 1.4 begin ##
public int getHoldability() {
return ResultSet.HOLD_CURSORS_OVER_COMMIT;
}
//#endif
//## Java 1.4 end ##
/**
* Returns whether this result set has been closed.
......@@ -1643,92 +1633,76 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateNClob(String columnName, NClob nClob) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(int columnIndex) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public NClob getNClob(String columnName) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(int columnIndex) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public SQLXML getSQLXML(String columnName) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateSQLXML(int columnIndex, SQLXML xmlObject)
throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public void updateSQLXML(String columnName, SQLXML xmlObject)
throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......@@ -1775,24 +1749,20 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public <T> T unwrap(Class<T> iface) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
*/
//#ifdef JDK16
/*
/*## Java 1.6 begin ##
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw getUnsupportedException();
}
*/
//#endif
## Java 1.6 end ##*/
/**
* INTERNAL
......
......@@ -46,10 +46,11 @@ public class CacheLRU implements Cache {
public void put(CacheObject rec) throws SQLException {
if (SysProperties.CHECK) {
int pos = rec.getPos();
for (int i = 0; i < rec.getBlockCount(); i++) {
CacheObject old = find(rec.getPos() + i);
CacheObject old = find(pos + i);
if (old != null) {
throw Message.getInternalError("try to add a record twice i=" + i);
throw Message.getInternalError("try to add a record twice pos:" + pos + " i:" + i);
}
}
}
......
......@@ -12,12 +12,12 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
//#ifdef JDK14
//## Java 1.4 begin ##
import javax.naming.Context;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.sql.XAConnection;
//#endif
//## Java 1.4 end ##
import org.h2.constant.ErrorCode;
import org.h2.message.Message;
......@@ -59,13 +59,13 @@ public class JdbcUtils {
public static ResultSet getGeneratedKeys(Statement stat) throws SQLException {
ResultSet rs = null;
//#ifdef JDK14
//## Java 1.4 begin ##
rs = stat.getGeneratedKeys();
//#endif
//## Java 1.4 end ##
return rs;
}
//#ifdef JDK14
//## Java 1.4 begin ##
public static void closeSilently(XAConnection conn) {
if (conn != null) {
try {
......@@ -75,7 +75,7 @@ public class JdbcUtils {
}
}
}
//#endif
//## Java 1.4 end ##
/**
* Create a new database connection with the given settings.
......@@ -101,7 +101,7 @@ public class JdbcUtils {
Class d = ClassUtils.loadUserClass(driver);
if (java.sql.Driver.class.isAssignableFrom(d)) {
return DriverManager.getConnection(url, prop);
//#ifdef JDK14
//## Java 1.4 begin ##
} else if (javax.naming.Context.class.isAssignableFrom(d)) {
// JNDI context
try {
......@@ -121,7 +121,7 @@ public class JdbcUtils {
} catch (NamingException e) {
throw Message.convert(e);
}
//#endif
//## Java 1.4 end ##
} else {
// Don't know, but maybe it loaded a JDBC Driver
return DriverManager.getConnection(url, prop);
......
......@@ -109,9 +109,9 @@ public class NetUtils {
public static boolean isLoopbackAddress(Socket socket) {
boolean result = true;
//#ifdef JDK14
//## Java 1.4 begin ##
result = socket.getInetAddress().isLoopbackAddress();
//#endif
//## Java 1.4 end ##
return result;
}
......
......@@ -20,88 +20,66 @@ import org.h2.message.Message;
public class ObjectUtils {
public static Integer getInteger(int x) {
// actually this method is available in JDK15
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Integer.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Integer(x); // NOPMD
//#endif
}
public static Character getCharacter(char x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Character.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Character(x);
//#endif
}
public static Long getLong(long x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Long.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Long(x); // NOPMD
//#endif
}
public static Short getShort(short x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Short.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Short(x); // NOPMD
//#endif
}
public static Byte getByte(byte x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Byte.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Byte(x); // NOPMD
//#endif
}
public static Float getFloat(float x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Float.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Float(x);
//#endif
}
public static Double getDouble(double x) {
//#ifdef JDK16
/*
if(true)
/*## Java 1.5 begin ##
if (true) {
return Double.valueOf(x);
*/
//#endif
//#ifdef JDK14
}
## Java 1.5 end ##*/
return new Double(x);
//#endif
}
public static byte[] serialize(Object obj) throws SQLException {
......
......@@ -5,28 +5,24 @@
*/
package org.h2.util;
//#ifdef JDK14
//## Java 1.4 begin ##
import java.util.LinkedHashMap;
//#endif
//#ifdef JDK13
/*
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
import java.util.HashMap;
*/
//#endif
## Java 1.3 only end ##*/
import java.util.Map;
/**
* This class implements a small LRU object cache.
*/
public class SmallLRUCache
//#ifdef JDK14
//## Java 1.4 begin ##
extends LinkedHashMap
//#endif
//#ifdef JDK13
/*
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
extends HashMap
*/
//#endif
## Java 1.3 only end ##*/
{
private static final long serialVersionUID = 3643268440910181829L;
......@@ -36,9 +32,9 @@ extends HashMap
this.size = size;
}
//#ifdef JDK14
//## Java 1.4 begin ##
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > size;
}
//#endif
//## Java 1.4 end ##
}
......@@ -284,19 +284,19 @@ public class StringUtils {
}
public static String urlEncode(String s) {
//#ifdef JDK14
//## Java 1.4 begin ##
try {
return URLEncoder.encode(s, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return s;
}
//#endif
//#ifdef JDK13
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
/*
return URLEncoder.encode(s);
*/
//#endif
//## Java 1.4 end ##
// byte[] utf = utf8Encode(s);
// StringBuffer buff = new StringBuffer(utf.length);
// for(int i=0; i<utf.length; i++) {
......@@ -407,14 +407,12 @@ public class StringUtils {
if (locale == null) {
df = new SimpleDateFormat(format);
} else {
//#ifdef JDK14
//## Java 1.4 begin ##
Locale l = new Locale(locale);
//#endif
//#ifdef JDK13
/*
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
Locale l = new Locale(locale, "");
*/
//#endif
## Java 1.3 only end ##*/
df = new SimpleDateFormat(format, l);
}
if (timeZone != null) {
......
......@@ -71,15 +71,14 @@ public class DataType {
public static final int TYPE_DATALINK = 70;
static {
//#ifdef JDK14
//## Java 1.4 begin ##
if (TYPE_BOOLEAN != Types.BOOLEAN) {
new Exception("Types.BOOLEAN: " + Types.BOOLEAN).printStackTrace();
}
if (TYPE_DATALINK != Types.DATALINK) {
new Exception("Types.DATALINK: " + Types.DATALINK).printStackTrace();
}
//#endif
//## Java 1.4 end ##
add(Value.NULL, Types.NULL, "Null",
new DataType(),
new String[]{"NULL"},
......
......@@ -159,11 +159,33 @@ java org.h2.test.TestAll timer
/*
test self runnable jar with uncompressed jar inside compressed jar
implementation javadocs
.tar.bz2 in addition to .zip
Caused by: java.lang.Error: read len -1170950400
at org.h2.message.Message.getInternalError(Message.java:128)
at org.h2.store.FileStore.readFully(FileStore.java:210)
at org.h2.store.DiskFile.copyDirect(DiskFile.java:838)
at org.h2.command.dml.BackupCommand.backupDiskFile(BackupCommand.java:113)
at org.h2.command.dml.BackupCommand.backupTo(BackupCommand.java:71)
at org.h2.command.dml.BackupCommand.update(BackupCommand.java:52)
at org.h2.command.CommandContainer.update(CommandContainer.java:69)
at org.h2.command.Command.executeUpdate(Command.java:197)
in your cvs tutorial (on h2database.com) you have an example code for
Reading a CSV File from a Java Application.
In the example you use the static reference Csv.read(...);
to the non static method read(...) in line 1.
I used Csv csv = Csv.getInstance();
and then csv.read(...)
i guess the same problem occurs in the
Writing a CSV File from a Java Application
example above with Csv.write(...)
Caused by: java.io.IOException: File system is read-only
at org.h2.store.fs.FileSystemZip.createTempFile(FileSystemZip.java:52)
at org.h2.util.FileUtils.createTempFile(FileUtils.java:140)
at org.h2.engine.Database.createTempFile(Database.java:1177)
analyzer configuration option for the fulltext search
optimize where x not in (select):
SELECT c FROM color LEFT OUTER JOIN (SELECT c FROM TABLE(c
VARCHAR= ?)) p ON color.c = p.c WHERE p.c IS NULL;
......@@ -172,14 +194,6 @@ Browser problems:
There has been a reported incompatibility with the
RealPlayer Browser Record Plugin 1.0 when using Firefox 2.0 and Vista
prep.setObject(1, new double[3]);
// setArray() is not supported according to
* double[] is currently serialized (using the
standard Java object serialization).
* I will try to support this for the next release;
if it is not as easy as I thought I will add a feature request.
* The same with supporting setArray.
--------------
scheduler: what if invoke takes more than...
......@@ -219,33 +233,11 @@ Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
History:
The autocomplete in the H2 Console has been improved a bit.
The tools in the H2 Console are now translatable.
Invalid inline views threw confusing SQL exceptions.
The Japanese translation of the error messages and the
H2 Console has been improved. Thanks a lot to Masahiro IKEMOTO.
Optimization for MIN() and MAX() when using MVCC.
To protect against remote brute force password attacks,
the delay after each unsuccessful login now gets double as long.
New system properties h2.delayWrongPasswordMin
and h2.delayWrongPasswordMax.
After setting the query timeout and then resetting it, the next query
would still timeout. Fixed.
Adding a IDENTITY column to a table with data threw a lock timeout.
OutOfMemoryError could occur when using EXISTS or IN(SELECT ..).
The built-in connection pool is not called JdbcConnectionPool.
The API and documentation has been changed.
The ConvertTraceFile tool now generates SQL statement statistics
at the end of the SQL script file (similar to the profiling data
generated when using java -Xrunhprof).
Nested joins are now supported (A JOIN B JOIN C ON .. ON ..)
The servlet and lucene jar files are now automatically downloaded in the build.
The code switch tool has been replaced by a simpler tool called
SwitchSource that just uses find and replace.
Roadmap:
Doclet (javadocs): constructors are not listed
Support direct lookup for MIN and MAX when using WHERE
(see todo.txt / Direct Lookup)
*/
......
......@@ -106,11 +106,11 @@ public class TestStatement extends TestBase {
Statement stat = conn.createStatement();
//#ifdef JDK14
//## Java 1.4 begin ##
check(ResultSet.HOLD_CURSORS_OVER_COMMIT, conn.getHoldability());
conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
check(ResultSet.CLOSE_CURSORS_AT_COMMIT, conn.getHoldability());
//#endif
//## Java 1.4 end ##
// ignored
stat.setCursorName("x");
......
......@@ -111,14 +111,14 @@ public class CheckTextFiles {
if (text.indexOf(copyrightLicense) < 0) {
fail(file, "license is missing", 0);
}
if (text.indexOf(" " + "//#") > 0) {
fail(file, "unexpected space,//#", 0);
if (text.indexOf("// " + "##") > 0) {
fail(file, "unexpected space between // and ##", 0);
}
if (text.indexOf(" " + "#ifdef") > 0) {
fail(file, "unexpected space,#if", 0);
if (text.indexOf("/* " + "##") > 0) {
fail(file, "unexpected space between /* and ##", 0);
}
if (text.indexOf(" " + "#endif") > 0) {
fail(file, "unexpected space,#endif", 0);
if (text.indexOf("##" + " */") > 0) {
fail(file, "unexpected space between ## and */", 0);
}
}
}
......
......@@ -26,7 +26,7 @@ import java.util.Vector;
* it can be compiled for different JDKs.
*/
public class CodeSwitch {
// TODO codeswitch: replace with ant 'Replace' task is possible
// TODO codeswitch: compatibility with ant 'Replace' task is possible
private boolean recurse;
private ArrayList list = new ArrayList();
private ArrayList switchOn = new ArrayList();
......@@ -38,7 +38,7 @@ public class CodeSwitch {
private boolean changed;
public static void main(String[] argv) throws Exception {
(new CodeSwitch()).run(argv);
new CodeSwitch().run(argv);
}
private void run(String[] a) throws Exception {
......
/*
* Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
* (license2)
* Initial Developer: H2 Group
*/
package org.h2.build.code;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
/**
* Switched source code to a specific Java version, automatically to the current
* version, or enable / disable other blocks of source code in Java files.
*/
public class SwitchSource {
private ArrayList enable = new ArrayList();
private ArrayList disable = new ArrayList();
public static void main(String[] args) throws IOException {
new SwitchSource().run(args);
}
private void run(String[] args) throws IOException {
String dir = null;
String version = null;
for (int i = 0; i < args.length; i++) {
String a = args[i];
if ("-dir".equals(a)) {
dir = args[++i];
} else if ("-auto".equals(a)) {
enable.add("AWT");
version = System.getProperty("java.specification.version");
} else if ("-version".equals(a)) {
version = args[++i];
} else if (a.startsWith("-")) {
disable.add(a.substring(1));
} else if (a.startsWith("+")) {
enable.add(a.substring(1));
} else {
showUsage();
return;
}
}
if (version == null) {
// ok
} else if ("1.3".equals(version)) {
enable.add("Java 1.3 only");
disable.add("Java 1.4");
disable.add("Java 1.5");
disable.add("Java 1.6");
} else if ("1.4".equals(version)) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
disable.add("Java 1.5");
disable.add("Java 1.6");
} else if ("1.5".equals(version)) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5");
disable.add("Java 1.6");
} else if (version.compareTo("1.6") >= 0) {
disable.add("Java 1.3 only");
enable.add("Java 1.4");
enable.add("Java 1.5");
enable.add("Java 1.6");
} else {
throw new IllegalArgumentException("version: " + version);
}
if (dir == null) {
showUsage();
} else {
process(new File(dir));
}
}
private void showUsage() {
System.out.println("Switched source code to a specific Java version.");
System.out.println("java "+getClass().getName() + "\n" +
" -dir <dir> The target directory\n" +
" [-version] Use the specified Java version (1.4 or newer)\n" +
" [-auto] Auto-detect Java version (1.4 or newer)\n" +
" [+MODE] Enable code labeled MODE\n" +
" [-MODE] Disable code labeled MODE");
}
private void process(File f) throws IOException {
String name = f.getName();
if (name.startsWith(".svn")) {
return;
} else if (name.endsWith(".java")) {
processFile(f);
} else if (f.isDirectory()) {
File[] files = f.listFiles();
for (int i = 0; i < files.length; i++) {
process(files[i]);
}
}
}
private void processFile(File f) throws IOException {
RandomAccessFile read = new RandomAccessFile(f, "r");
byte[] buffer;
try {
long len = read.length();
if (len >= Integer.MAX_VALUE) {
throw new IOException("Files bigger than Integer.MAX_VALUE are not supported");
}
buffer = new byte[(int) len];
read.readFully(buffer);
} finally {
read.close();
}
boolean found = false;
// check for ## without creating a string
for (int i = 0; i < buffer.length - 1; i++) {
if (buffer[i] == '#' && buffer[i + 1] == '#') {
found = true;
break;
}
}
if (!found) {
return;
}
String source = new String(buffer);
String target = source;
target = replaceAll(target, "//##", "//##");
for (int i = 0; i < enable.size(); i++) {
String x = (String) enable.get(i);
target = replaceAll(target, "/*## " + x + " begin ##", "//## " + x + " begin ##");
target = replaceAll(target, "## " + x + " end ##*/", "//## " + x + " end ##");
}
for (int i = 0; i < disable.size(); i++) {
String x = (String) disable.get(i);
target = replaceAll(target, "//## " + x + " begin ##", "/*## " + x + " begin ##");
target = replaceAll(target, "//## " + x + " end ##", "## " + x + " end ##*/");
}
if (!source.equals(target)) {
String name = f.getPath();
File fileNew = new File(name + ".new");
FileWriter write = new FileWriter(fileNew);
write.write(target);
write.close();
File fileBack = new File(name + ".bak");
fileBack.delete();
f.renameTo(fileBack);
File fileCopy = new File(name);
fileNew.renameTo(fileCopy);
fileBack.delete();
System.out.println(name);
}
}
private static String replaceAll(String s, String before, String after) {
int index = 0;
while (true) {
int next = s.indexOf(before, index);
if (next < 0) {
return s;
}
s = s.substring(0, next) + after + s.substring(next + before.length());
index = next + after.length();
}
}
}
......@@ -64,7 +64,7 @@ classes classification classloader classloaders classpath clause clazz clean
cleaned cleaner clear cleared clearing clearly clears cleartext click clicked
clicking client clients clientside clob clock clone close closed closely closer
closes closing clubs cluster clustered clustering cmd cmu cnt coalesce code
codebase codebook coded codehaus codes codeswitch codist coffee col coldrick coll
codebase codebook coded codehaus codes codist coffee col coldrick coll
collaborative collapse collateral collation collations collator collators collect
collected collecting collection collections collector colon color cols colspan
column columnlist columns com combination combinations combinatorics combine
......@@ -490,4 +490,4 @@ hider ikvmc invert recycle filtering lesser recycled assertion runner teradata
christian lgpl elapsed ncr disposed heureuse tera years retrieves unlocked
selecting vista everywhere locations zones fragment svg thought constructors
doubles validating matched established accu accum stats resetting parallel
delays
\ No newline at end of file
delays guess downloaded jars
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论