提交 6dea75e3 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Update documentation

上级 c81f6743
......@@ -10,10 +10,10 @@ FROM tableExpression [,...] [ WHERE expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ]
[ ORDER BY order [,...] ]
[ { { LIMIT expression [ OFFSET expression ] }
| { [ OFFSET expression { ROW | ROWS } ]
[ LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] ]
[ [ OFFSET expression { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
{ ONLY | WITH TIES } ] } } [ SAMPLE_SIZE rowCountInt ] ]
{ ONLY | WITH TIES } ] [ SAMPLE_SIZE rowCountInt ] ]
[ FOR UPDATE ]
","
Selects data from a table or multiple tables.
......@@ -2593,8 +2593,124 @@ A literal value of any date-time data type.
TIMESTAMP '1999-01-31 10:00:00'
"
"Other Grammar","INTERVAL YEAR","
INTERVAL [-|+] '[-|+]yearInt' YEAR
","
An INTERVAL YEAR literal.
","
INTERVAL '10' YEAR
"
"Other Grammar","INTERVAL MONTH","
INTERVAL [-|+] '[-|+]monthInt' MONTH
","
An INTERVAL MONTH literal.
","
INTERVAL '10' MONTH
"
"Other Grammar","INTERVAL DAY","
INTERVAL [-|+] '[-|+]dayInt' DAY
","
An INTERVAL DAY literal.
","
INTERVAL '10' DAY
"
"Other Grammar","INTERVAL HOUR","
INTERVAL [-|+] '[-|+]hourInt' HOUR
","
An INTERVAL HOUR literal.
","
INTERVAL '10' HOUR
"
"Other Grammar","INTERVAL MINUTE","
INTERVAL [-|+] '[-|+]minuteInt' MINUTE
","
An INTERVAL MINUTE literal.
","
INTERVAL '10' MINUTE
"
"Other Grammar","INTERVAL SECOND","
INTERVAL [-|+] '[-|+]secondInt[.nnnnnnnnn]' SECOND
","
An INTERVAL SECOND literal.
","
INTERVAL '10.123' SECOND
"
"Other Grammar","INTERVAL YEAR TO MONTH","
INTERVAL [-|+] '[-|+]yearInt-monthInt' YEAR TO MONTH
","
An INTERVAL YEAR TO MONTH literal.
","
INTERVAL '1-6' YEAR TO MONTH
"
"Other Grammar","INTERVAL DAY TO HOUR","
INTERVAL [-|+] '[-|+]dayInt hoursInt' DAY TO HOUR
","
An INTERVAL DAY TO HOUR literal.
","
INTERVAL '10 11' DAY TO *
"
"Other Grammar","INTERVAL DAY TO MINUTE","
INTERVAL [-|+] '[-|+]dayInt hh:mm' DAY TO MINUTE
","
An INTERVAL DAY TO MINUTE literal.
","
INTERVAL '10 11:12' DAY TO MINUTE
"
"Other Grammar","INTERVAL DAY TO SECOND","
INTERVAL [-|+] '[-|+]dayInt hh:mm:ss[.nnnnnnnnn]' DAY TO SECOND
","
An INTERVAL DAY TO SECOND literal.
","
INTERVAL '10 11:12:13.123' DAY TO SECOND
"
"Other Grammar","INTERVAL HOUR TO MINUTE","
INTERVAL [-|+] '[-|+]hh:mm' HOUR TO MINUTE
","
An INTERVAL HOUR TO MINUTE literal.
","
INTERVAL '10:11' HOUR TO MINUTE
"
"Other Grammar","INTERVAL HOUR TO SECOND","
INTERVAL [-|+] '[-|+]hh:mm:ss[.nnnnnnnnn]' HOUR TO SECOND
","
An INTERVAL HOUR TO SECOND literal.
","
INTERVAL '10:11:12.123' HOUR TO SECOND
"
"Other Grammar","INTERVAL MINUTE TO SECOND","
INTERVAL [-|+] '[-|+]mm:ss[.nnnnnnnnn]' MINUTE TO SECOND
","
An INTERVAL MINUTE TO SECOND literal.
","
INTERVAL '11:12.123' MINUTE TO SECOND
"
"Other Grammar","Interval","
intervalYear | intervalMonth | intervalDay | intervalHour | intervalMinute
| intervalSecond | intervalYearToMonth | intervalDayToHour
| intervalDayToMinute | intervalDayToSecond | intervalHourToMinute
| intervalHourToSecond | intervalMinuteToSecond
","
An interval literal.
","
INTERVAL '1-2' YEAR TO MONTH
"
"Other Grammar","Value","
string | dollarQuotedString | numeric | dateAndTime | boolean | bytes | array | null
string | dollarQuotedString | numeric | dateAndTime | boolean | bytes
| interval | array | null
","
A literal value of any data type, or null.
","
......@@ -2932,6 +3048,163 @@ and ""ResultSet.getObject(..)"" or ""ResultSet.getString(..)"" to retrieve the v
GEOMETRY
"
"Data Types","INTERVAL YEAR Type","
INTERVAL YEAR [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
","
INTERVAL YEAR
"
"Data Types","INTERVAL MONTH Type","
INTERVAL MONTH [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
","
INTERVAL MONTH
"
"Data Types","INTERVAL DAY Type","
INTERVAL DAY [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL DAY
"
"Data Types","INTERVAL HOUR Type","
INTERVAL HOUR [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL HOUR
"
"Data Types","INTERVAL MINUTE Type","
INTERVAL MINUTE [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL MINUTE
"
"Data Types","INTERVAL SECOND Type","
INTERVAL SECOND [ ( precisionInt [ , scaleInt ] ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision (scale) is specified it should be from 0 to 9, 6 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL SECOND
"
"Data Types","INTERVAL YEAR TO MONTH Type","
INTERVAL YEAR [ ( precisionInt ) ] TO MONTH
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
","
INTERVAL YEAR TO MONTH
"
"Data Types","INTERVAL DAY TO HOUR Type","
INTERVAL DAY [ ( precisionInt ) ] TO HOUR
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL DAY TO HOUR
"
"Data Types","INTERVAL DAY TO MINUTE Type","
INTERVAL DAY [ ( precisionInt ) ] TO MINUTE
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL DAY TO MINUTE
"
"Data Types","INTERVAL DAY TO SECOND Type","
INTERVAL DAY [ ( precisionInt ) ] TO SECOND [ ( scaleInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision (scale) is specified it should be from 0 to 9, 6 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL DAY TO SECOND
"
"Data Types","INTERVAL HOUR TO MINUTE Type","
INTERVAL HOUR [ ( precisionInt ) ] TO MINUTE
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL HOUR TO MINUTE
"
"Data Types","INTERVAL HOUR TO SECOND Type","
INTERVAL HOUR [ ( precisionInt ) ] TO SECOND [ ( scaleInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision (scale) is specified it should be from 0 to 9, 6 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL HOUR TO SECOND
"
"Data Types","INTERVAL MINUTE TO SECOND Type","
INTERVAL * [ ( precisionInt ) ] TO SECOND [ ( scaleInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision (scale) is specified it should be from 0 to 9, 6 is default.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported on Java 8 and later versions.
","
INTERVAL MINUTE TO SECOND
"
"Functions (Aggregate)","AVG","
AVG ( [ DISTINCT ] { numeric } ) [ FILTER ( WHERE expression ) ]
","
......@@ -4078,7 +4351,7 @@ DAY_OF_YEAR(CREATED)
"
"Functions (Time and Date)","EXTRACT","
EXTRACT ( datetimeField FROM dateAndTime )
EXTRACT ( datetimeField FROM { dateAndTime | interval })
","
Returns a value of the specific time unit from a date/time value.
This method returns a numeric value with EPOCH field and
......
......@@ -168,7 +168,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Feature matrix.
</li><li>Updatable result set on table without primary key or unique index.
</li><li>Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString')
</li><li>Support data type INTERVAL
</li><li>Support nested transactions (possibly using savepoints internally).
</li><li>Add a benchmark for bigger databases, and one for many users.
</li><li>Compression in the result set over TCP/IP.
......@@ -333,7 +332,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>MySQL compatibility: DatabaseMetaData.stores*() methods should return the same values. Test with SquirrelSQL.
</li><li>MS SQL Server compatibility: support DATEPART syntax.
</li><li>Sybase/DB2/Oracle compatibility: support out parameters in stored procedures - See http://code.google.com/p/h2database/issues/detail?id=83
</li><li>Support INTERVAL data type (see Oracle and others).
</li><li>Combine Server and Console tool (only keep Server).
</li><li>Store the Lucene index in the database itself.
</li><li>Oracle compatibility: support DECODE(x, ...).
......
......@@ -21,6 +21,8 @@ public final class Interval {
private final long remaining;
/**
* Creates a new interval.
*
* @param years
* years
* @return interval
......@@ -30,6 +32,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param months
* months
* @return interval
......@@ -39,6 +43,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param days
* days
* @return interval
......@@ -48,6 +54,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param hours
* hours
* @return interval
......@@ -57,6 +65,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param minutes
* minutes
* @return interval
......@@ -66,6 +76,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param nanos
* nanoseconds (including seconds)
* @return interval
......@@ -82,6 +94,8 @@ public final class Interval {
}
/**
* Creates a new interval.
*
* @param qualifier
* qualifier
* @param negative
......
......@@ -258,6 +258,8 @@ public class Bnf {
ArrayList<String> list = new ArrayList<>();
syntax = StringUtils.replaceAll(syntax, "yyyy-MM-dd", "@ymd@");
syntax = StringUtils.replaceAll(syntax, "hh:mm:ss", "@hms@");
syntax = StringUtils.replaceAll(syntax, "hh:mm", "@hms@");
syntax = StringUtils.replaceAll(syntax, "mm:ss", "@hms@");
syntax = StringUtils.replaceAll(syntax, "nnnnnnnnn", "@nanos@");
syntax = StringUtils.replaceAll(syntax, "function", "@func@");
syntax = StringUtils.replaceAll(syntax, "0x", "@hexStart@");
......
......@@ -354,7 +354,7 @@ public class SysProperties {
* unless {@code h2.preview} is enabled.
* <p>
* If {@code true} map {@code BigDecimal} to {@code DECIMAL} type.
* <p>
* </p>
* <p>
* If {@code false} map {@code BigDecimal} to {@code NUMERIC} as specified
* in JDBC specification (see Mapping from Java Object Types to JDBC Types).
......
......@@ -10,7 +10,6 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
......@@ -709,13 +708,14 @@ public class MVStore {
long blocksInStore = fileStore.size() / BLOCK_SIZE;
// this queue will hold potential candidates for lastChunk to fall back to
Queue<Chunk> lastChunkCandidates = new PriorityQueue<>(Math.max(32, (int)(blocksInStore / 4)), new Comparator<Chunk>() {
Queue<Chunk> lastChunkCandidates = new PriorityQueue<>(Math.max(32, (int)(blocksInStore / 4)),
new Comparator<Chunk>() {
@Override
public int compare(Chunk one, Chunk two) {
int result = Long.compare(two.version, one.version);
if (result == 0) {
// out of two versions of the same chunk we prefer the one
// close to the begining of file (presumably later version)
// close to the beginning of file (presumably later version)
result = Long.compare(one.block, two.block);
}
return result;
......@@ -772,7 +772,7 @@ public class MVStore {
continue;
}
// chunk reference is invalid
// this "last chunk" cadidate is not suitable
// this "last chunk" candidate is not suitable
// but we continue to process all references
// to find other potential candidates
verified = false;
......
......@@ -16,7 +16,6 @@ import org.h2.mvstore.Cursor;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.MVStore;
import org.h2.mvstore.Page;
import org.h2.mvstore.WriteBuffer;
import org.h2.mvstore.type.DataType;
import org.h2.mvstore.type.ObjectDataType;
......
......@@ -690,7 +690,8 @@ public final class DateTimeFunctions {
return DateTimeUtils.getSundayDayOfWeek(dateValue);
case WEEK:
GregorianCalendar gc = DateTimeUtils.getCalendar();
return DateTimeUtils.getWeekOfYear(dateValue, gc.getFirstDayOfWeek() - 1, gc.getMinimalDaysInFirstWeek());
return DateTimeUtils.getWeekOfYear(dateValue, gc.getFirstDayOfWeek() - 1,
gc.getMinimalDaysInFirstWeek());
case QUARTER:
return (DateTimeUtils.monthFromDateValue(dateValue) - 1) / 3 + 1;
case ISO_YEAR:
......
......@@ -2073,7 +2073,8 @@ public class DateTimeUtils {
* values of all remaining fields
* @return months, or 0
*/
public static long monthsFromInterval(IntervalQualifier qualifier, boolean negative, long leading, long remaining) {
public static long monthsFromInterval(IntervalQualifier qualifier, boolean negative, long leading, long remaining)
{
long v;
if (qualifier == IntervalQualifier.MONTH) {
v = leading;
......
......@@ -712,7 +712,8 @@ public class Transfer {
case Value.INTERVAL_DAY:
case Value.INTERVAL_HOUR:
case Value.INTERVAL_MINUTE:
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR), readBoolean(), readLong(), 0L);
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR), readBoolean(), readLong(),
0L);
case Value.INTERVAL_SECOND:
case Value.INTERVAL_YEAR_TO_MONTH:
case Value.INTERVAL_DAY_TO_HOUR:
......@@ -721,7 +722,8 @@ public class Transfer {
case Value.INTERVAL_HOUR_TO_MINUTE:
case Value.INTERVAL_HOUR_TO_SECOND:
case Value.INTERVAL_MINUTE_TO_SECOND:
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR), readBoolean(), readLong(), readLong());
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR), readBoolean(), readLong(),
readLong());
default:
if (JdbcUtils.customDataTypesHandler != null) {
return JdbcUtils.customDataTypesHandler.convert(
......
......@@ -1039,7 +1039,8 @@ public abstract class Value {
case STRING: {
String s;
if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) {
// Bugfix - Can't use the locale encoding when enabling charToBinaryInUtf8 in mode.
// Bugfix - Can't use the locale encoding when enabling
// charToBinaryInUtf8 in mode.
// The following two target types also are the same issue.
// @since 2018-07-19 little-pan
s = new String(getBytesNoCopy(), StandardCharsets.UTF_8);
......
/*
* Copyright 2004-2018 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.value;
import java.sql.PreparedStatement;
......
/*
* Copyright 2004-2018 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.db;
import org.h2.mvstore.cache.CacheLongKeyLIRS;
......
......@@ -342,7 +342,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
test.put(i, 10 * i);
}
verify(test, "mem: 4 stack: 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 " +
"cold: 19 non-resident: 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 0");
"cold: 19 non-resident: 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 0");
}
private void testLimitMemory() {
......
......@@ -787,3 +787,5 @@ retried helpers unclean missed parsers sax myclass suppose mandatory testxml mia
emptied titlecase ask snk dom xif transformer dbf stx stax xof descriptors
inconsistencies discover eliminated violates tweaks postpone leftovers
tied ties
launched unavailable smallmoney erroneously multiplier newid pan streamline unmap preview unexpectedly presumably
converging smth rng curs casts unmapping unmapper
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论