提交 7f003899 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 886d1c5c
......@@ -243,6 +243,7 @@
</target>
<target name="javadoc">
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/main" destdir="bin" debug="true" includes="org/h2/util/StringUtils.java"/>
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/test" destdir="bin" debug="true" includes="org/h2/test/bnf/*.java"/>
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true" includes="org/h2/tools/doclet/*.java"/>
<mkdir dir="docs/javadoc"/>
......
......@@ -50,6 +50,8 @@ Advanced Topics
Universally Unique Identifiers (UUID)</a><br />
<a href="#system_properties">
Settings Read from System Properties</a><br />
<a href="#server_bind_address">
Setting the Server Bind Address</a><br />
<a href="#glossary_links">
Glossary and Links</a><br />
......@@ -927,39 +929,22 @@ Example:
java -Dh2.serverCachedObjects=256 org.h2.tools.Server
</pre>
The current value of the settings can be read in the table
INFORMATION_SCHEMA.SETTINGS
</p>
<table><tr>
<th>Setting</th>
<th>Default</th>
<th>Description</th></tr>
<tr><td>h2.allowedClasses</td><td>*</td><td>Comma separated list of class names or prefixes</td></tr>
<tr><td>h2.check</td><td>true</td><td>Assertions in the database engine</td></tr>
<tr><td>h2.check2</td><td>false</td><td>Additional assertions</td></tr>
<tr><td>h2.clientTraceDirectory</td><td>trace.db/</td><td>Directory where the trace files of the JDBC client are stored (only for client / server)</td></tr>
<tr><td>h2.emergencySpaceInitial</td><td>1048576</td><td>Size of 'reserve' file to detect disk full problems early</td></tr>
<tr><td>h2.emergencySpaceMin</td><td>131072</td><td>Minimum size of 'reserve' file</td></tr>
<tr><td>h2.lobCloseBetweenReads</td><td>false</td><td>Close LOB files between read operations</td></tr>
<tr><td>h2.lobFilesInDirectories</td><td>false</td><td>Store LOB files in subdirectories</td></tr>
<tr><td>h2.lobFilesPerDirectory</td><td>256</td><td>Maximum number of LOB files per directory</td></tr>
<tr><td>h2.logAllErrors</td><td>false</td><td>Write stack traces of any kind of error to a file</td></tr>
<tr><td>h2.logAllErrorsFile</td><td>h2errors.txt</td><td>File name to log errors</td></tr>
<tr><td>h2.maxFileRetry</td><td>16</td><td>Number of times to retry file delete and rename</td></tr>
<tr><td>h2.objectCache</td><td>true</td><td>Cache commonly used objects (integers, strings)</td></tr>
<tr><td>h2.objectCacheMaxPerElementSize</td><td>4096</td><td>Maximum size of an object in the cache</td></tr>
<tr><td>h2.objectCacheSize</td><td>1024</td><td>Size of object cache</td></tr>
<tr><td>h2.optimizeEvaluatableSubqueries</td><td>true</td><td>Optimize subqueries that are not dependent on the outer query</td></tr>
<tr><td>h2.optimizeIn</td><td>true</td><td>Optimize IN(...) comparisons</td></tr>
<tr><td>h2.optimizeMinMax</td><td>true</td><td>Optimize MIN and MAX aggregate functions</td></tr>
<tr><td>h2.optimizeSubqueryCache</td><td>true</td><td>Cache subquery results</td></tr>
<tr><td>h2.overflowExceptions</td><td>true</td><td>Throw an exception on integer overflows</td></tr>
<tr><td>h2.recompileAlways</td><td>false</td><td>Always recompile prepared statements</td></tr>
<tr><td>h2.redoBufferSize</td><td>262144</td><td>Size of the redo buffer (used at startup when recovering)</td></tr>
<tr><td>h2.runFinalize</td><td>true</td><td>Run finalizers to detect unclosed connections</td></tr>
<tr><td>h2.scriptDirectory</td><td></td><td>Relative or absolute directory where the script files are stored to or read from</td></tr>
<tr><td>h2.serverCachedObjects</td><td>64</td><td>TCP Server: number of cached objects per session</td></tr>
<tr><td>h2.serverResultSetFetchSize</td><td>100</td><td>The default result set fetch size when using the server mode</td></tr>
</table>
INFORMATION_SCHEMA.SETTINGS.
</p>
<p>
For a complete list of settings, see
<a href="../javadoc/org/h2/constant/SysProperties.html">SysProperties</a>.
</p>
<br /><a name="server_bind_address"></a>
<h2>Setting the Server Bind Address</h2>
<p>
Usually server sockets accept connections on any/all local addresses.
This may be a problem on multi-homed hosts.
To bind only to one address, use the system property h2.bindAddress.
This setting is used for both regular server sockets and for SSL server sockets.
IPv4 and IPv6 address formats are supported.
</p>
<br /><a name="glossary_links"></a>
<h2>Glossary and Links</h2>
......
......@@ -71,8 +71,6 @@ Features
Compacting a Database</a><br />
<a href="#cache_settings">
Cache Settings</a><br />
<a href="#why_java">
Why Java</a><br />
<br /><a name="feature_list"></a>
<h2>Feature List</h2>
......@@ -880,10 +878,6 @@ Here is the list of currently supported modes and the difference to the regular
Usually, the scale is converted and 0s are added if required.
</td></tr>
</table>
<p>
</p>
<br /><a name="trace_options"></a>
<h2>Using the Trace Options</h2>
......@@ -1346,39 +1340,4 @@ call SELECT * FROM INFORMATION_SCHEMA.SETTINGS. The number of pages read / writt
is listed for the data and index file.
</p>
<br /><a name="why_java"></a>
<h2>Why Java</h2>
<p>
A few reasons using a Java database are:
</p>
<ul>
<li>Very simple to integrate in Java applications
</li><li>Support for many different platforms
</li><li>More secure than native applications (no buffer overflows)
</li><li>User defined functions (or triggers) run very fast
</li><li>Unicode support
</li></ul>
<p>
Some people think that Java is still too slow for low level operations,
but this is not the case (not any more). In general, the code can be written a lot faster
than using C or C++. Like that, it is possible to concentrate on improving the algorithms
(that make the application faster) rather than porting the code and dealing with low
level stuff (such as memory management or dealing with threads).
Garbage collection is now probably faster than manual memory management.
</p><p>
A lot of features are already built in (for example Unicode, network libraries).
It is very easy to write secure code because buffer overflows and such
problems can be detected very easily. Some features such as the reflection
mechanism can be used for randomized testing.
</p><p>
Java is also future proof: A lot of companies support Java,
and it is now open source.
</p><p>
This software does not rely on many Java libraries or other software, to
increase the portability and ease of use, and for performance reasons. For example,
the encryption algorithms and many library functions are implemented in the database
instead of using the existing libraries. Libraries that are not available in open source
Java implementations (such as Swing) are not used or only used for specific features.
</p>
</div></td></tr></table></body></html>
......@@ -14,6 +14,8 @@ History
<h1>History and Roadmap</h1>
<a href="#history">
History of this Database Engine</a><br />
<a href="#why_java">
Why Java</a><br />
<a href="#changelog">
Change Log</a><br />
<a href="#roadmap">
......@@ -34,6 +36,40 @@ The name H2 stands for Hypersonic 2; however H2 does not share any code with
Hypersonic SQL or HSQLDB. H2 is built from scratch.
</p>
<br /><a name="why_java"></a>
<h2>Why Java</h2>
<p>
A few reasons using a Java database are:
</p>
<ul>
<li>Very simple to integrate in Java applications
</li><li>Support for many different platforms
</li><li>More secure than native applications (no buffer overflows)
</li><li>User defined functions (or triggers) run very fast
</li><li>Unicode support
</li></ul>
<p>
Some people think that Java is still too slow for low level operations,
but this is not the case (not any more). In general, the code can be written a lot faster
than using C or C++. Like that, it is possible to concentrate on improving the algorithms
(that make the application faster) rather than porting the code and dealing with low
level stuff (such as memory management or dealing with threads).
Garbage collection is now probably faster than manual memory management.
</p><p>
A lot of features are already built in (for example Unicode, network libraries).
It is very easy to write secure code because buffer overflows can not occur.
Some features such as the reflection mechanism can be used for randomized testing.
</p><p>
Java is also future proof: A lot of companies support Java,
and it is now open source.
</p><p>
This software does not rely on many Java libraries or other software, to
increase the portability and ease of use, and for performance reasons. For example,
the encryption algorithms and many library functions are implemented in the database
instead of using the existing libraries. Libraries that are not available in open source
Java implementations (such as Swing) are not used or only used for specific features.
</p>
<br /><a name="changelog"></a>
<h2>Change Log</h2>
<p>
......
......@@ -64,6 +64,12 @@ Package org.h2.api<br />
<a href="org/h2/api/Trigger.html" target="javadoc">Trigger</a><br />
<br />
<b>Constants</b><br />
Package org.h2.constant<br />
<a href="org/h2/constant/ErrorCode.html" target="javadoc">ErrorCode</a><br />
<a href="org/h2/constant/SysProperties.html" target="javadoc">SysProperties</a><br />
<br />
</div>
</div></td></tr></table>
......
......@@ -221,6 +221,11 @@ public class AlterTableAlterColumn extends SchemaCommand {
DbObject child = (DbObject) children.get(i);
if (child instanceof Sequence) {
continue;
} else if (child instanceof Index) {
Index idx = (Index) child;
if (idx.getIndexType().belongsToConstraint()) {
continue;
}
}
String createSQL = child.getCreateSQL();
if (createSQL == null) {
......
......@@ -576,7 +576,7 @@ public class Select extends Query {
if (index != null && (current.getIndexType().isScan() || current == index)) {
topTableFilter.setIndex(index);
if (!distinct || isDistinctQuery) {
// sort using index wouldn't work correctly for distinct result sets
// sort using index would not work correctly for distinct result sets
// because it would break too early when limit is used
sortUsingIndex = true;
}
......
......@@ -22,37 +22,37 @@ import org.h2.message.TraceSystem;
public class SysProperties {
/**
* The system property <code>file.encoding</code> (default: Cp1252).
* System property <code>file.encoding</code> (default: Cp1252).<br />
* It is usually set by the system and is the default encoding used for the RunScript and CSV tool.
*/
public static final String FILE_ENCODING = getStringSetting("file.encoding", "Cp1252");
/**
* The system property <code>file.separator</code> (default: /).
* System property <code>file.separator</code> (default: /).<br />
* It is usually set by the system, and used to build absolute file names.
*/
public static final String FILE_SEPARATOR = getStringSetting("file.separator", "/");
/**
* The system property <code>line.separator</code> (default: \n).
* System property <code>line.separator</code> (default: \n).<br />
* It is usually set by the system, and used by the script and trace tools.
*/
public static final String LINE_SEPARATOR = getStringSetting("line.separator", "\n");
/**
* The system property <code>user.home</code> (default: empty string).
* System property <code>user.home</code> (default: empty string).<br />
* It is usually set by the system, and used as a replacement for ~ in file names.
*/
public static final String USER_HOME = getStringSetting("user.home", "");
/**
* The system property <code>h2.allowBigDecimalExtensions</code> (default: false).
* System property <code>h2.allowBigDecimalExtensions</code> (default: false).<br />
* When enabled, classes that extend BigDecimal are supported in PreparedStatement.setBigDecimal.
*/
public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS = getBooleanSetting("h2.allowBigDecimalExtensions", false);
/**
* The system property <code>h2.allowedClasses</code> (default: *).
* System property <code>h2.allowedClasses</code> (default: *).<br />
* Comma separated list of class names or prefixes.
*/
public static final String ALLOWED_CLASSES = getStringSetting("h2.allowedClasses", "*");
......@@ -60,31 +60,32 @@ public class SysProperties {
public static final String BIND_ADDRESS = getStringSetting("h2.bindAddress", null);
public static final int CACHE_SIZE_DEFAULT = getIntSetting("h2.cacheSizeDefault", 16 * 1024);
public static final int CACHE_SIZE_INDEX_SHIFT = getIntSetting("h2.cacheSizeIndexShift", 3);
/**
* INTERNAL
*/
public static final int CACHE_SIZE_INDEX_DEFAULT = CACHE_SIZE_DEFAULT >> CACHE_SIZE_INDEX_SHIFT;
/**
* The system property <code>h2.check</code> (default: true).
* System property <code>h2.check</code> (default: true).<br />
* Assertions in the database engine.
*/
public static final boolean CHECK = getBooleanSetting("h2.check", true);
/**
* The system property <code>h2.check2</code> (default: true).
* System property <code>h2.check2</code> (default: true).<br />
* Additional assertions in the database engine.
*/
public static final boolean CHECK2 = getBooleanSetting("h2.check2", false);
/**
* The system property <code>h2.clientTraceDirectory</code> (default: trace.db/).
* System property <code>h2.clientTraceDirectory</code> (default: trace.db/).<br />
* Directory where the trace files of the JDBC client are stored (only for client / server).
*/
public static final String CLIENT_TRACE_DIRECTORY = getStringSetting("h2.clientTraceDirectory", "trace.db/");
/**
* The system property <code>h2.check2</code> (default: true).
* System property <code>h2.check2</code> (default: true).<br />
* Additional assertions in the database engine.
*/
public static final int DEFAULT_MAX_OPERATION_MEMORY = getIntSetting("h2.defaultMaxOperationMemory", 100000);
......@@ -93,13 +94,13 @@ public class SysProperties {
public static final int DEFAULT_LOCK_MODE = getIntSetting("h2.defaultLockMode", Constants.LOCK_MODE_READ_COMMITTED);
/**
* The system property <code>h2.emergencySpaceInitial</code> (default: 262144).
* System property <code>h2.emergencySpaceInitial</code> (default: 262144).<br />
* Size of 'reserve' file to detect disk full problems early.
*/
public static final int EMERGENCY_SPACE_INITIAL = getIntSetting("h2.emergencySpaceInitial", 256 * 1024);
/**
* The system property <code>h2.emergencySpaceMin</code> (default: 65536).
* System property <code>h2.emergencySpaceMin</code> (default: 65536).<br />
* Minimum size of 'reserve' file.
*/
public static final int EMERGENCY_SPACE_MIN = getIntSetting("h2.emergencySpaceMin", 64 * 1024);
......@@ -107,38 +108,38 @@ public class SysProperties {
public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true);
/**
* The system property <code>h2.lobCloseBetweenReads</code> (default: false).
* System property <code>h2.lobCloseBetweenReads</code> (default: false).<br />
* Close LOB files between read operations.
*/
public static boolean lobCloseBetweenReads = getBooleanSetting("h2.lobCloseBetweenReads", false);
/**
* The system property <code>h2.lobFilesInDirectories</code> (default: false).
* System property <code>h2.lobFilesInDirectories</code> (default: false).<br />
* Store LOB files in subdirectories.
*/
// TODO: also remove DataHandler.allocateObjectId, createTempFile when setting this to true and removing it
public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting("h2.lobFilesInDirectories", false);
/**
* The system property <code>h2.lobFilesPerDirectory</code> (default: 256).
* System property <code>h2.lobFilesPerDirectory</code> (default: 256).<br />
* Maximum number of LOB files per directory.
*/
public static final int LOB_FILES_PER_DIRECTORY = getIntSetting("h2.lobFilesPerDirectory", 256);
/**
* The system property <code>h2.logAllErrors</code> (default: false).
* System property <code>h2.logAllErrors</code> (default: false).<br />
* Write stack traces of any kind of error to a file.
*/
public static final boolean LOG_ALL_ERRORS = getBooleanSetting("h2.logAllErrors", false);
/**
* The system property <code>h2.logAllErrorsFile</code> (default: h2errors.txt).
* System property <code>h2.logAllErrorsFile</code> (default: h2errors.txt).<br />
* File name to log errors.
*/
public static final String LOG_ALL_ERRORS_FILE = getStringSetting("h2.logAllErrorsFile", "h2errors.txt");
/**
* The system property <code>h2.maxFileRetry</code> (default: 16).
* System property <code>h2.maxFileRetry</code> (default: 16).<br />
* Number of times to retry file delete and rename.
*/
public static final int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16));
......@@ -147,45 +148,45 @@ public class SysProperties {
public static final boolean NEW_DISPLAY_SIZE = getBooleanSetting("h2.newDisplaySize", true);
/**
* The system property <code>h2.objectCache</code> (default: true).
* System property <code>h2.objectCache</code> (default: true).<br />
* Cache commonly used objects (integers, strings).
*/
public static final boolean OBJECT_CACHE = getBooleanSetting("h2.objectCache", true);
/**
* The system property <code>h2.objectCacheMaxPerElementSize</code> (default: 4096).
* System property <code>h2.objectCacheMaxPerElementSize</code> (default: 4096).<br />
* Maximum size of an object in the cache.
*/
public static final int OBJECT_CACHE_MAX_PER_ELEMENT_SIZE = getIntSetting("h2.objectCacheMaxPerElementSize", 4096);
/**
* The system property <code>h2.objectCacheSize</code> (default: 1024).
* System property <code>h2.objectCacheSize</code> (default: 1024).<br />
* Maximum size of an object in the cache.
*/
public static final int OBJECT_CACHE_SIZE = getIntSetting("h2.objectCacheSize", 1024);
public static final boolean OPTIMIZE_DISTINCT = getBooleanSetting("h2.optimizeDistinct", true);
/**
* The system property <code>h2.optimizeEvaluatableSubqueries</code> (default: true).
* System property <code>h2.optimizeEvaluatableSubqueries</code> (default: true).<br />
* Optimize subqueries that are not dependent on the outer query.
*/
public static final boolean OPTIMIZE_EVALUATABLE_SUBQUERIES = getBooleanSetting("h2.optimizeEvaluatableSubqueries", true);
/**
* The system property <code>h2.optimizeIn</code> (default: true).
* System property <code>h2.optimizeIn</code> (default: true).<br />
* Optimize IN(...) comparisons.
*/
public static final boolean OPTIMIZE_IN = getBooleanSetting("h2.optimizeIn", true);
public static final boolean OPTIMIZE_IN_JOIN = getBooleanSetting("h2.optimizeInJoin", false);
/**
* The system property <code>h2.optimizeMinMax</code> (default: true).
* System property <code>h2.optimizeMinMax</code> (default: true).<br />
* Optimize MIN and MAX aggregate functions.
*/
public static final boolean OPTIMIZE_MIN_MAX = getBooleanSetting("h2.optimizeMinMax", true);
/**
* The system property <code>h2.optimizeSubqueryCache</code> (default: true).
* System property <code>h2.optimizeSubqueryCache</code> (default: true).<br />
* Cache subquery results.
*/
public static final boolean OPTIMIZE_SUBQUERY_CACHE = getBooleanSetting("h2.optimizeSubqueryCache", true);
......@@ -193,43 +194,43 @@ public class SysProperties {
public static final boolean OPTIMIZE_TWO_EQUALS = getBooleanSetting("h2.optimizeTwoEquals", true);
/**
* The system property <code>h2.overflowExceptions</code> (default: true).
* System property <code>h2.overflowExceptions</code> (default: true).<br />
* Throw an exception on integer overflows.
*/
public static final boolean OVERFLOW_EXCEPTIONS = getBooleanSetting("h2.overflowExceptions", true);
/**
* The system property <code>h2.recompileAlways</code> (default: false).
* System property <code>h2.recompileAlways</code> (default: false).<br />
* Always recompile prepared statements.
*/
public static final boolean RECOMPILE_ALWAYS = getBooleanSetting("h2.recompileAlways", false);
/**
* The system property <code>h2.redoBufferSize</code> (default: 262144).
* System property <code>h2.redoBufferSize</code> (default: 262144).<br />
* Size of the redo buffer (used at startup when recovering).
*/
public static final int REDO_BUFFER_SIZE = getIntSetting("h2.redoBufferSize", 256 * 1024);
/**
* The system property <code>h2.runFinalize</code> (default: true).
* System property <code>h2.runFinalize</code> (default: true).<br />
* Run finalizers to detect unclosed connections.
*/
public static boolean runFinalize = getBooleanSetting("h2.runFinalize", true);
/**
* The system property <code>h2.scriptDirectory</code> (default: empty string).
* System property <code>h2.scriptDirectory</code> (default: empty string).<br />
* Relative or absolute directory where the script files are stored to or read from.
*/
public static String scriptDirectory = getStringSetting("h2.scriptDirectory", "");
/**
* The system property <code>h2.serverCachedObjects</code> (default: 64).
* System property <code>h2.serverCachedObjects</code> (default: 64).<br />
* TCP Server: number of cached objects per session.
*/
public static final int SERVER_CACHED_OBJECTS = getIntSetting("h2.serverCachedObjects", 64);
/**
* The system property <code>h2.serverResultSetFetchSize</code> (default: 100).
* System property <code>h2.serverResultSetFetchSize</code> (default: 100).<br />
* The default result set fetch size when using the server mode.
*/
public static final int SERVER_RESULT_SET_FETCH_SIZE = getIntSetting("h2.serverResultSetFetchSize", 100);
......
......@@ -97,7 +97,11 @@ public class JdbcUtils {
DataSource ds = (DataSource) context.lookup(url);
String user = prop.getProperty("user");
String password = prop.getProperty("password");
if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) {
return ds.getConnection();
} else {
return ds.getConnection(user, password);
}
} catch (InstantiationException e) {
throw Message.convert(e);
} catch (IllegalAccessException e) {
......
......@@ -116,7 +116,7 @@ public class FunctionMultiReturn {
*
* @param conn the connection
* @param query the query
* @return a result set with the coodinates
* @return a result set with the coordinates
*/
public static ResultSet polar2CartesianSet(Connection conn, String query) throws SQLException {
SimpleResultSet result = new SimpleResultSet();
......
......@@ -51,7 +51,6 @@ import org.h2.test.db.TestView;
import org.h2.test.jdbc.TestBatchUpdates;
import org.h2.test.jdbc.TestCallableStatement;
import org.h2.test.jdbc.TestCancel;
import org.h2.test.jdbc.TestDataSource;
import org.h2.test.jdbc.TestDatabaseEventListener;
import org.h2.test.jdbc.TestManyJdbcObjects;
import org.h2.test.jdbc.TestMetaData;
......@@ -62,7 +61,9 @@ import org.h2.test.jdbc.TestStatement;
import org.h2.test.jdbc.TestTransactionIsolation;
import org.h2.test.jdbc.TestUpdatableResultSet;
import org.h2.test.jdbc.TestZloty;
import org.h2.test.jdbc.xa.TestXA;
import org.h2.test.jdbcx.TestDataSource;
import org.h2.test.jdbcx.TestXA;
import org.h2.test.jdbcx.TestXASimple;
import org.h2.test.mvcc.TestMvcc1;
import org.h2.test.mvcc.TestMvcc2;
import org.h2.test.server.TestNestedLoop;
......@@ -149,6 +150,21 @@ java org.h2.test.TestAll timer
/*
h2CallableStatementBatchTest.zip
h2-2007-12-27_test.zip
History:
The H2 Console now calls DataSource.getConnection() instead of DataSource.getConnection(user, password)
when user name and password are not specified.
The bind IP address can now be set when using multi-homed host (if multiple network adapters are available)
using the system property h2.bindAddress.
Batch update: Calling BatchUpdateException.printStackTrace() could result in out of memory. Fixed.
Indexes of unique or foreign constraints where not dropped when the constraint was dropped after
altering the table (for example dropping a column). Fixed.
Roadmap:
Automatically switch source code before compiling
staging.trace.db.gz
drop table logs;
......@@ -159,25 +175,10 @@ ANALYZE SAMPLE_SIZE 0;
script nodata;
EXPLAIN SELECT id FROM Logs WHERE procid=2 AND id<100;
h2CallableStatementBatchTest.zip
h2-2007-12-27_test.zip
docs,
History:
The bind IP address can now be set when using multi-homed host (if multiple network adapters are available)
using the system property h2.bindAddress.
Batch update: Calling BatchUpdateException.printStackTrace() could result in out of memory. Fixed.
Create system property documentation from Javadocs.
allow queries as well in batch updates
CALL syntax should probably work for regular executeUpdate as well.
http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/callablestatement.html#1000220
Automatically switch source code before compiling
[echo] Java version is 1.6 but source code is switched to 1.4.
[echo] Run ant codeswitchJdk... first.
write to the db file what version was used to create a database
Web site:
......@@ -540,17 +541,11 @@ Features of H2
new TestTwoPhaseCommit().runTest(this);
new TestView().runTest(this);
// server
new TestNestedLoop().runTest(this);
new TestWeb().runTest(this);
new TestPgServer().runTest(this);
// jdbc
new TestBatchUpdates().runTest(this);
new TestCallableStatement().runTest(this);
new TestCancel().runTest(this);
new TestDatabaseEventListener().runTest(this);
new TestDataSource().runTest(this);
new TestManyJdbcObjects().runTest(this);
new TestMetaData().runTest(this);
new TestNativeSQL().runTest(this);
......@@ -559,14 +554,23 @@ Features of H2
new TestStatement().runTest(this);
new TestTransactionIsolation().runTest(this);
new TestUpdatableResultSet().runTest(this);
new TestXA().runTest(this);
new TestZloty().runTest(this);
// jdbcx
new TestDataSource().runTest(this);
new TestXA().runTest(this);
new TestXASimple().runTest(this);
// server
new TestNestedLoop().runTest(this);
new TestWeb().runTest(this);
new TestPgServer().runTest(this);
// mvcc
new TestMvcc1().runTest(this);
new TestMvcc2().runTest(this);
// synthetic
// synth
new TestCrashAPI().runTest(this);
new TestRandomSQL().runTest(this);
new TestKillRestart().runTest(this);
......
......@@ -2,7 +2,7 @@
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.jdbc;
package org.h2.test.jdbcx;
import java.sql.Connection;
import java.sql.Statement;
......
......@@ -2,7 +2,7 @@
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: James Devenish
*/
package org.h2.test.jdbc.xa;
package org.h2.test.jdbcx;
import java.sql.Connection;
import java.sql.SQLException;
......
......@@ -2,20 +2,24 @@
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.jdbc;
package org.h2.test.jdbcx;
import java.sql.Connection;
import javax.sql.XAConnection;
import org.h2.jdbcx.JdbcDataSource;
import org.h2.test.TestBase;
/**
* A simple XA test.
*/
public class TestXASimple {
public class TestXASimple extends TestBase {
private int notYetImplemented;
public void test() throws Exception {
public static void main(String[] args) throws Exception {
deleteDb("xaDb1");
deleteDb("xaDb2");
Class.forName("org.h2.Driver");
// InitialContext context = new InitialContext();
......@@ -24,20 +28,22 @@ public class TestXASimple {
JdbcDataSource ds1 = new JdbcDataSource();
ds1.setPassword("");
ds1.setUser("sa");
ds1.setURL("jdbc:h2:db1H2");
ds1.setURL("jdbc:h2:" + baseDir + " /xaDb1");
JdbcDataSource ds2 = new JdbcDataSource();
ds2.setPassword("");
ds2.setUser("sa");
ds2.setURL("jdbc:h2:db2H2");
ds2.setURL("jdbc:h2:" + baseDir + "/xaDb2");
// UserTransaction ut = (UserTransaction)
// context.lookup("UserTransaction");
// ut.begin();
Connection c1 = ds1.getXAConnection().getConnection();
XAConnection xa1 = ds1.getXAConnection();
Connection c1 = xa1.getConnection();
c1.setAutoCommit(false);
Connection c2 = ds2.getXAConnection().getConnection();
XAConnection xa2 = ds2.getXAConnection();
Connection c2 = xa2.getConnection();
c2.setAutoCommit(false);
c1.createStatement().executeUpdate("create table test(id int, test varchar(255))");
......@@ -47,8 +53,13 @@ public class TestXASimple {
c1.close();
c2.close();
xa1.close();
xa2.close();
// j.stop();
// System.exit(0);
deleteDb("xaDb1");
deleteDb("xaDb2");
}
}
......@@ -2,7 +2,7 @@
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: James Devenish
*/
package org.h2.test.jdbc.xa;
package org.h2.test.jdbcx;
import java.net.InetAddress;
import java.net.UnknownHostException;
......
......@@ -2825,11 +2825,10 @@ script NOPASSWORDS NOSETTINGS drop;
> CREATE SCHEMA S AUTHORIZATION SA;
> CREATE SEQUENCE S.SEQ START WITH 10;
> CREATE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints";
> CREATE UNIQUE INDEX S.CU_ID_INDEX_2 ON S.TEST(ID);
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS S.SEQ;
> DROP TABLE IF EXISTS S.TEST;
> rows: 10
> rows: 9
drop trigger s.test_trigger;
> ok
......
CREATE TABLE TEST(A int NOT NULL, B int NOT NULL, C int) ;
ALTER TABLE TEST ADD CONSTRAINT CON UNIQUE(A,B);
ALTER TABLE TEST DROP C;
ALTER TABLE TEST DROP CONSTRAINT CON;
ALTER TABLE TEST DROP B;
DROP TABLE TEST;
select count(d.*) from dual d group by d.x;
> 1;
......
......@@ -15,7 +15,7 @@ import org.h2.value.Value;
* Tests the data parsing.
* The problem is that some dates are not allowed because of the summer time change.
* Most countries change at 2 o'clock in the morning to 3 o'clock, but some
* (for example Chile) change at midnight. Non-lenient parsing wouldn't work in this case.
* (for example Chile) change at midnight. Non-lenient parsing would not work in this case.
*/
public class TestDate extends TestBase {
......
......@@ -521,3 +521,5 @@ countdown paused javac analyzing accesses solving forcefully urgent originally d
camel council merges spelled adaptive pull controller abstractions workarounds driven
thousands ridvan incremented slots debugging inherit agar fulvio invisible biondi hundreds occupied remap retrieved involved
turkish fulfils iapi filesync
compares packets destroying echo homed hosts clock countries validated catches turning staging kills distance morning performs internationalization simulator constructed nicer
echo callablestatement procid homed getstart staging
\ No newline at end of file
......@@ -12,6 +12,8 @@ import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import org.h2.util.StringUtils;
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.FieldDoc;
import com.sun.javadoc.MethodDoc;
......@@ -74,7 +76,7 @@ public class Doclet {
.println("<table class=\"content\"><tr class=\"content\"><td class=\"content\"><div class=\"contentDiv\">");
writer.println("<h1>" + className + "</h1>");
writer.println(clazz.commentText() + "<br /><br />");
writer.println(formatText(clazz.commentText()) + "<br /><br />");
MethodDoc[] methods = clazz.methods();
Arrays.sort(methods, new Comparator() {
......@@ -82,13 +84,17 @@ public class Doclet {
return ((MethodDoc) a).name().compareTo(((MethodDoc) b).name());
}
});
writer.println("<table><tr><th colspan=\"2\">Methods</th></tr>");
boolean hasMethods = false;
for (int i = 0; i < methods.length; i++) {
MethodDoc method = methods[i];
String name = method.name();
if (skipMethod(method)) {
continue;
}
if (!hasMethods) {
writer.println("<table><tr><th colspan=\"2\">Methods</th></tr>");
hasMethods = true;
}
String type = getTypeName(method.isStatic(), method.returnType());
writer.println("<tr><td class=\"return\">" + type + "</td><td class=\"method\">");
Parameter[] params = method.parameters();
......@@ -109,11 +115,13 @@ public class Doclet {
writer.println("<a href=\"#r" + i + "\">" + name + "</a>" + buff.toString());
String firstSentence = getFirstSentence(method.firstSentenceTags());
if (firstSentence != null) {
writer.println("<div class=\"methodText\">" + firstSentence + "</div>");
writer.println("<div class=\"methodText\">" + formatText(firstSentence) + "</div>");
}
writer.println("</td></tr>");
}
if (hasMethods) {
writer.println("</table>");
}
FieldDoc[] fields = clazz.fields();
if (clazz.interfaces().length > 0) {
fields = clazz.interfaces()[0].fields();
......@@ -136,10 +144,15 @@ public class Doclet {
String type = getTypeName(true, field.type());
writer.println("<tr><td class=\"return\">" + type + "</td><td class=\"method\">");
// writer.println("<a href=\"#f" + fieldId + "\">" + name + "</a>");
writer.println(name + " = " + field.constantValueExpression());
String constant = field.constantValueExpression();
if (constant == null) {
writer.println(name);
} else {
writer.println(name + " = " + constant);
}
String text = field.commentText();
if (text != null) {
writer.println("<div class=\"methodText\">" + text + "</div>");
writer.println("<div class=\"methodText\">" + formatText(text) + "</div>");
}
writer.println("</td></tr>");
fieldId++;
......@@ -183,7 +196,7 @@ public class Doclet {
}
writer.println("<h4>" + type + " <span class=\"methodName\">" + name + "</span>" + buff.toString()
+ "</h4>");
writer.println(method.commentText());
writer.println(formatText(method.commentText()));
ParamTag[] paramTags = method.paramTags();
boolean space = false;
for (int j = 0; j < paramTags.length; j++) {
......@@ -229,6 +242,14 @@ public class Doclet {
out.close();
}
private static String formatText(String text) {
if (text == null) {
return text;
}
text = StringUtils.replaceAll(text, "\n </pre>", "</pre>");
return text;
}
private static boolean skipMethod(MethodDoc method) {
ClassDoc clazz = method.containingClass();
if (INTERFACES_ONLY && (!clazz.isAbstract() || !method.isAbstract()) && !clazz.isInterface()) {
......
......@@ -2,7 +2,7 @@
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.security;
package org.h2.tools.security;
import java.security.Key;
import java.security.KeyStore;
......@@ -13,6 +13,7 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.util.Enumeration;
import org.h2.security.SecureSocketFactory;
import org.h2.util.ByteUtils;
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论