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

Javadocs, formatting

上级 f4507bb3
......@@ -42,12 +42,12 @@ cd ../../h2-mvstore/1...
# for each file separately (-javadoc.jar, -sources.jar, .jar, .pom):
gpg -u "Thomas Mueller Graf <thomas.tom.mueller@gmail.com>" -ab h2-mvstore...
jar -cvf bundle.jar h2-*
# http://central.sonatype.org/pages/ossrh-guide.html
# http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html
# https://oss.sonatype.org/#welcome - Log In "t..."
# - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
# - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
# http://central.sonatype.org/pages/ossrh-guide.html
# http://central.sonatype.org/pages/manual-staging-bundle-creation-and-deployment.html
# https://oss.sonatype.org/#welcome - Log In "t..."
# - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
# - Staging Upload
# - Upload Mode: Artifact Bundle, Select Bundle to Upload... - /data/.../bundle.jar
# - Upload Bundle - Staging Repositories - select comh2database - Release - Confirm
......@@ -6,7 +6,8 @@
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 {
......
......@@ -309,9 +309,11 @@ public abstract class Prepared {
if (session.getTrace().isInfoEnabled() && startTimeNanos > 0) {
long deltaTimeNanos = System.nanoTime() - startTimeNanos;
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) {
long deltaTimeNanos = System.nanoTime() - startTimeNanos;
session.getDatabase().getQueryStatisticsData().
......
......@@ -104,7 +104,8 @@ public class CreateView extends SchemaCommand {
synchronized (sysSession) {
try {
if (view == null) {
Schema schema = session.getDatabase().getSchema(session.getCurrentSchemaName());
Schema schema = session.getDatabase().getSchema(
session.getCurrentSchemaName());
sysSession.setCurrentSchema(schema);
Column[] columnTemplates = null;
if (columnNames != null) {
......
......@@ -150,6 +150,9 @@ public class Mode {
*/
public boolean supportPoundSymbolForColumnNames;
/**
* Whether an empty list as in "NAME IN()" results in a syntax error.
*/
public boolean prohibitEmptyInPredicate;
private final String name;
......
......@@ -54,8 +54,8 @@ public class QueryStatisticsData {
* Update query statistics.
*
* @param sqlStatement the statement being executed
* @param executionTimeNanos the time in nanoseconds the query/update took to
* execute
* @param executionTimeNanos the time in nanoseconds the query/update took
* to execute
* @param rowCount the query or update row count
*/
public synchronized void update(String sqlStatement, long executionTimeNanos,
......
......@@ -2128,7 +2128,7 @@ public class Function extends Expression implements FunctionCall {
return hc;
}
public int makeRegexpFlags(String stringFlags) {
private static int makeRegexpFlags(String stringFlags) {
int flags = Pattern.UNICODE_CASE;
if (stringFlags != null) {
for (int i = 0; i < stringFlags.length(); ++i) {
......
......@@ -19,7 +19,7 @@ import org.h2.result.SearchRow;
* for multiple sequential batched lookups, moreover it can be reused for
* 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
*/
public interface IndexLookupBatch {
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -63,7 +63,8 @@ import org.h2.value.ValueString;
* connection should only be used in one thread at any time.
* </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 PREFIX_SERVER = "server";
......@@ -1892,8 +1893,8 @@ public class JdbcConnection extends TraceObject implements Connection, JdbcConne
}
/**
* Sets the given schema name to access. Current implementation is case sensitive,
* i.e. requires schema name to be passed in correct case.
* Sets the given schema name to access. Current implementation is case
* sensitive, i.e. requires schema name to be passed in correct case.
*
* @param schema the schema name
*/
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -3708,6 +3708,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
*
* @param columnIndex the column index (1, 2, ...)
* @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
* closed
*/
......@@ -3731,6 +3732,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
*
* @param columnName the column name
* @param type the class of the returned value
* @return the value
*/
@Override
public <T> T getObject(String columnName, Class<T> type) throws SQLException {
......@@ -3789,7 +3791,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
} else if (LocalDateTimeUtils.isLocalDateTime(type)) {
return type.cast(LocalDateTimeUtils.valueToLocalDateTime(
(ValueTimestamp) value));
} else if (LocalDateTimeUtils.isOffsetDateTime(type) && value instanceof ValueTimestampTimeZone) {
} else if (LocalDateTimeUtils.isOffsetDateTime(type) &&
value instanceof ValueTimestampTimeZone) {
return type.cast(LocalDateTimeUtils.valueToOffsetDateTime(
(ValueTimestampTimeZone) value));
} else {
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -59,7 +59,8 @@ import org.h2.util.New;
* (<a href="http://www.source-code.biz">www.source-code.biz</a>)
* @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_MAX_CONNECTIONS = 10;
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -60,7 +60,8 @@ import org.h2.util.StringUtils;
* well; this may be a security problem in some cases.
*/
public class JdbcDataSource extends TraceObject implements XADataSource,
DataSource, ConnectionPoolDataSource, Serializable, Referenceable, JdbcDataSourceBackwardsCompat {
DataSource, ConnectionPoolDataSource, Serializable, Referenceable,
JdbcDataSourceBackwardsCompat {
private static final long serialVersionUID = 1288136338451857771L;
......
......@@ -6,7 +6,8 @@
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 {
......
......@@ -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
* @return this
......
......@@ -333,7 +333,8 @@ public class MVStoreTool {
*
* @param fileName the name of the file
* @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) {
PrintWriter pw = new PrintWriter(writer, true);
......@@ -544,7 +545,8 @@ public class MVStoreTool {
}
};
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();
version = rollback(fileName, version, new PrintWriter(ignore));
try {
......@@ -569,7 +571,9 @@ public class MVStoreTool {
* Roll back to a given revision into a a file called *.temp.
*
* @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)
*/
public static long rollback(String fileName, long targetVersion, Writer writer) {
......
......@@ -18,6 +18,9 @@ import org.h2.store.fs.FilePathWrapper;
*/
public class FilePathCache extends FilePathWrapper {
/**
* The instance.
*/
public static final FilePathCache INSTANCE = new FilePathCache();
/**
......
......@@ -663,7 +663,8 @@ public class PgServerThread implements Runnable {
sendMessage();
}
private void sendParameterDescription(ParameterMetaData meta, int[] paramTypes) throws Exception {
private void sendParameterDescription(ParameterMetaData meta,
int[] paramTypes) throws Exception {
int count = meta.getParameterCount();
startMessage('t');
writeShort(count);
......
......@@ -15,7 +15,8 @@ import java.nio.charset.CodingErrorAction;
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 {
......
......@@ -555,7 +555,6 @@ class FileNioMemData {
/**
* Compress the data in a byte array.
*
* @param data the page array
* @param page which page to compress
*/
void compress(int page) {
......
......@@ -15,6 +15,7 @@ import org.h2.command.dml.Query;
import org.h2.command.dml.Select;
import org.h2.command.dml.SelectUnion;
import org.h2.index.Cursor;
import org.h2.index.Index;
import org.h2.index.IndexCursor;
import org.h2.index.IndexLookupBatch;
import org.h2.index.ViewCursor;
......@@ -32,7 +33,7 @@ import org.h2.value.ValueLong;
/**
* 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
* @author Sergi Vladykin
*/
......
......@@ -54,7 +54,8 @@ import org.h2.value.DataType;
* </pre>
*
*/
public class SimpleResultSet implements ResultSet, ResultSetMetaData, JdbcResultSetBackwardsCompat {
public class SimpleResultSet implements ResultSet, ResultSetMetaData,
JdbcResultSetBackwardsCompat {
private ArrayList<Object[]> rows;
private Object[] currentRow;
......
......@@ -62,7 +62,8 @@ public class DateTimeUtils {
/**
* 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
......
/*
* Copyright 2016 H2 Group. Multiple-Licensed under the MPL 2.0, and the
* EPL 1.0 (http://h2database.com/html/license.html). Initial Developer: H2
* Group Iso8601: Initial Developer: Philippe Marschall (firstName dot lastName
* 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
* Iso8601: Initial Developer: Philippe Marschall (firstName dot lastName
* at gmail dot com)
*/
package org.h2.util;
......@@ -9,7 +10,6 @@ package org.h2.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Date;
import java.sql.SQLException;
import java.sql.Time;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
......@@ -150,8 +150,10 @@ public class LocalDateTimeUtils {
DATE_VALUE_OF = getMethod(java.sql.Date.class, "valueOf", LOCAL_DATE);
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_PARSE = getMethod(LOCAL_DATE, "parse", CharSequence.class);
LOCAL_DATE_OF_YEAR_MONTH_DAY = getMethod(LOCAL_DATE, "of",
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_MONTH_VALUE = getMethod(LOCAL_DATE, "getMonthValue");
LOCAL_DATE_GET_DAY_OF_MONTH = getMethod(LOCAL_DATE, "getDayOfMonth");
......@@ -168,7 +170,8 @@ public class LocalDateTimeUtils {
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_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);
ZONE_OFFSET_GET_TOTAL_SECONDS = getMethod(ZONE_OFFSET, "getTotalSeconds");
......@@ -293,16 +296,19 @@ public class LocalDateTimeUtils {
try {
return Class.forName(className);
} 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 {
return clazz.getMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Java 8 or later but method "
+ clazz.getName() + "#" + methodName + "(" + Arrays.toString(parameterTypes) + ") is missing", e);
throw new IllegalStateException("Java 8 or later but method " +
clazz.getName() + "#" + methodName + "(" +
Arrays.toString(parameterTypes) + ") is missing", e);
}
}
......@@ -310,8 +316,8 @@ public class LocalDateTimeUtils {
try {
return clazz.getField(fieldName).get(null);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new IllegalStateException("Java 8 or later but field " + clazz.getName()
+ "#" + fieldName + " is missing", e);
throw new IllegalStateException("Java 8 or later but field " +
clazz.getName() + "#" + fieldName + " is missing", e);
}
}
......@@ -371,8 +377,7 @@ public class LocalDateTimeUtils {
* @param value the value to convert
* @return the LocalDate
*/
public static Object valueToLocalDate(Value value)
throws SQLException {
public static Object valueToLocalDate(Value value) {
return dateToLocalDate(value.getDate());
}
......@@ -384,13 +389,11 @@ public class LocalDateTimeUtils {
* @param value the value to convert
* @return the LocalTime
*/
public static Object valueToLocalTime(Value value)
throws SQLException {
public static Object valueToLocalTime(Value value) {
return timeToLocalTime(value.getTime());
}
private static Object dateToLocalDate(Date date)
throws SQLException {
private static Object dateToLocalDate(Date date) {
try {
return TO_LOCAL_DATE.invoke(date);
} catch (IllegalAccessException e) {
......@@ -400,8 +403,7 @@ public class LocalDateTimeUtils {
}
}
private static Object timeToLocalTime(Time time)
throws SQLException {
private static Object timeToLocalTime(Time time) {
try {
return TO_LOCAL_TIME.invoke(time);
} catch (IllegalAccessException e) {
......@@ -419,8 +421,7 @@ public class LocalDateTimeUtils {
* @param value the value to convert
* @return the LocalDateTime
*/
public static Object valueToLocalDateTime(ValueTimestamp value)
throws SQLException {
public static Object valueToLocalDateTime(ValueTimestamp value) {
long dateValue = value.getDateValue();
long timeNanos = value.getTimeNanos();
......@@ -443,13 +444,12 @@ public class LocalDateTimeUtils {
* @param value the value to convert
* @return the OffsetDateTime
*/
public static Object valueToOffsetDateTime(ValueTimestampTimeZone value)
throws SQLException {
public static Object valueToOffsetDateTime(ValueTimestampTimeZone value) {
return timestampWithTimeZoneToOffsetDateTime((TimestampWithTimeZone) value.getObject());
}
private static Object timestampWithTimeZoneToOffsetDateTime(TimestampWithTimeZone timestampWithTimeZone)
throws SQLException {
private static Object timestampWithTimeZoneToOffsetDateTime(
TimestampWithTimeZone timestampWithTimeZone) {
long dateValue = timestampWithTimeZone.getYMD();
long timeNanos = timestampWithTimeZone.getNanosSinceMidnight();
......@@ -461,7 +461,8 @@ public class LocalDateTimeUtils {
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) {
throw DbException.convert(e);
} catch (InvocationTargetException e) {
......@@ -531,13 +532,14 @@ public class LocalDateTimeUtils {
public static Value offsetDateTimeToValue(Object offsetDateTime) {
try {
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);
long dateValue = dateValueFromLocalDate(localDate);
long timeNanos = timeNanosFromLocalDate(localDateTime);
short timeZoneOffsetMins = zoneOffsetToOffsetMinute(zoneOffset);
return ValueTimestampTimeZone.fromDateValueAndNanos(dateValue, timeNanos, timeZoneOffsetMins);
return ValueTimestampTimeZone.fromDateValueAndNanos(dateValue,
timeNanos, timeZoneOffsetMins);
} catch (IllegalAccessException e) {
throw DbException.convert(e);
} catch (InvocationTargetException e) {
......
......@@ -9,7 +9,8 @@ import java.util.concurrent.ConcurrentHashMap;
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
*/
......
......@@ -860,10 +860,12 @@ public abstract class Value {
case BYTES:
return ValueUuid.get(getBytesNoCopy());
case JAVA_OBJECT:
Object object = JdbcUtils.deserialize(getBytesNoCopy(), getDataHandler());
Object object = JdbcUtils.deserialize(getBytesNoCopy(),
getDataHandler());
if (object instanceof java.util.UUID) {
java.util.UUID uuid = (java.util.UUID) object;
return ValueUuid.get(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
return ValueUuid.get(uuid.getMostSignificantBits(),
uuid.getLeastSignificantBits());
} else {
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, getString());
}
......
......@@ -290,17 +290,21 @@ public class ValueTimestampTimeZone extends Value {
@Override
protected int compareSecure(Value o, CompareMode mode) {
ValueTimestampTimeZone t = (ValueTimestampTimeZone) o;
// We are pretending that the dateValue is in UTC because that gives us a stable sort
// even if the DST database changes.
// We are pretending that the dateValue is in UTC because that gives us
// a stable sort even if the DST database changes.
// 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);
a += ma;
a -= timeZoneOffsetMins;
// 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);
b += mb;
b -= t.timeZoneOffsetMins;
......
......@@ -246,9 +246,11 @@ public class TestDuplicateKeyUpdate extends TestBase {
private void testPrimaryKeyAndUniqueKey(Connection conn) throws SQLException
{
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 (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
ResultSet rs = stat.executeQuery("SELECT counter FROM test ORDER BY id");
......
......@@ -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");
Date before = new Date();
......@@ -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");
Connection conn = getConnection("functions");
conn.setAutoCommit(false);
......@@ -2054,7 +2056,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals(first, second);
}
private void testThatCurrentTimestampUpdatesOutsideATransaction() throws SQLException, InterruptedException {
private void testThatCurrentTimestampUpdatesOutsideATransaction()
throws SQLException, InterruptedException {
deleteDb("functions");
Connection conn = getConnection("functions");
conn.setAutoCommit(true);
......
......@@ -111,7 +111,8 @@ public class TestListener extends TestBase implements DatabaseEventListener {
return;
}
try (Connection conn = DriverManager.getConnection(databaseUrl, getUser(), getPassword())) {
try (Connection conn = DriverManager.getConnection(databaseUrl,
getUser(), getPassword())) {
conn.createStatement().execute("DROP TABLE TEST2");
conn.close();
} catch (SQLException e) {
......@@ -130,7 +131,8 @@ public class TestListener extends TestBase implements DatabaseEventListener {
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.close();
} catch (SQLException e) {
......
......@@ -1505,7 +1505,10 @@ public class TestLob extends TestBase {
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 {
deleteDb("lob");
JdbcConnection conn = (JdbcConnection) getConnection("lob");
......
......@@ -307,7 +307,8 @@ public class TestMultiThread extends TestBase implements Runnable {
stat.execute("CREATE VIEW INVOICE_VIEW as SELECT * FROM INVOICE");
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(
"CREATE VIEW INVOICE_DETAIL_VIEW as SELECT * FROM INVOICE_DETAIL");
......@@ -331,7 +332,8 @@ public class TestMultiThread extends TestBase implements Runnable {
// NullPointerException
stat2.execute("CREATE VIEW INVOICE_DETAIL_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'");
ResultSet rs = stat2
......
......@@ -1023,7 +1023,7 @@ public class TestSpatial extends TestBase {
deleteDb("spatial");
}
public void testIndexUpdateNullGeometry() throws SQLException {
private void testIndexUpdateNullGeometry() throws SQLException {
deleteDb("spatial");
Connection conn = getConnection(URL);
Statement stat = conn.createStatement();
......@@ -1061,7 +1061,7 @@ public class TestSpatial extends TestBase {
deleteDb("spatial");
}
public void testInsertNull() throws SQLException {
private void testInsertNull() throws SQLException {
deleteDb("spatial");
Connection conn = getConnection(URL);
Statement stat = conn.createStatement();
......
......@@ -225,7 +225,8 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
}
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();
assertEquals(1, count);
......@@ -340,7 +341,8 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
public void init(Connection conn, String schemaName,
String triggerName, String tableName, boolean before, int type)
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
......
......@@ -642,7 +642,8 @@ public class TestPreparedStatement extends TestBase {
return;
}
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);
ResultSet rs = prep.executeQuery();
rs.next();
......
......@@ -1124,7 +1124,8 @@ public class TestResultSet extends TestBase {
}
if (LocalDateTimeUtils.isJava8DateApiPresent()) {
assertEquals("2007-08-09T10:11:12.141516171",
rs.getObject(3, LocalDateTimeUtils.getLocalDateTimeClass()).toString());
rs.getObject(3, LocalDateTimeUtils.getLocalDateTimeClass())
.toString());
}
stat.execute("DROP TABLE TEST");
......
......@@ -70,7 +70,8 @@ public class TestBenchmark extends TestBase {
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);
final MVStore store = new MVStore.Builder().cacheSize(256).
cacheConcurrency(concurrency).
......@@ -112,7 +113,8 @@ public class TestBenchmark extends TestBase {
t.get();
}
// 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);
trace(msg);
store.close();
......
......@@ -89,7 +89,6 @@ public class TestMVStoreCachePerformance extends TestBase {
for (Task t : tasks) {
t.get();
}
// System.out.println(System.currentTimeMillis() - time + " ms to stop");
store.close();
System.out.println(counter.get() / 10000 + " ops/ms; " +
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;
import org.h2.test.TestBase;
......
......@@ -296,7 +296,8 @@ public class TestValue extends TestBase {
assertTrue(valUUID.getString().equals(uuidStr));
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);
}
......
......@@ -722,3 +722,10 @@ zepfred zero zeroes zeros zeta zhang zip ziv zloty zone zones zurich zwj zwnj
recompiled incl reveal designators templates invoked candidate handshake altered
accomplished permanent clarify weaken excl alternatively dita imjcc optimizes
dotall multiline
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 {
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 v0 = k0 ^ 0x736f6d6570736575L;
long v1 = k1 ^ 0x646f72616e646f6dL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论