提交 144aec21 authored 作者: thomasmueller's avatar thomasmueller

Javadocs, formatting

上级 2e68b5c1
...@@ -171,7 +171,8 @@ import org.h2.value.ValueTimestampTimeZone; ...@@ -171,7 +171,8 @@ import org.h2.value.ValueTimestampTimeZone;
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888 * @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
*/ */
public class Parser { public class Parser {
public static final String WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS =
private static final String WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS =
"WITH statement supports only SELECT, CREATE TABLE, INSERT, UPDATE, MERGE or DELETE statements"; "WITH statement supports only SELECT, CREATE TABLE, INSERT, UPDATE, MERGE or DELETE statements";
// used during the tokenizer phase // used during the tokenizer phase
...@@ -1050,7 +1051,7 @@ public class Parser { ...@@ -1050,7 +1051,7 @@ public class Parser {
} }
} }
public static Prepared prepare(Session s, String sql, private static Prepared prepare(Session s, String sql,
ArrayList<Value> paramValues) { ArrayList<Value> paramValues) {
Prepared prep = s.prepare(sql); Prepared prep = s.prepare(sql);
ArrayList<Parameter> params = prep.getParameters(); ArrayList<Parameter> params = prep.getParameters();
......
...@@ -450,6 +450,8 @@ public abstract class Prepared { ...@@ -450,6 +450,8 @@ public abstract class Prepared {
/** /**
* Set the temporary views created for CTE's. * Set the temporary views created for CTE's.
*
* @param cteCleanups the temporary views
*/ */
public void setCteCleanups(List<TableView> cteCleanups) { public void setCteCleanups(List<TableView> cteCleanups) {
this.cteCleanups = cteCleanups; this.cteCleanups = cteCleanups;
......
...@@ -43,6 +43,7 @@ import java.util.HashSet; ...@@ -43,6 +43,7 @@ import java.util.HashSet;
* @author Joel Turkel (Group sorted query) * @author Joel Turkel (Group sorted query)
*/ */
public class Select extends Query { public class Select extends Query {
TableFilter topTableFilter; TableFilter topTableFilter;
private final ArrayList<TableFilter> filters = New.arrayList(); private final ArrayList<TableFilter> filters = New.arrayList();
private final ArrayList<TableFilter> topFilters = New.arrayList(); private final ArrayList<TableFilter> topFilters = New.arrayList();
......
...@@ -59,8 +59,17 @@ public class SelectUnion extends Query { ...@@ -59,8 +59,17 @@ public class SelectUnion extends Query {
public static final int INTERSECT = 3; public static final int INTERSECT = 3;
private int unionType; private int unionType;
/**
* The left hand side of the union (the first subquery).
*/
final Query left; final Query left;
/**
* The right hand side of the union (the second subquery).
*/
Query right; Query right;
private ArrayList<Expression> expressions; private ArrayList<Expression> expressions;
private Expression[] expressionArray; private Expression[] expressionArray;
private ArrayList<SelectOrderBy> orderList; private ArrayList<SelectOrderBy> orderList;
......
...@@ -723,6 +723,9 @@ public class FullTextLucene extends FullText { ...@@ -723,6 +723,9 @@ public class FullTextLucene extends FullText {
} }
} }
/**
* Commit the changes.
*/
public synchronized void commit() throws IOException { public synchronized void commit() throws IOException {
writer.commit(); writer.commit();
if (counter != 0) { if (counter != 0) {
......
...@@ -96,6 +96,11 @@ public class ColumnNamerConfiguration { ...@@ -96,6 +96,11 @@ public class ColumnNamerConfiguration {
this.compiledRegularExpressionMatchDisallowed = compiledRegularExpressionMatchDisallowed; this.compiledRegularExpressionMatchDisallowed = compiledRegularExpressionMatchDisallowed;
} }
/**
* Configure the column namer.
*
* @param stringValue the configuration
*/
public void configure(String stringValue) { public void configure(String stringValue) {
try { try {
if (stringValue.equalsIgnoreCase(DEFAULT_COMMAND)) { if (stringValue.equalsIgnoreCase(DEFAULT_COMMAND)) {
......
...@@ -198,6 +198,12 @@ public class SourceCompiler { ...@@ -198,6 +198,12 @@ public class SourceCompiler {
return isJavascriptSource(source) || isRubySource(source); return isJavascriptSource(source) || isRubySource(source);
} }
/**
* Get the compiled script.
*
* @param packageAndClassName the package and class name
* @return the compiled script
*/
public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException { public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException {
CompiledScript compiledScript = compiledScripts.get(packageAndClassName); CompiledScript compiledScript = compiledScripts.get(packageAndClassName);
if (compiledScript == null) { if (compiledScript == null) {
......
...@@ -82,6 +82,7 @@ public class ThreadDeadlockDetector { ...@@ -82,6 +82,7 @@ public class ThreadDeadlockDetector {
* Dump all deadlocks (if any). * Dump all deadlocks (if any).
* *
* @param msg the message * @param msg the message
* @param out the output
*/ */
public static void dumpAllThreadsAndLocks(String msg, PrintStream out) { public static void dumpAllThreadsAndLocks(String msg, PrintStream out) {
final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
......
...@@ -43,6 +43,12 @@ public class CharsetCollator extends Collator { ...@@ -43,6 +43,12 @@ public class CharsetCollator extends Collator {
return COMPARATOR.compare(toBytes(source), toBytes(target)); return COMPARATOR.compare(toBytes(source), toBytes(target));
} }
/**
* Convert the source to bytes, using the character set.
*
* @param source the source
* @return the bytes
*/
byte[] toBytes(String source) { byte[] toBytes(String source) {
return source.getBytes(charset); return source.getBytes(charset);
} }
......
...@@ -389,7 +389,7 @@ public class DataType { ...@@ -389,7 +389,7 @@ public class DataType {
} }
} }
static void addDecimal() { private static void addDecimal() {
add(Value.DECIMAL, Types.DECIMAL, "BigDecimal", add(Value.DECIMAL, Types.DECIMAL, "BigDecimal",
createDecimal(Integer.MAX_VALUE, createDecimal(Integer.MAX_VALUE,
ValueDecimal.DEFAULT_PRECISION, ValueDecimal.DEFAULT_PRECISION,
...@@ -401,7 +401,7 @@ public class DataType { ...@@ -401,7 +401,7 @@ public class DataType {
); );
} }
static void addNumeric() { private static void addNumeric() {
add(Value.DECIMAL, Types.NUMERIC, "BigDecimal", add(Value.DECIMAL, Types.NUMERIC, "BigDecimal",
createDecimal(Integer.MAX_VALUE, createDecimal(Integer.MAX_VALUE,
ValueDecimal.DEFAULT_PRECISION, ValueDecimal.DEFAULT_PRECISION,
......
...@@ -59,6 +59,7 @@ public class Transfer { ...@@ -59,6 +59,7 @@ public class Transfer {
* Create a new transfer object for the specified session. * Create a new transfer object for the specified session.
* *
* @param session the session * @param session the session
* @param s the socket
*/ */
public Transfer(SessionInterface session, Socket s) { public Transfer(SessionInterface session, Socket s) {
this.session = session; this.session = session;
......
...@@ -188,6 +188,13 @@ public abstract class Value { ...@@ -188,6 +188,13 @@ public abstract class Value {
private static final BigDecimal MIN_LONG_DECIMAL = private static final BigDecimal MIN_LONG_DECIMAL =
BigDecimal.valueOf(Long.MIN_VALUE); BigDecimal.valueOf(Long.MIN_VALUE);
/**
* Check the range of the parameters.
*
* @param zeroBasedOffset the offset (0 meaning no offset)
* @param length the length of the target
* @param dataSize the length of the source
*/
static void rangeCheck(long zeroBasedOffset, long length, long dataSize) { static void rangeCheck(long zeroBasedOffset, long length, long dataSize) {
if ((zeroBasedOffset | length) < 0 || length > dataSize - zeroBasedOffset) { if ((zeroBasedOffset | length) < 0 || length > dataSize - zeroBasedOffset) {
if (zeroBasedOffset < 0 || zeroBasedOffset > dataSize) { if (zeroBasedOffset < 0 || zeroBasedOffset > dataSize) {
...@@ -479,10 +486,17 @@ public abstract class Value { ...@@ -479,10 +486,17 @@ public abstract class Value {
return new ByteArrayInputStream(getBytesNoCopy()); return new ByteArrayInputStream(getBytesNoCopy());
} }
/**
* Get the input stream
* @param oneBasedOffset the offset (1 means no offset)
* @param length the requested length
* @return the new input stream
*/
public InputStream getInputStream(long oneBasedOffset, long length) { public InputStream getInputStream(long oneBasedOffset, long length) {
byte[] bytes = getBytesNoCopy(); byte[] bytes = getBytesNoCopy();
rangeCheck(--oneBasedOffset, length, bytes.length); long zeroBasedOffset = oneBasedOffset - 1;
return new ByteArrayInputStream(bytes, /* 0-based */ (int) oneBasedOffset, (int) length); rangeCheck(zeroBasedOffset, length, bytes.length);
return new ByteArrayInputStream(bytes, (int) zeroBasedOffset, (int) length);
} }
public Reader getReader() { public Reader getReader() {
...@@ -491,8 +505,9 @@ public abstract class Value { ...@@ -491,8 +505,9 @@ public abstract class Value {
public Reader getReader(long oneBasedOffset, long length) { public Reader getReader(long oneBasedOffset, long length) {
String string = getString(); String string = getString();
rangeCheck(--oneBasedOffset, length, string.length()); long zeroBasedOffset = oneBasedOffset - 1;
int offset = /* 0-based */ (int) oneBasedOffset; rangeCheck(zeroBasedOffset, length, string.length());
int offset = (int) zeroBasedOffset;
return new StringReader(string.substring(offset, offset + (int) length)); return new StringReader(string.substring(offset, offset + (int) length));
} }
...@@ -578,6 +593,7 @@ public abstract class Value { ...@@ -578,6 +593,7 @@ public abstract class Value {
* @param precision the precision of the column to convert this value to. * @param precision the precision of the column to convert this value to.
* The special constant <code>-1</code> is used to indicate that * The special constant <code>-1</code> is used to indicate that
* the precision plays no role when converting the value * the precision plays no role when converting the value
* @param mode the mode
* @return the converted value * @return the converted value
*/ */
public final Value convertTo(int targetType, int precision, Mode mode) { public final Value convertTo(int targetType, int precision, Mode mode) {
......
...@@ -59,6 +59,15 @@ public class ValueLob extends Value { ...@@ -59,6 +59,15 @@ public class ValueLob extends Value {
} }
} }
/**
* Create an input stream that is s subset of the given stream.
*
* @param inputStream the input stream
* @param oneBasedOffset the offset (1 means no offset)
* @param length the length of the result, in bytes
* @param dataSize the length of the input, in bytes
* @return the smaller input stream
*/
static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize) { static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize) {
if (dataSize > 0) if (dataSize > 0)
rangeCheck(oneBasedOffset - 1, length, dataSize); rangeCheck(oneBasedOffset - 1, length, dataSize);
......
...@@ -2476,7 +2476,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2476,7 +2476,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
/** /**
* This method is called via reflection from the database. * This method is called via reflection from the database.
* *
* @returns a fixed number * @return a fixed number
*/ */
public static long currentTimestampOverride() { public static long currentTimestampOverride() {
return 3141; return 3141;
......
...@@ -44,9 +44,14 @@ public class TestKillRestartMulti extends TestBase { ...@@ -44,9 +44,14 @@ public class TestKillRestartMulti extends TestBase {
/** /**
* This method is called when executing this application from the command
* line.
*
* Note that this entry can be used in two different ways, either * Note that this entry can be used in two different ways, either
* (a) running just this test * (a) running just this test
* (b) or when this test invokes itself in a child process * (b) or when this test invokes itself in a child process
*
* @param args the command line parameters
*/ */
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
if (args != null && args.length > 0) { if (args != null && args.length > 0) {
......
...@@ -759,3 +759,6 @@ contextual unknowns enquote respectively sessionid reconnection selfreferential ...@@ -759,3 +759,6 @@ contextual unknowns enquote respectively sessionid reconnection selfreferential
zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz readlimit retries cceecc reconnects zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz readlimit retries cceecc reconnects
unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir endian misleading precompiled unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir endian misleading precompiled
assorted reimplemented hangups confirmation predefined assorted reimplemented hangups confirmation predefined
mdy destfile hclf forbids spellchecking selfdestruct expects accident jacocoagent cli historic mitigate
jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt directions handled overly asm hardcoded
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论