提交 1576ebc5 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Javadocs, formatting

上级 f4507bb3
...@@ -55,7 +55,7 @@ Change Log ...@@ -55,7 +55,7 @@ Change Log
</li> </li>
<li>PR #348: pg: send RowDescription in response to Describe (statement variant), patch by kostya-sh <li>PR #348: pg: send RowDescription in response to Describe (statement variant), patch by kostya-sh
</li> </li>
<li>PR #337: Update russian translation, patch by avp1983 <li>PR #337: Update russian translation, patch by avp1983
</li> </li>
<li>PR #329: Update to servlet API version 3.1.0 from 3.0.1, patch by Mat Booth <li>PR #329: Update to servlet API version 3.1.0 from 3.0.1, patch by Mat Booth
</li> </li>
...@@ -63,7 +63,7 @@ Change Log ...@@ -63,7 +63,7 @@ Change Log
</li> </li>
<li>PR #325: Make Row an interface <li>PR #325: Make Row an interface
</li> </li>
<li>PR #323: Regular expression functions (REGEXP_REPLACE, REGEXP_LIKE) enhancement, patch by Akkuzin <li>PR #323: Regular expression functions (REGEXP_REPLACE, REGEXP_LIKE) enhancement, patch by Akkuzin
</li> </li>
<li>Use System.nanoTime for measuring query statistics <li>Use System.nanoTime for measuring query statistics
</li> </li>
...@@ -99,7 +99,7 @@ Change Log ...@@ -99,7 +99,7 @@ Change Log
</li> </li>
<li>File systems: the compressed in-memory file systems now compress better. <li>File systems: the compressed in-memory file systems now compress better.
</li> </li>
<li>LIRS cache: improved hit rate because now added entries get hot if they <li>LIRS cache: improved hit rate because now added entries get hot if they
were in the non-resident part of the cache before. were in the non-resident part of the cache before.
</li> </li>
</ul> </ul>
......
...@@ -42,12 +42,12 @@ cd ../../h2-mvstore/1... ...@@ -42,12 +42,12 @@ cd ../../h2-mvstore/1...
# for each file separately (-javadoc.jar, -sources.jar, .jar, .pom): # for each file separately (-javadoc.jar, -sources.jar, .jar, .pom):
gpg -u "Thomas Mueller Graf <thomas.tom.mueller@gmail.com>" -ab h2-mvstore... gpg -u "Thomas Mueller Graf <thomas.tom.mueller@gmail.com>" -ab h2-mvstore...
jar -cvf bundle.jar h2-* jar -cvf bundle.jar h2-*
# http://central.sonatype.org/pages/ossrh-guide.html # http://central.sonatype.org/pages/ossrh-guide.html
# http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html # http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html
# https://oss.sonatype.org/#welcome - Log In "t..." # https://oss.sonatype.org/#welcome - Log In "t..."
# - Staging Upload # - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar # - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm # - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
# - Staging Upload # - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar # - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm # - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2; package org.h2;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcDriverBackwardsCompat { public interface JdbcDriverBackwardsCompat {
......
...@@ -309,9 +309,11 @@ public abstract class Prepared { ...@@ -309,9 +309,11 @@ public abstract class Prepared {
if (session.getTrace().isInfoEnabled() && startTimeNanos > 0) { if (session.getTrace().isInfoEnabled() && startTimeNanos > 0) {
long deltaTimeNanos = System.nanoTime() - startTimeNanos; long deltaTimeNanos = System.nanoTime() - startTimeNanos;
String params = Trace.formatParams(parameters); String params = Trace.formatParams(parameters);
session.getTrace().infoSQL(sqlStatement, params, rowCount, deltaTimeNanos / 1000 / 1000); session.getTrace().infoSQL(sqlStatement, params, rowCount,
deltaTimeNanos / 1000 / 1000);
} }
// startTime_nanos can be zero for the command that actually turns on statistics // startTime_nanos can be zero for the command that actually turns on
// statistics
if (session.getDatabase().getQueryStatistics() && startTimeNanos != 0) { if (session.getDatabase().getQueryStatistics() && startTimeNanos != 0) {
long deltaTimeNanos = System.nanoTime() - startTimeNanos; long deltaTimeNanos = System.nanoTime() - startTimeNanos;
session.getDatabase().getQueryStatisticsData(). session.getDatabase().getQueryStatisticsData().
......
...@@ -104,7 +104,8 @@ public class CreateView extends SchemaCommand { ...@@ -104,7 +104,8 @@ public class CreateView extends SchemaCommand {
synchronized (sysSession) { synchronized (sysSession) {
try { try {
if (view == null) { if (view == null) {
Schema schema = session.getDatabase().getSchema(session.getCurrentSchemaName()); Schema schema = session.getDatabase().getSchema(
session.getCurrentSchemaName());
sysSession.setCurrentSchema(schema); sysSession.setCurrentSchema(schema);
Column[] columnTemplates = null; Column[] columnTemplates = null;
if (columnNames != null) { if (columnNames != null) {
......
...@@ -150,6 +150,9 @@ public class Mode { ...@@ -150,6 +150,9 @@ public class Mode {
*/ */
public boolean supportPoundSymbolForColumnNames; public boolean supportPoundSymbolForColumnNames;
/**
* Whether an empty list as in "NAME IN()" results in a syntax error.
*/
public boolean prohibitEmptyInPredicate; public boolean prohibitEmptyInPredicate;
private final String name; private final String name;
......
...@@ -54,8 +54,8 @@ public class QueryStatisticsData { ...@@ -54,8 +54,8 @@ public class QueryStatisticsData {
* Update query statistics. * Update query statistics.
* *
* @param sqlStatement the statement being executed * @param sqlStatement the statement being executed
* @param executionTimeNanos the time in nanoseconds the query/update took to * @param executionTimeNanos the time in nanoseconds the query/update took
* execute * to execute
* @param rowCount the query or update row count * @param rowCount the query or update row count
*/ */
public synchronized void update(String sqlStatement, long executionTimeNanos, public synchronized void update(String sqlStatement, long executionTimeNanos,
......
...@@ -2128,7 +2128,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -2128,7 +2128,7 @@ public class Function extends Expression implements FunctionCall {
return hc; return hc;
} }
public int makeRegexpFlags(String stringFlags) { private static int makeRegexpFlags(String stringFlags) {
int flags = Pattern.UNICODE_CASE; int flags = Pattern.UNICODE_CASE;
if (stringFlags != null) { if (stringFlags != null) {
for (int i = 0; i < stringFlags.length(); ++i) { for (int i = 0; i < stringFlags.length(); ++i) {
......
...@@ -19,7 +19,7 @@ import org.h2.result.SearchRow; ...@@ -19,7 +19,7 @@ import org.h2.result.SearchRow;
* for multiple sequential batched lookups, moreover it can be reused for * for multiple sequential batched lookups, moreover it can be reused for
* multiple queries for the same prepared statement. * multiple queries for the same prepared statement.
* *
* @see Index#createLookupBatch(org.h2.table.TableFilter) * @see Index#createLookupBatch(org.h2.table.TableFilter[], int)
* @author Sergi Vladykin * @author Sergi Vladykin
*/ */
public interface IndexLookupBatch { public interface IndexLookupBatch {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbc; package org.h2.jdbc;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcCallableStatementBackwardsCompat { public interface JdbcCallableStatementBackwardsCompat {
......
...@@ -63,7 +63,8 @@ import org.h2.value.ValueString; ...@@ -63,7 +63,8 @@ import org.h2.value.ValueString;
* connection should only be used in one thread at any time. * connection should only be used in one thread at any time.
* </p> * </p>
*/ */
public class JdbcConnection extends TraceObject implements Connection, JdbcConnectionBackwardsCompat { public class JdbcConnection extends TraceObject implements Connection,
JdbcConnectionBackwardsCompat {
private static final String NUM_SERVERS = "numServers"; private static final String NUM_SERVERS = "numServers";
private static final String PREFIX_SERVER = "server"; private static final String PREFIX_SERVER = "server";
...@@ -1892,8 +1893,8 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne ...@@ -1892,8 +1893,8 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
} }
/** /**
* Sets the given schema name to access. Current implementation is case sensitive, * Sets the given schema name to access. Current implementation is case
* i.e. requires schema name to be passed in correct case. * sensitive, i.e. requires schema name to be passed in correct case.
* *
* @param schema the schema name * @param schema the schema name
*/ */
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbc; package org.h2.jdbc;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcConnectionBackwardsCompat { public interface JdbcConnectionBackwardsCompat {
......
...@@ -3708,6 +3708,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -3708,6 +3708,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
* *
* @param columnIndex the column index (1, 2, ...) * @param columnIndex the column index (1, 2, ...)
* @param type the class of the returned value * @param type the class of the returned value
* @return the value
* @throws SQLException if the column is not found or if the result set is * @throws SQLException if the column is not found or if the result set is
* closed * closed
*/ */
...@@ -3731,6 +3732,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -3731,6 +3732,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
* *
* @param columnName the column name * @param columnName the column name
* @param type the class of the returned value * @param type the class of the returned value
* @return the value
*/ */
@Override @Override
public <T> T getObject(String columnName, Class<T> type) throws SQLException { public <T> T getObject(String columnName, Class<T> type) throws SQLException {
...@@ -3789,7 +3791,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -3789,7 +3791,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
} else if (LocalDateTimeUtils.isLocalDateTime(type)) { } else if (LocalDateTimeUtils.isLocalDateTime(type)) {
return type.cast(LocalDateTimeUtils.valueToLocalDateTime( return type.cast(LocalDateTimeUtils.valueToLocalDateTime(
(ValueTimestamp) value)); (ValueTimestamp) value));
} else if (LocalDateTimeUtils.isOffsetDateTime(type) && value instanceof ValueTimestampTimeZone) { } else if (LocalDateTimeUtils.isOffsetDateTime(type) &&
value instanceof ValueTimestampTimeZone) {
return type.cast(LocalDateTimeUtils.valueToOffsetDateTime( return type.cast(LocalDateTimeUtils.valueToOffsetDateTime(
(ValueTimestampTimeZone) value)); (ValueTimestampTimeZone) value));
} else { } else {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbc; package org.h2.jdbc;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcResultSetBackwardsCompat { public interface JdbcResultSetBackwardsCompat {
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbc; package org.h2.jdbc;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcStatementBackwardsCompat { public interface JdbcStatementBackwardsCompat {
......
...@@ -59,7 +59,8 @@ import org.h2.util.New; ...@@ -59,7 +59,8 @@ import org.h2.util.New;
* (<a href="http://www.source-code.biz">www.source-code.biz</a>) * (<a href="http://www.source-code.biz">www.source-code.biz</a>)
* @author Thomas Mueller * @author Thomas Mueller
*/ */
public class JdbcConnectionPool implements DataSource, ConnectionEventListener, JdbcConnectionPoolBackwardsCompat { public class JdbcConnectionPool implements DataSource, ConnectionEventListener,
JdbcConnectionPoolBackwardsCompat {
private static final int DEFAULT_TIMEOUT = 30; private static final int DEFAULT_TIMEOUT = 30;
private static final int DEFAULT_MAX_CONNECTIONS = 10; private static final int DEFAULT_MAX_CONNECTIONS = 10;
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbcx; package org.h2.jdbcx;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcConnectionPoolBackwardsCompat { public interface JdbcConnectionPoolBackwardsCompat {
......
...@@ -60,7 +60,8 @@ import org.h2.util.StringUtils; ...@@ -60,7 +60,8 @@ import org.h2.util.StringUtils;
* well; this may be a security problem in some cases. * well; this may be a security problem in some cases.
*/ */
public class JdbcDataSource extends TraceObject implements XADataSource, public class JdbcDataSource extends TraceObject implements XADataSource,
DataSource, ConnectionPoolDataSource, Serializable, Referenceable, JdbcDataSourceBackwardsCompat { DataSource, ConnectionPoolDataSource, Serializable, Referenceable,
JdbcDataSourceBackwardsCompat {
private static final long serialVersionUID = 1288136338451857771L; private static final long serialVersionUID = 1288136338451857771L;
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
package org.h2.jdbcx; package org.h2.jdbcx;
/** /**
* Allows us to compile on older platforms, while still implementing the methods from the newer JDBC API. * Allows us to compile on older platforms, while still implementing the methods
* from the newer JDBC API.
*/ */
public interface JdbcDataSourceBackwardsCompat { public interface JdbcDataSourceBackwardsCompat {
......
...@@ -2831,7 +2831,8 @@ public class MVStore { ...@@ -2831,7 +2831,8 @@ public class MVStore {
} }
/** /**
* Set the read cache concurrency. The default is 16, meaning 16 segments are used. * Set the read cache concurrency. The default is 16, meaning 16
* segments are used.
* *
* @param concurrency the cache concurrency * @param concurrency the cache concurrency
* @return this * @return this
......
...@@ -333,7 +333,8 @@ public class MVStoreTool { ...@@ -333,7 +333,8 @@ public class MVStoreTool {
* *
* @param fileName the name of the file * @param fileName the name of the file
* @param writer the print writer * @param writer the print writer
* @return null if successful (if there was no error), otherwise the error message * @return null if successful (if there was no error), otherwise the error
* message
*/ */
public static String info(String fileName, Writer writer) { public static String info(String fileName, Writer writer) {
PrintWriter pw = new PrintWriter(writer, true); PrintWriter pw = new PrintWriter(writer, true);
...@@ -544,7 +545,8 @@ public class MVStoreTool { ...@@ -544,7 +545,8 @@ public class MVStoreTool {
} }
}; };
while (version >= 0) { while (version >= 0) {
pw.println(version == Long.MAX_VALUE ? "Trying latest version" : ("Trying version " + version)); pw.println(version == Long.MAX_VALUE ? "Trying latest version"
: ("Trying version " + version));
pw.flush(); pw.flush();
version = rollback(fileName, version, new PrintWriter(ignore)); version = rollback(fileName, version, new PrintWriter(ignore));
try { try {
...@@ -569,7 +571,9 @@ public class MVStoreTool { ...@@ -569,7 +571,9 @@ public class MVStoreTool {
* Roll back to a given revision into a a file called *.temp. * Roll back to a given revision into a a file called *.temp.
* *
* @param fileName the file name * @param fileName the file name
* @param targetVersion the version to roll back to (Long.MAX_VALUE for the latest version) * @param targetVersion the version to roll back to (Long.MAX_VALUE for the
* latest version)
* @param writer the log writer
* @return the version rolled back to (-1 if no version) * @return the version rolled back to (-1 if no version)
*/ */
public static long rollback(String fileName, long targetVersion, Writer writer) { public static long rollback(String fileName, long targetVersion, Writer writer) {
......
...@@ -18,6 +18,9 @@ import org.h2.store.fs.FilePathWrapper; ...@@ -18,6 +18,9 @@ import org.h2.store.fs.FilePathWrapper;
*/ */
public class FilePathCache extends FilePathWrapper { public class FilePathCache extends FilePathWrapper {
/**
* The instance.
*/
public static final FilePathCache INSTANCE = new FilePathCache(); public static final FilePathCache INSTANCE = new FilePathCache();
/** /**
......
...@@ -663,7 +663,8 @@ public class PgServerThread implements Runnable { ...@@ -663,7 +663,8 @@ public class PgServerThread implements Runnable {
sendMessage(); sendMessage();
} }
private void sendParameterDescription(ParameterMetaData meta, int[] paramTypes) throws Exception { private void sendParameterDescription(ParameterMetaData meta,
int[] paramTypes) throws Exception {
int count = meta.getParameterCount(); int count = meta.getParameterCount();
startMessage('t'); startMessage('t');
writeShort(count); writeShort(count);
......
...@@ -123,7 +123,7 @@ tools.convertTraceFile.help=Преобразует .trace.db файл в при ...@@ -123,7 +123,7 @@ tools.convertTraceFile.help=Преобразует .trace.db файл в при
tools.createCluster=Создать кластер tools.createCluster=Создать кластер
tools.createCluster.help=Создание кластера из автономной базы данных. tools.createCluster.help=Создание кластера из автономной базы данных.
tools.databaseName=Имя базы данных tools.databaseName=Имя базы данных
tools.decryptionPassword=Пароль дешифровки tools.decryptionPassword=Пароль дешифровки
tools.deleteDbFiles=Удалить файлы БД tools.deleteDbFiles=Удалить файлы БД
tools.deleteDbFiles.help=Удаляет все файлы, относящиеся к базе данных. tools.deleteDbFiles.help=Удаляет все файлы, относящиеся к базе данных.
tools.directory=Каталог tools.directory=Каталог
......
...@@ -15,7 +15,8 @@ import java.nio.charset.CodingErrorAction; ...@@ -15,7 +15,8 @@ import java.nio.charset.CodingErrorAction;
import org.h2.engine.Constants; import org.h2.engine.Constants;
/** /**
* An input stream that reads the data from a reader and limits the number of bytes that can be read. * An input stream that reads the data from a reader and limits the number of
* bytes that can be read.
*/ */
public class CountingReaderInputStream extends InputStream { public class CountingReaderInputStream extends InputStream {
......
...@@ -555,7 +555,6 @@ class FileNioMemData { ...@@ -555,7 +555,6 @@ class FileNioMemData {
/** /**
* Compress the data in a byte array. * Compress the data in a byte array.
* *
* @param data the page array
* @param page which page to compress * @param page which page to compress
*/ */
void compress(int page) { void compress(int page) {
......
...@@ -15,6 +15,7 @@ import org.h2.command.dml.Query; ...@@ -15,6 +15,7 @@ import org.h2.command.dml.Query;
import org.h2.command.dml.Select; import org.h2.command.dml.Select;
import org.h2.command.dml.SelectUnion; import org.h2.command.dml.SelectUnion;
import org.h2.index.Cursor; import org.h2.index.Cursor;
import org.h2.index.Index;
import org.h2.index.IndexCursor; import org.h2.index.IndexCursor;
import org.h2.index.IndexLookupBatch; import org.h2.index.IndexLookupBatch;
import org.h2.index.ViewCursor; import org.h2.index.ViewCursor;
...@@ -32,7 +33,7 @@ import org.h2.value.ValueLong; ...@@ -32,7 +33,7 @@ import org.h2.value.ValueLong;
/** /**
* Support for asynchronous batched index lookups on joins. * Support for asynchronous batched index lookups on joins.
* *
* @see org.h2.index.Index#createLookupBatch(TableFilter) * @see Index#createLookupBatch(org.h2.table.TableFilter[], int)
* @see IndexLookupBatch * @see IndexLookupBatch
* @author Sergi Vladykin * @author Sergi Vladykin
*/ */
......
...@@ -54,7 +54,8 @@ import org.h2.value.DataType; ...@@ -54,7 +54,8 @@ import org.h2.value.DataType;
* </pre> * </pre>
* *
*/ */
public class SimpleResultSet implements ResultSet, ResultSetMetaData, JdbcResultSetBackwardsCompat { public class SimpleResultSet implements ResultSet, ResultSetMetaData,
JdbcResultSetBackwardsCompat {
private ArrayList<Object[]> rows; private ArrayList<Object[]> rows;
private Object[] currentRow; private Object[] currentRow;
......
...@@ -62,7 +62,8 @@ public class DateTimeUtils { ...@@ -62,7 +62,8 @@ public class DateTimeUtils {
/** /**
* A cached instance of Calendar used when a timezone is specified. * A cached instance of Calendar used when a timezone is specified.
*/ */
private static final ThreadLocal<Calendar> CACHED_CALENDAR_NON_DEFAULT_TIMEZONE = new ThreadLocal<Calendar>(); private static final ThreadLocal<Calendar> CACHED_CALENDAR_NON_DEFAULT_TIMEZONE =
new ThreadLocal<Calendar>();
/** /**
* Observed JVM behaviour is that if the timezone of the host computer is * Observed JVM behaviour is that if the timezone of the host computer is
......
/* /*
* Copyright 2016 H2 Group. Multiple-Licensed under the MPL 2.0, and the * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* EPL 1.0 (http://h2database.com/html/license.html). Initial Developer: H2 * and the EPL 1.0 (http://h2database.com/html/license.html).
* Group Iso8601: Initial Developer: Philippe Marschall (firstName dot lastName * Initial Developer: H2 Group
* Iso8601: Initial Developer: Philippe Marschall (firstName dot lastName
* at gmail dot com) * at gmail dot com)
*/ */
package org.h2.util; package org.h2.util;
...@@ -9,7 +10,6 @@ package org.h2.util; ...@@ -9,7 +10,6 @@ package org.h2.util;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.Date; import java.sql.Date;
import java.sql.SQLException;
import java.sql.Time; import java.sql.Time;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -150,8 +150,10 @@ public class LocalDateTimeUtils { ...@@ -150,8 +150,10 @@ public class LocalDateTimeUtils {
DATE_VALUE_OF = getMethod(java.sql.Date.class, "valueOf", LOCAL_DATE); DATE_VALUE_OF = getMethod(java.sql.Date.class, "valueOf", LOCAL_DATE);
TIME_VALUE_OF = getMethod(java.sql.Time.class, "valueOf", LOCAL_TIME); TIME_VALUE_OF = getMethod(java.sql.Time.class, "valueOf", LOCAL_TIME);
LOCAL_DATE_OF_YEAR_MONTH_DAY = getMethod(LOCAL_DATE, "of", int.class, int.class, int.class); LOCAL_DATE_OF_YEAR_MONTH_DAY = getMethod(LOCAL_DATE, "of",
LOCAL_DATE_PARSE = getMethod(LOCAL_DATE, "parse", CharSequence.class); int.class, int.class, int.class);
LOCAL_DATE_PARSE = getMethod(LOCAL_DATE, "parse",
CharSequence.class);
LOCAL_DATE_GET_YEAR = getMethod(LOCAL_DATE, "getYear"); LOCAL_DATE_GET_YEAR = getMethod(LOCAL_DATE, "getYear");
LOCAL_DATE_GET_MONTH_VALUE = getMethod(LOCAL_DATE, "getMonthValue"); LOCAL_DATE_GET_MONTH_VALUE = getMethod(LOCAL_DATE, "getMonthValue");
LOCAL_DATE_GET_DAY_OF_MONTH = getMethod(LOCAL_DATE, "getDayOfMonth"); LOCAL_DATE_GET_DAY_OF_MONTH = getMethod(LOCAL_DATE, "getDayOfMonth");
...@@ -168,7 +170,8 @@ public class LocalDateTimeUtils { ...@@ -168,7 +170,8 @@ public class LocalDateTimeUtils {
OFFSET_DATE_TIME_TO_LOCAL_DATE_TIME = getMethod(OFFSET_DATE_TIME, "toLocalDateTime"); OFFSET_DATE_TIME_TO_LOCAL_DATE_TIME = getMethod(OFFSET_DATE_TIME, "toLocalDateTime");
OFFSET_DATE_TIME_GET_OFFSET = getMethod(OFFSET_DATE_TIME, "getOffset"); OFFSET_DATE_TIME_GET_OFFSET = getMethod(OFFSET_DATE_TIME, "getOffset");
OFFSET_DATE_TIME_OF_LOCAL_DATE_TIME_ZONE_OFFSET = getMethod(OFFSET_DATE_TIME, "of", LOCAL_DATE_TIME, ZONE_OFFSET); OFFSET_DATE_TIME_OF_LOCAL_DATE_TIME_ZONE_OFFSET = getMethod(
OFFSET_DATE_TIME, "of", LOCAL_DATE_TIME, ZONE_OFFSET);
OFFSET_DATE_TIME_PARSE = getMethod(OFFSET_DATE_TIME, "parse", CharSequence.class); OFFSET_DATE_TIME_PARSE = getMethod(OFFSET_DATE_TIME, "parse", CharSequence.class);
ZONE_OFFSET_GET_TOTAL_SECONDS = getMethod(ZONE_OFFSET, "getTotalSeconds"); ZONE_OFFSET_GET_TOTAL_SECONDS = getMethod(ZONE_OFFSET, "getTotalSeconds");
...@@ -293,16 +296,19 @@ public class LocalDateTimeUtils { ...@@ -293,16 +296,19 @@ public class LocalDateTimeUtils {
try { try {
return Class.forName(className); return Class.forName(className);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalStateException("Java 8 or later but class " + className + " is missing", e); throw new IllegalStateException("Java 8 or later but class " +
className + " is missing", e);
} }
} }
private static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) { private static Method getMethod(Class<?> clazz, String methodName,
Class<?>... parameterTypes) {
try { try {
return clazz.getMethod(methodName, parameterTypes); return clazz.getMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new IllegalStateException("Java 8 or later but method " throw new IllegalStateException("Java 8 or later but method " +
+ clazz.getName() + "#" + methodName + "(" + Arrays.toString(parameterTypes) + ") is missing", e); clazz.getName() + "#" + methodName + "(" +
Arrays.toString(parameterTypes) + ") is missing", e);
} }
} }
...@@ -310,8 +316,8 @@ public class LocalDateTimeUtils { ...@@ -310,8 +316,8 @@ public class LocalDateTimeUtils {
try { try {
return clazz.getField(fieldName).get(null); return clazz.getField(fieldName).get(null);
} catch (NoSuchFieldException | IllegalAccessException e) { } catch (NoSuchFieldException | IllegalAccessException e) {
throw new IllegalStateException("Java 8 or later but field " + clazz.getName() throw new IllegalStateException("Java 8 or later but field " +
+ "#" + fieldName + " is missing", e); clazz.getName() + "#" + fieldName + " is missing", e);
} }
} }
...@@ -371,8 +377,7 @@ public class LocalDateTimeUtils { ...@@ -371,8 +377,7 @@ public class LocalDateTimeUtils {
* @param value the value to convert * @param value the value to convert
* @return the LocalDate * @return the LocalDate
*/ */
public static Object valueToLocalDate(Value value) public static Object valueToLocalDate(Value value) {
throws SQLException {
return dateToLocalDate(value.getDate()); return dateToLocalDate(value.getDate());
} }
...@@ -384,13 +389,11 @@ public class LocalDateTimeUtils { ...@@ -384,13 +389,11 @@ public class LocalDateTimeUtils {
* @param value the value to convert * @param value the value to convert
* @return the LocalTime * @return the LocalTime
*/ */
public static Object valueToLocalTime(Value value) public static Object valueToLocalTime(Value value) {
throws SQLException {
return timeToLocalTime(value.getTime()); return timeToLocalTime(value.getTime());
} }
private static Object dateToLocalDate(Date date) private static Object dateToLocalDate(Date date) {
throws SQLException {
try { try {
return TO_LOCAL_DATE.invoke(date); return TO_LOCAL_DATE.invoke(date);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
...@@ -400,8 +403,7 @@ public class LocalDateTimeUtils { ...@@ -400,8 +403,7 @@ public class LocalDateTimeUtils {
} }
} }
private static Object timeToLocalTime(Time time) private static Object timeToLocalTime(Time time) {
throws SQLException {
try { try {
return TO_LOCAL_TIME.invoke(time); return TO_LOCAL_TIME.invoke(time);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
...@@ -419,8 +421,7 @@ public class LocalDateTimeUtils { ...@@ -419,8 +421,7 @@ public class LocalDateTimeUtils {
* @param value the value to convert * @param value the value to convert
* @return the LocalDateTime * @return the LocalDateTime
*/ */
public static Object valueToLocalDateTime(ValueTimestamp value) public static Object valueToLocalDateTime(ValueTimestamp value) {
throws SQLException {
long dateValue = value.getDateValue(); long dateValue = value.getDateValue();
long timeNanos = value.getTimeNanos(); long timeNanos = value.getTimeNanos();
...@@ -443,13 +444,12 @@ public class LocalDateTimeUtils { ...@@ -443,13 +444,12 @@ public class LocalDateTimeUtils {
* @param value the value to convert * @param value the value to convert
* @return the OffsetDateTime * @return the OffsetDateTime
*/ */
public static Object valueToOffsetDateTime(ValueTimestampTimeZone value) public static Object valueToOffsetDateTime(ValueTimestampTimeZone value) {
throws SQLException {
return timestampWithTimeZoneToOffsetDateTime((TimestampWithTimeZone) value.getObject()); return timestampWithTimeZoneToOffsetDateTime((TimestampWithTimeZone) value.getObject());
} }
private static Object timestampWithTimeZoneToOffsetDateTime(TimestampWithTimeZone timestampWithTimeZone) private static Object timestampWithTimeZoneToOffsetDateTime(
throws SQLException { TimestampWithTimeZone timestampWithTimeZone) {
long dateValue = timestampWithTimeZone.getYMD(); long dateValue = timestampWithTimeZone.getYMD();
long timeNanos = timestampWithTimeZone.getNanosSinceMidnight(); long timeNanos = timestampWithTimeZone.getNanosSinceMidnight();
...@@ -461,7 +461,8 @@ public class LocalDateTimeUtils { ...@@ -461,7 +461,8 @@ public class LocalDateTimeUtils {
Object offset = ZONE_OFFSET_OF_TOTAL_SECONDS.invoke(null, offsetSeconds); Object offset = ZONE_OFFSET_OF_TOTAL_SECONDS.invoke(null, offsetSeconds);
return OFFSET_DATE_TIME_OF_LOCAL_DATE_TIME_ZONE_OFFSET.invoke(null, localDateTime, offset); return OFFSET_DATE_TIME_OF_LOCAL_DATE_TIME_ZONE_OFFSET.invoke(null,
localDateTime, offset);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw DbException.convert(e); throw DbException.convert(e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
...@@ -531,13 +532,14 @@ public class LocalDateTimeUtils { ...@@ -531,13 +532,14 @@ public class LocalDateTimeUtils {
public static Value offsetDateTimeToValue(Object offsetDateTime) { public static Value offsetDateTimeToValue(Object offsetDateTime) {
try { try {
Object localDateTime = OFFSET_DATE_TIME_TO_LOCAL_DATE_TIME.invoke(offsetDateTime); Object localDateTime = OFFSET_DATE_TIME_TO_LOCAL_DATE_TIME.invoke(offsetDateTime);
Object localDate = LOCAL_DATE_TIME_TO_LOCAL_DATE.invoke(localDateTime);; Object localDate = LOCAL_DATE_TIME_TO_LOCAL_DATE.invoke(localDateTime);
Object zoneOffset = OFFSET_DATE_TIME_GET_OFFSET.invoke(offsetDateTime); Object zoneOffset = OFFSET_DATE_TIME_GET_OFFSET.invoke(offsetDateTime);
long dateValue = dateValueFromLocalDate(localDate); long dateValue = dateValueFromLocalDate(localDate);
long timeNanos = timeNanosFromLocalDate(localDateTime); long timeNanos = timeNanosFromLocalDate(localDateTime);
short timeZoneOffsetMins = zoneOffsetToOffsetMinute(zoneOffset); short timeZoneOffsetMins = zoneOffsetToOffsetMinute(zoneOffset);
return ValueTimestampTimeZone.fromDateValueAndNanos(dateValue, timeNanos, timeZoneOffsetMins); return ValueTimestampTimeZone.fromDateValueAndNanos(dateValue,
timeNanos, timeZoneOffsetMins);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw DbException.convert(e); throw DbException.convert(e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
......
...@@ -9,7 +9,8 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -9,7 +9,8 @@ import java.util.concurrent.ConcurrentHashMap;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
/** /**
* A concurrent hash map with a case-insensitive string key, that also allows NULL as a key. * A concurrent hash map with a case-insensitive string key, that also allows
* NULL as a key.
* *
* @param <V> the value type * @param <V> the value type
*/ */
......
...@@ -860,10 +860,12 @@ public abstract class Value { ...@@ -860,10 +860,12 @@ public abstract class Value {
case BYTES: case BYTES:
return ValueUuid.get(getBytesNoCopy()); return ValueUuid.get(getBytesNoCopy());
case JAVA_OBJECT: case JAVA_OBJECT:
Object object = JdbcUtils.deserialize(getBytesNoCopy(), getDataHandler()); Object object = JdbcUtils.deserialize(getBytesNoCopy(),
getDataHandler());
if (object instanceof java.util.UUID) { if (object instanceof java.util.UUID) {
java.util.UUID uuid = (java.util.UUID) object; java.util.UUID uuid = (java.util.UUID) object;
return ValueUuid.get(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()); return ValueUuid.get(uuid.getMostSignificantBits(),
uuid.getLeastSignificantBits());
} else { } else {
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, getString()); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, getString());
} }
......
...@@ -290,17 +290,21 @@ public class ValueTimestampTimeZone extends Value { ...@@ -290,17 +290,21 @@ public class ValueTimestampTimeZone extends Value {
@Override @Override
protected int compareSecure(Value o, CompareMode mode) { protected int compareSecure(Value o, CompareMode mode) {
ValueTimestampTimeZone t = (ValueTimestampTimeZone) o; ValueTimestampTimeZone t = (ValueTimestampTimeZone) o;
// We are pretending that the dateValue is in UTC because that gives us a stable sort // We are pretending that the dateValue is in UTC because that gives us
// even if the DST database changes. // a stable sort even if the DST database changes.
// convert to minutes and add timezone offset // convert to minutes and add timezone offset
long a = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), dateValue) / (1000L * 60L); long a = DateTimeUtils.convertDateValueToMillis(
TimeZone.getTimeZone("UTC"), dateValue) /
(1000L * 60L);
long ma = timeNanos / (1000L * 1000L * 1000L * 60L); long ma = timeNanos / (1000L * 1000L * 1000L * 60L);
a += ma; a += ma;
a -= timeZoneOffsetMins; a -= timeZoneOffsetMins;
// convert to minutes and add timezone offset // convert to minutes and add timezone offset
long b = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), t.dateValue) / (1000L * 60L); long b = DateTimeUtils.convertDateValueToMillis(
TimeZone.getTimeZone("UTC"), t.dateValue) /
(1000L * 60L);
long mb = t.timeNanos / (1000L * 1000L * 1000L * 60L); long mb = t.timeNanos / (1000L * 1000L * 1000L * 60L);
b += mb; b += mb;
b -= t.timeZoneOffsetMins; b -= t.timeZoneOffsetMins;
......
...@@ -246,9 +246,11 @@ public class TestDuplicateKeyUpdate extends TestBase { ...@@ -246,9 +246,11 @@ public class TestDuplicateKeyUpdate extends TestBase {
private void testPrimaryKeyAndUniqueKey(Connection conn) throws SQLException private void testPrimaryKeyAndUniqueKey(Connection conn) throws SQLException
{ {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE TABLE test (id INT, dup INT, counter INT, PRIMARY KEY(id), UNIQUE(dup))"); stat.execute("CREATE TABLE test (id INT, dup INT, " +
"counter INT, PRIMARY KEY(id), UNIQUE(dup))");
stat.execute("INSERT INTO test (id, dup, counter) VALUES (1, 1, 1)"); stat.execute("INSERT INTO test (id, dup, counter) VALUES (1, 1, 1)");
stat.execute("INSERT INTO test (id, dup, counter) VALUES (2, 1, 1) ON DUPLICATE KEY UPDATE counter = counter + VALUES(counter)"); stat.execute("INSERT INTO test (id, dup, counter) VALUES (2, 1, 1) " +
"ON DUPLICATE KEY UPDATE counter = counter + VALUES(counter)");
// Check result // Check result
ResultSet rs = stat.executeQuery("SELECT counter FROM test ORDER BY id"); ResultSet rs = stat.executeQuery("SELECT counter FROM test ORDER BY id");
......
...@@ -2005,7 +2005,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2005,7 +2005,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
} }
} }
private void testThatCurrentTimestampIsSane() throws SQLException, InterruptedException, ParseException { private void testThatCurrentTimestampIsSane() throws SQLException,
ParseException {
deleteDb("functions"); deleteDb("functions");
Date before = new Date(); Date before = new Date();
...@@ -2031,7 +2032,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2031,7 +2032,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
} }
private void testThatCurrentTimestampStaysTheSameWithinATransaction() throws SQLException, InterruptedException { private void testThatCurrentTimestampStaysTheSameWithinATransaction()
throws SQLException, InterruptedException {
deleteDb("functions"); deleteDb("functions");
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
conn.setAutoCommit(false); conn.setAutoCommit(false);
...@@ -2054,7 +2056,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2054,7 +2056,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals(first, second); assertEquals(first, second);
} }
private void testThatCurrentTimestampUpdatesOutsideATransaction() throws SQLException, InterruptedException { private void testThatCurrentTimestampUpdatesOutsideATransaction()
throws SQLException, InterruptedException {
deleteDb("functions"); deleteDb("functions");
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
conn.setAutoCommit(true); conn.setAutoCommit(true);
......
...@@ -111,7 +111,8 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -111,7 +111,8 @@ public class TestListener extends TestBase implements DatabaseEventListener {
return; return;
} }
try (Connection conn = DriverManager.getConnection(databaseUrl, getUser(), getPassword())) { try (Connection conn = DriverManager.getConnection(databaseUrl,
getUser(), getPassword())) {
conn.createStatement().execute("DROP TABLE TEST2"); conn.createStatement().execute("DROP TABLE TEST2");
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
...@@ -130,7 +131,8 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -130,7 +131,8 @@ public class TestListener extends TestBase implements DatabaseEventListener {
return; return;
} }
try (Connection conn = DriverManager.getConnection(databaseUrl, getUser(), getPassword())) { try (Connection conn = DriverManager.getConnection(databaseUrl,
getUser(), getPassword())) {
conn.createStatement().execute("CREATE TABLE IF NOT EXISTS TEST2(ID INT)"); conn.createStatement().execute("CREATE TABLE IF NOT EXISTS TEST2(ID INT)");
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
......
...@@ -1505,7 +1505,10 @@ public class TestLob extends TestBase { ...@@ -1505,7 +1505,10 @@ public class TestLob extends TestBase {
conn.close(); conn.close();
} }
/** test a bug where the usage of BufferedInputStream in LobStorageMap was causing a deadlock */ /**
* Test a bug where the usage of BufferedInputStream in LobStorageMap was
* causing a deadlock.
*/
private void testBufferedInputStreamBug() throws SQLException { private void testBufferedInputStreamBug() throws SQLException {
deleteDb("lob"); deleteDb("lob");
JdbcConnection conn = (JdbcConnection) getConnection("lob"); JdbcConnection conn = (JdbcConnection) getConnection("lob");
......
...@@ -307,7 +307,8 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -307,7 +307,8 @@ public class TestMultiThread extends TestBase implements Runnable {
stat.execute("CREATE VIEW INVOICE_VIEW as SELECT * FROM INVOICE"); stat.execute("CREATE VIEW INVOICE_VIEW as SELECT * FROM INVOICE");
stat.execute( stat.execute(
"CREATE TABLE INVOICE_DETAIL(DETAIL_ID INT PRIMARY KEY, INVOICE_ID INT, DESCRIPTION VARCHAR)"); "CREATE TABLE INVOICE_DETAIL(DETAIL_ID INT PRIMARY KEY, " +
"INVOICE_ID INT, DESCRIPTION VARCHAR)");
stat.execute( stat.execute(
"CREATE VIEW INVOICE_DETAIL_VIEW as SELECT * FROM INVOICE_DETAIL"); "CREATE VIEW INVOICE_DETAIL_VIEW as SELECT * FROM INVOICE_DETAIL");
...@@ -331,7 +332,8 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -331,7 +332,8 @@ public class TestMultiThread extends TestBase implements Runnable {
// NullPointerException // NullPointerException
stat2.execute("CREATE VIEW INVOICE_DETAIL_VIEW" + j stat2.execute("CREATE VIEW INVOICE_DETAIL_VIEW" + j
+ " as SELECT DTL.* FROM INVOICE_VIEW" + j + " as SELECT DTL.* FROM INVOICE_VIEW" + j
+ " INV JOIN INVOICE_DETAIL_VIEW DTL ON INV.INVOICE_ID = DTL.INVOICE_ID" + " INV JOIN INVOICE_DETAIL_VIEW DTL "
+ "ON INV.INVOICE_ID = DTL.INVOICE_ID"
+ " WHERE DESCRIPTION='TEST'"); + " WHERE DESCRIPTION='TEST'");
ResultSet rs = stat2 ResultSet rs = stat2
......
...@@ -206,7 +206,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger { ...@@ -206,7 +206,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
} }
private void testViewTriggerGeneratedKeys() throws SQLException { private void testViewTriggerGeneratedKeys() throws SQLException {
Connection conn; Connection conn;
Statement stat; Statement stat;
...@@ -223,19 +223,20 @@ public class TestTriggersConstraints extends TestBase implements Trigger { ...@@ -223,19 +223,20 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
conn = getConnection("trigger"); conn = getConnection("trigger");
stat = conn.createStatement(); stat = conn.createStatement();
} }
PreparedStatement pstat; PreparedStatement pstat;
pstat = conn.prepareStatement("insert into test_view values()", Statement.RETURN_GENERATED_KEYS); pstat = conn.prepareStatement(
"insert into test_view values()", Statement.RETURN_GENERATED_KEYS);
int count = pstat.executeUpdate(); int count = pstat.executeUpdate();
assertEquals(1, count); assertEquals(1, count);
ResultSet gkRs; ResultSet gkRs;
gkRs = pstat.getGeneratedKeys(); gkRs = pstat.getGeneratedKeys();
assertTrue(gkRs.next()); assertTrue(gkRs.next());
assertEquals(1, gkRs.getInt(1)); assertEquals(1, gkRs.getInt(1));
assertFalse(gkRs.next()); assertFalse(gkRs.next());
ResultSet rs; ResultSet rs;
rs = stat.executeQuery("select * from test"); rs = stat.executeQuery("select * from test");
assertTrue(rs.next()); assertTrue(rs.next());
...@@ -328,7 +329,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger { ...@@ -328,7 +329,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
} }
} }
/** /**
* *
*/ */
...@@ -340,7 +341,8 @@ public class TestTriggersConstraints extends TestBase implements Trigger { ...@@ -340,7 +341,8 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
public void init(Connection conn, String schemaName, public void init(Connection conn, String schemaName,
String triggerName, String tableName, boolean before, int type) String triggerName, String tableName, boolean before, int type)
throws SQLException { throws SQLException {
prepInsert = conn.prepareStatement("insert into test values()", Statement.RETURN_GENERATED_KEYS); prepInsert = conn.prepareStatement(
"insert into test values()", Statement.RETURN_GENERATED_KEYS);
} }
@Override @Override
......
...@@ -642,7 +642,8 @@ public class TestPreparedStatement extends TestBase { ...@@ -642,7 +642,8 @@ public class TestPreparedStatement extends TestBase {
return; return;
} }
PreparedStatement prep = conn.prepareStatement("SELECT ?"); PreparedStatement prep = conn.prepareStatement("SELECT ?");
Object offsetDateTime = LocalDateTimeUtils.parseOffsetDateTime("2001-02-03T04:05:06+02:30"); Object offsetDateTime = LocalDateTimeUtils
.parseOffsetDateTime("2001-02-03T04:05:06+02:30");
prep.setObject(1, offsetDateTime); prep.setObject(1, offsetDateTime);
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
rs.next(); rs.next();
......
...@@ -1124,7 +1124,8 @@ public class TestResultSet extends TestBase { ...@@ -1124,7 +1124,8 @@ public class TestResultSet extends TestBase {
} }
if (LocalDateTimeUtils.isJava8DateApiPresent()) { if (LocalDateTimeUtils.isJava8DateApiPresent()) {
assertEquals("2007-08-09T10:11:12.141516171", assertEquals("2007-08-09T10:11:12.141516171",
rs.getObject(3, LocalDateTimeUtils.getLocalDateTimeClass()).toString()); rs.getObject(3, LocalDateTimeUtils.getLocalDateTimeClass())
.toString());
} }
stat.execute("DROP TABLE TEST"); stat.execute("DROP TABLE TEST");
......
...@@ -70,7 +70,8 @@ public class TestBenchmark extends TestBase { ...@@ -70,7 +70,8 @@ public class TestBenchmark extends TestBase {
FileUtils.delete(fileName); FileUtils.delete(fileName);
} }
private void testConcurrency(String fileName, int concurrency, final int count) throws Exception { private void testConcurrency(String fileName,
int concurrency, final int count) throws Exception {
Thread.sleep(1000); Thread.sleep(1000);
final MVStore store = new MVStore.Builder().cacheSize(256). final MVStore store = new MVStore.Builder().cacheSize(256).
cacheConcurrency(concurrency). cacheConcurrency(concurrency).
...@@ -112,7 +113,8 @@ public class TestBenchmark extends TestBase { ...@@ -112,7 +113,8 @@ public class TestBenchmark extends TestBase {
t.get(); t.get();
} }
// System.out.println(prof.getTop(5)); // System.out.println(prof.getTop(5));
String msg = "concurrency " + concurrency + " threads " + threadCount + " requests: " + counter; String msg = "concurrency " + concurrency +
" threads " + threadCount + " requests: " + counter;
System.out.println(msg); System.out.println(msg);
trace(msg); trace(msg);
store.close(); store.close();
......
...@@ -89,7 +89,6 @@ public class TestMVStoreCachePerformance extends TestBase { ...@@ -89,7 +89,6 @@ public class TestMVStoreCachePerformance extends TestBase {
for (Task t : tasks) { for (Task t : tasks) {
t.get(); t.get();
} }
// System.out.println(System.currentTimeMillis() - time + " ms to stop");
store.close(); store.close();
System.out.println(counter.get() / 10000 + " ops/ms; " + System.out.println(counter.get() / 10000 + " ops/ms; " +
threadCount + " thread(s); " + fileNamePrefix); threadCount + " thread(s); " + fileNamePrefix);
......
/*
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.synth; package org.h2.test.synth;
import org.h2.test.TestBase; import org.h2.test.TestBase;
......
...@@ -296,7 +296,8 @@ public class TestValue extends TestBase { ...@@ -296,7 +296,8 @@ public class TestValue extends TestBase {
assertTrue(valUUID.getString().equals(uuidStr)); assertTrue(valUUID.getString().equals(uuidStr));
assertTrue(valUUID.getObject().equals(origUUID)); assertTrue(valUUID.getObject().equals(origUUID));
ValueJavaObject voString = ValueJavaObject.getNoCopy(new String("This is not a ValueUuid object"), null, null); ValueJavaObject voString = ValueJavaObject.getNoCopy(
new String("This is not a ValueUuid object"), null, null);
assertThrows(DbException.class, voString).convertTo(Value.UUID); assertThrows(DbException.class, voString).convertTo(Value.UUID);
} }
......
...@@ -721,4 +721,11 @@ young younger youngest your yourself youtube ytd yuml yyfxyy yyyymmdd zeile zen ...@@ -721,4 +721,11 @@ young younger youngest your yourself youtube ytd yuml yyfxyy yyyymmdd zeile zen
zepfred zero zeroes zeros zeta zhang zip ziv zloty zone zones zurich zwj zwnj zepfred zero zeroes zeros zeta zhang zip ziv zloty zone zones zurich zwj zwnj
recompiled incl reveal designators templates invoked candidate handshake altered recompiled incl reveal designators templates invoked candidate handshake altered
accomplished permanent clarify weaken excl alternatively dita imjcc optimizes accomplished permanent clarify weaken excl alternatively dita imjcc optimizes
dotall multiline dotall multiline
\ No newline at end of file
stefan jobs defunct spain jconn decades chrono courtesy dtl xdg avp lifecycle
experiment throughout staging booth akkuzin observed maxinplace russian
ema sch bodewig forbid compat calc midway prohibit measuring playing kostya
pstmt rosenbaum pretending inverse safer lived blo sane othe multiplicative
introduces bcd nave picking templating clamp temporal berlin intermittently
pstat props
\ No newline at end of file
...@@ -660,7 +660,7 @@ public class ArchiveTool { ...@@ -660,7 +660,7 @@ public class ArchiveTool {
return key; return key;
} }
public static long getSipHash24(byte[] b, int start, int end, long k0, private static long getSipHash24(byte[] b, int start, int end, long k0,
long k1) { long k1) {
long v0 = k0 ^ 0x736f6d6570736575L; long v0 = k0 ^ 0x736f6d6570736575L;
long v1 = k1 ^ 0x646f72616e646f6dL; long v1 = k1 ^ 0x646f72616e646f6dL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论