Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c3befc2c
Unverified
提交
c3befc2c
authored
12月 22, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
12月 22, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1613 from katzyn/table
Add explicit table query
上级
4870e105
53fcecbf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
293 行增加
和
98 行删除
+293
-98
help.csv
h2/src/docsrc/help/help.csv
+32
-4
advanced.html
h2/src/docsrc/html/advanced.html
+2
-2
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+121
-58
Update.java
h2/src/main/org/h2/command/dml/Update.java
+1
-1
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+5
-5
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+5
-5
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+2
-2
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+8
-3
Data.java
h2/src/main/org/h2/store/Data.java
+7
-3
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+5
-5
Recover.java
h2/src/main/org/h2/tools/Recover.java
+2
-2
ParserUtil.java
h2/src/main/org/h2/util/ParserUtil.java
+9
-2
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+1
-1
table.sql
h2/src/test/org/h2/test/scripts/dml/table.sql
+55
-0
with.sql
h2/src/test/org/h2/test/scripts/dml/with.sql
+19
-1
table.sql
h2/src/test/org/h2/test/scripts/functions/system/table.sql
+15
-2
help.sql
h2/src/test/org/h2/test/scripts/other/help.sql
+2
-2
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
c3befc2c
...
...
@@ -238,6 +238,19 @@ Lists the schemas, tables, or the columns of a table.
SHOW TABLES
"
"Commands (DML)","Explicit TABLE","
TABLE [schemaName.]tableName
","
Selects data from a table.
This command is an equivalent to SELECT * FROM tableName.
FROM, WHERE, GROUP BY, HAVING, and WINDOW clauses from the SELECT command are not allowed.
","
TABLE TEST;
TABLE TEST ORDER BY ID FETCH FIRST ROW ONLY;
"
"Commands (DML)","WITH","
WITH [ RECURSIVE ] { name [( columnName [,...] )] AS ( select ) [,...] }
{ select | insert | update | merge | delete | createTable }
...
...
@@ -4538,9 +4551,10 @@ CURRENT_DATE
"
"Functions (Time and Date)","CURRENT_TIME","
{ CURRENT_TIME [ (int) ] | LOCALTIME [ (int) ] | CURTIME([ int ]) }
CURRENT_TIME [ (int) ]
","
Returns the current time.
The returned value does not have time zone information, because TIME WITH TIME ZONE data type is not supported in H2.
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
...
...
@@ -4549,8 +4563,7 @@ These methods always return the same value within a transaction (default)
or within a command depending on database mode.
","
CURRENT_TIME
LOCALTIME
LOCALTIME(9)
CURRENT_TIME(9)
"
"Functions (Time and Date)","CURRENT_TIMESTAMP","
...
...
@@ -4569,10 +4582,25 @@ CURRENT_TIMESTAMP
CURRENT_TIMESTAMP(9)
"
"Functions (Time and Date)","LOCALTIME","
{ LOCALTIME [ (int) ] | CURTIME([ int ]) }
","
Returns the current time.
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
Higher precision is not available before Java 9.
These methods always return the same value within a transaction (default)
or within a command depending on database mode.
","
LOCALTIME
LOCALTIME(9)
"
"Functions (Time and Date)","LOCALTIMESTAMP","
{ LOCALTIMESTAMP [ (int) ] | NOW( [ int ] ) }
","
Returns the current timestamp.
Returns the current timestamp
without time zone
.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
...
...
h2/src/docsrc/html/advanced.html
浏览文件 @
c3befc2c
...
...
@@ -481,8 +481,8 @@ EXISTS, FALSE, FETCH, FOR, FOREIGN, FROM, FULL, GROUP, HAVING,
IF, INNER, INTERSECT, INTERSECTS, INTERVAL, IS, JOIN, LIKE,
LIMIT, LOCALTIME, LOCALTIMESTAMP, MINUS, NATURAL, NOT, NULL,
OFFSET, ON, ORDER, PRIMARY, ROW, ROWNUM, SELECT, SYSDATE,
SYSTIME, SYSTIMESTAMP, T
ODAY, TOP, TRUE, UNION, UNIQUE, VALUES
,
WHERE, WINDOW, WITH
SYSTIME, SYSTIMESTAMP, T
ABLE, TODAY, TOP, TRUE, UNION, UNIQUE
,
VALUES,
WHERE, WINDOW, WITH
</code>
</p><p>
Certain words of this list are keywords because they are functions that can be used without '()',
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
c3befc2c
...
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
PR #1613: Add explicit table query
</li>
<li>
Issue #1608: ARRAY and row value expression should not be the same
</li>
<li>
Issue #1606: Quantified comparison predicate doesn't work correctly on primary key column
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
c3befc2c
差异被折叠。
点击展开。
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
c3befc2c
...
...
@@ -222,7 +222,7 @@ public class Update extends Prepared {
builder
.
append
(
",\n "
);
}
Column
c
=
columns
.
get
(
i
);
builder
.
append
(
c
.
get
Name
()).
append
(
" = "
);
builder
.
append
(
c
.
get
SQL
()).
append
(
" = "
);
expressionMap
.
get
(
c
).
getSQL
(
builder
);
}
if
(
condition
!=
null
)
{
...
...
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
c3befc2c
...
...
@@ -110,8 +110,8 @@ public class FullText {
stat
.
execute
(
"CREATE SCHEMA IF NOT EXISTS "
+
SCHEMA
);
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS "
+
SCHEMA
+
".INDEXES(ID INT AUTO_INCREMENT PRIMARY KEY, "
+
"SCHEMA VARCHAR,
TABLE
VARCHAR, COLUMNS VARCHAR, "
+
"UNIQUE(SCHEMA,
TABLE
))"
);
"SCHEMA VARCHAR,
\"TABLE\"
VARCHAR, COLUMNS VARCHAR, "
+
"UNIQUE(SCHEMA,
\"TABLE\"
))"
);
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS "
+
SCHEMA
+
".WORDS(ID INT AUTO_INCREMENT PRIMARY KEY, "
+
"NAME VARCHAR, UNIQUE(NAME))"
);
...
...
@@ -176,7 +176,7 @@ public class FullText {
String
table
,
String
columnList
)
throws
SQLException
{
init
(
conn
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO "
+
SCHEMA
+
".INDEXES(SCHEMA,
TABLE
, COLUMNS) VALUES(?, ?, ?)"
);
+
".INDEXES(SCHEMA,
\"TABLE\"
, COLUMNS) VALUES(?, ?, ?)"
);
prep
.
setString
(
1
,
schema
);
prep
.
setString
(
2
,
table
);
prep
.
setString
(
3
,
columnList
);
...
...
@@ -221,7 +221,7 @@ public class FullText {
throws
SQLException
{
init
(
conn
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT ID FROM "
+
SCHEMA
+
".INDEXES WHERE SCHEMA=? AND
TABLE
=?"
);
+
".INDEXES WHERE SCHEMA=? AND
\"TABLE\"
=?"
);
prep
.
setString
(
1
,
schema
);
prep
.
setString
(
2
,
table
);
ResultSet
rs
=
prep
.
executeQuery
();
...
...
@@ -929,7 +929,7 @@ public class FullText {
ArrayList
<
String
>
indexList
=
Utils
.
newSmallArrayList
();
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT ID, COLUMNS FROM "
+
SCHEMA
+
".INDEXES"
+
" WHERE SCHEMA=? AND
TABLE
=?"
);
" WHERE SCHEMA=? AND
\"TABLE\"
=?"
);
prep
.
setString
(
1
,
schemaName
);
prep
.
setString
(
2
,
tableName
);
rs
=
prep
.
executeQuery
();
...
...
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
c3befc2c
...
...
@@ -114,8 +114,8 @@ public class FullTextLucene extends FullText {
try
(
Statement
stat
=
conn
.
createStatement
())
{
stat
.
execute
(
"CREATE SCHEMA IF NOT EXISTS "
+
SCHEMA
);
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS "
+
SCHEMA
+
".INDEXES(SCHEMA VARCHAR,
TABLE
VARCHAR, "
+
"COLUMNS VARCHAR, PRIMARY KEY(SCHEMA,
TABLE
))"
);
".INDEXES(SCHEMA VARCHAR,
\"TABLE\"
VARCHAR, "
+
"COLUMNS VARCHAR, PRIMARY KEY(SCHEMA,
\"TABLE\"
))"
);
stat
.
execute
(
"CREATE ALIAS IF NOT EXISTS FTL_CREATE_INDEX FOR \""
+
FullTextLucene
.
class
.
getName
()
+
".createIndex\""
);
stat
.
execute
(
"CREATE ALIAS IF NOT EXISTS FTL_DROP_INDEX FOR \""
+
...
...
@@ -144,7 +144,7 @@ public class FullTextLucene extends FullText {
String
table
,
String
columnList
)
throws
SQLException
{
init
(
conn
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO "
+
SCHEMA
+
".INDEXES(SCHEMA,
TABLE
, COLUMNS) VALUES(?, ?, ?)"
);
+
".INDEXES(SCHEMA,
\"TABLE\"
, COLUMNS) VALUES(?, ?, ?)"
);
prep
.
setString
(
1
,
schema
);
prep
.
setString
(
2
,
table
);
prep
.
setString
(
3
,
columnList
);
...
...
@@ -166,7 +166,7 @@ public class FullTextLucene extends FullText {
init
(
conn
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"DELETE FROM "
+
SCHEMA
+
".INDEXES WHERE SCHEMA=? AND
TABLE
=?"
);
+
".INDEXES WHERE SCHEMA=? AND
\"TABLE\"
=?"
);
prep
.
setString
(
1
,
schema
);
prep
.
setString
(
2
,
table
);
int
rowCount
=
prep
.
executeUpdate
();
...
...
@@ -548,7 +548,7 @@ public class FullTextLucene extends FullText {
ArrayList
<
String
>
indexList
=
Utils
.
newSmallArrayList
();
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT COLUMNS FROM "
+
SCHEMA
+
".INDEXES WHERE SCHEMA=? AND
TABLE
=?"
);
+
".INDEXES WHERE SCHEMA=? AND
\"TABLE\"
=?"
);
prep
.
setString
(
1
,
schemaName
);
prep
.
setString
(
2
,
tableName
);
rs
=
prep
.
executeQuery
();
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
c3befc2c
...
...
@@ -1553,8 +1553,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements
* IF, INNER, INTERSECT, INTERSECTS, INTERVAL, IS, JOIN, LIKE,
* LIMIT, LOCALTIME, LOCALTIMESTAMP, MINUS, NATURAL, NOT, NULL,
* OFFSET, ON, ORDER, PRIMARY, ROW, ROWNUM, SELECT, SYSDATE,
* SYSTIME, SYSTIMESTAMP, T
ODAY, TOP, TRUE, UNION, UNIQUE, VALUES
,
* WHERE, WINDOW, WITH
* SYSTIME, SYSTIMESTAMP, T
ABLE, TODAY, TOP, TRUE, UNION, UNIQUE
,
*
VALUES,
WHERE, WINDOW, WITH
* </pre>
*
* @return a list of additional the keywords
...
...
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
c3befc2c
...
...
@@ -59,6 +59,10 @@ import org.h2.value.ValueUuid;
*/
public
class
ValueDataType
implements
DataType
{
/**
* Storage type for ValueRow.
*/
private
static
final
int
ROW
=
27
;
private
static
final
int
INT_0_15
=
32
;
private
static
final
int
LONG_0_7
=
48
;
private
static
final
int
DECIMAL_0_1
=
56
;
...
...
@@ -74,7 +78,6 @@ public class ValueDataType implements DataType {
private
static
final
int
BYTES_0_31
=
100
;
private
static
final
int
SPATIAL_KEY_2D
=
132
;
private
static
final
int
CUSTOM_DATA_TYPE
=
133
;
private
static
final
int
ROW
=
27
;
final
DataHandler
handler
;
final
CompareMode
compareMode
;
...
...
@@ -399,7 +402,8 @@ public class ValueDataType implements DataType {
case
Value
.
ARRAY
:
case
Value
.
ROW
:
{
Value
[]
list
=
((
ValueCollectionBase
)
v
).
getList
();
buff
.
put
((
byte
)
(
type
==
Value
.
ARRAY
?
Value
.
ARRAY
:
ROW
)).
putVarInt
(
list
.
length
);
buff
.
put
((
byte
)
(
type
==
Value
.
ARRAY
?
Value
.
ARRAY
:
/* Special storage type for ValueRow */
ROW
))
.
putVarInt
(
list
.
length
);
for
(
Value
x
:
list
)
{
writeValue
(
buff
,
x
);
}
...
...
@@ -615,7 +619,8 @@ public class ValueDataType implements DataType {
}
}
case
Value
.
ARRAY
:
case
ROW:
{
case
ROW:
// Special storage type for ValueRow
{
int
len
=
readVarInt
(
buff
);
Value
[]
list
=
new
Value
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
c3befc2c
...
...
@@ -75,6 +75,10 @@ public class Data {
*/
private
static
final
int
LENGTH_LONG
=
8
;
/**
* Storage type for ValueRow.
*/
private
static
final
int
ROW
=
27
;
private
static
final
int
INT_0_15
=
32
;
private
static
final
int
LONG_0_7
=
48
;
private
static
final
int
DECIMAL_0_1
=
56
;
...
...
@@ -92,7 +96,6 @@ public class Data {
private
static
final
int
LOCAL_DATE
=
133
;
private
static
final
int
LOCAL_TIMESTAMP
=
134
;
private
static
final
byte
CUSTOM_DATA_TYPE
=
(
byte
)
135
;
private
static
final
int
ROW
=
27
;
private
static
final
long
MILLIS_PER_MINUTE
=
1000
*
60
;
...
...
@@ -622,7 +625,7 @@ public class Data {
}
case
Value
.
ARRAY
:
case
Value
.
ROW
:
{
writeByte
((
byte
)
(
type
==
Value
.
ARRAY
?
Value
.
ARRAY
:
ROW
));
writeByte
((
byte
)
(
type
==
Value
.
ARRAY
?
Value
.
ARRAY
:
/* Special storage type for ValueRow */
ROW
));
Value
[]
list
=
((
ValueCollectionBase
)
v
).
getList
();
writeVarInt
(
list
.
length
);
for
(
Value
x
:
list
)
{
...
...
@@ -853,7 +856,8 @@ public class Data {
}
}
case
Value
.
ARRAY
:
case
ROW:
{
case
ROW:
// Special storage type for ValueRow
{
int
len
=
readVarInt
();
Value
[]
list
=
new
Value
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
c3befc2c
...
...
@@ -139,10 +139,10 @@ public class LobStorageBackend implements LobStorageInterface {
}
if
(
create
)
{
stat
.
execute
(
"CREATE CACHED TABLE IF NOT EXISTS "
+
LOBS
+
"(ID BIGINT PRIMARY KEY, BYTE_COUNT BIGINT,
TABLE
INT) HIDDEN"
);
"(ID BIGINT PRIMARY KEY, BYTE_COUNT BIGINT,
\"TABLE\"
INT) HIDDEN"
);
stat
.
execute
(
"CREATE INDEX IF NOT EXISTS "
+
"INFORMATION_SCHEMA.INDEX_LOB_TABLE ON "
+
LOBS
+
"(
TABLE
)"
);
LOBS
+
"(
\"TABLE\"
)"
);
stat
.
execute
(
"CREATE CACHED TABLE IF NOT EXISTS "
+
LOB_MAP
+
"(LOB BIGINT, SEQ INT, POS BIGINT, HASH INT, "
+
"BLOCK BIGINT, PRIMARY KEY(LOB, SEQ)) HIDDEN"
);
...
...
@@ -191,7 +191,7 @@ public class LobStorageBackend implements LobStorageInterface {
public
void
removeAllForTable
(
int
tableId
)
{
init
();
try
{
String
sql
=
"SELECT ID FROM "
+
LOBS
+
" WHERE
TABLE
= ?"
;
String
sql
=
"SELECT ID FROM "
+
LOBS
+
" WHERE
\"TABLE\"
= ?"
;
PreparedStatement
prep
=
prepare
(
sql
);
prep
.
setInt
(
1
,
tableId
);
ResultSet
rs
=
prep
.
executeQuery
();
...
...
@@ -414,7 +414,7 @@ public class LobStorageBackend implements LobStorageInterface {
synchronized
(
database
)
{
synchronized
(
conn
.
getSession
())
{
String
sql
=
"INSERT INTO "
+
LOBS
+
"(ID, BYTE_COUNT,
TABLE
) VALUES(?, ?, ?)"
;
"(ID, BYTE_COUNT,
\"TABLE\"
) VALUES(?, ?, ?)"
;
PreparedStatement
prep
=
prepare
(
sql
);
prep
.
setLong
(
1
,
lobId
);
prep
.
setLong
(
2
,
byteCount
);
...
...
@@ -456,7 +456,7 @@ public class LobStorageBackend implements LobStorageInterface {
reuse
(
sql
,
prep
);
sql
=
"INSERT INTO "
+
LOBS
+
"(ID, BYTE_COUNT,
TABLE
) "
+
"(ID, BYTE_COUNT,
\"TABLE\"
) "
+
"SELECT ?, BYTE_COUNT, ? FROM "
+
LOBS
+
" WHERE ID = ?"
;
prep
=
prepare
(
sql
);
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
c3befc2c
...
...
@@ -1568,7 +1568,7 @@ public class Recover extends Tool implements DataHandler {
writer
.
println
(
"DELETE FROM "
+
name
+
";"
);
writer
.
println
(
"INSERT INTO "
+
name
+
" SELECT * FROM "
+
storageName
+
";"
);
if
(
name
.
startsWith
(
"INFORMATION_SCHEMA.LOBS"
))
{
writer
.
println
(
"UPDATE "
+
name
+
" SET
TABLE
= "
+
writer
.
println
(
"UPDATE "
+
name
+
" SET
\"TABLE\"
= "
+
LobStorageFrontend
.
TABLE_TEMP
+
";"
);
deleteLobs
=
true
;
}
...
...
@@ -1595,7 +1595,7 @@ public class Recover extends Tool implements DataHandler {
writer
.
println
(
"DROP ALIAS READ_BLOB_DB;"
);
writer
.
println
(
"DROP ALIAS READ_CLOB_DB;"
);
if
(
deleteLobs
)
{
writer
.
println
(
"DELETE FROM INFORMATION_SCHEMA.LOBS WHERE
TABLE
= "
+
writer
.
println
(
"DELETE FROM INFORMATION_SCHEMA.LOBS WHERE
\"TABLE\"
= "
+
LobStorageFrontend
.
TABLE_TEMP
+
";"
);
}
for
(
MetaRecord
m
:
schema
)
{
...
...
h2/src/main/org/h2/util/ParserUtil.java
浏览文件 @
c3befc2c
...
...
@@ -232,10 +232,15 @@ public class ParserUtil {
*/
public
static
final
int
SELECT
=
ROWNUM
+
1
;
/**
* The token "TABLE".
*/
public
static
final
int
TABLE
=
SELECT
+
1
;
/**
* The token "TRUE".
*/
public
static
final
int
TRUE
=
SELECT
+
1
;
public
static
final
int
TRUE
=
TABLE
+
1
;
/**
* The token "UNION".
...
...
@@ -490,7 +495,9 @@ public class ParserUtil {
}
return
IDENTIFIER
;
case
'T'
:
if
(
eq
(
"TRUE"
,
s
,
ignoreCase
,
start
,
end
))
{
if
(
eq
(
"TABLE"
,
s
,
ignoreCase
,
start
,
end
))
{
return
TABLE
;
}
else
if
(
eq
(
"TRUE"
,
s
,
ignoreCase
,
start
,
end
))
{
return
TRUE
;
}
if
(
additionalKeywords
)
{
...
...
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
c3befc2c
...
...
@@ -155,7 +155,7 @@ public class TestScript extends TestDb {
testScript
(
"ddl/"
+
s
+
".sql"
);
}
for
(
String
s
:
new
String
[]
{
"delete"
,
"error_reporting"
,
"insertIgnore"
,
"merge"
,
"mergeUsing"
,
"replace"
,
"script"
,
"select"
,
"show"
,
"with"
})
{
"script"
,
"select"
,
"show"
,
"
table"
,
"
with"
})
{
testScript
(
"dml/"
+
s
+
".sql"
);
}
for
(
String
s
:
new
String
[]
{
"help"
})
{
...
...
h2/src/test/org/h2/test/scripts/dml/table.sql
0 → 100644
浏览文件 @
c3befc2c
-- 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
--
CREATE
TABLE
TEST
(
A
INT
,
B
INT
,
C
INT
);
>
ok
INSERT
INTO
TEST
VALUES
(
1
,
1
,
1
),
(
1
,
1
,
2
),
(
1
,
1
,
3
),
(
1
,
2
,
1
),
(
1
,
2
,
2
),
(
1
,
2
,
3
),
(
2
,
1
,
1
),
(
2
,
1
,
2
),
(
2
,
1
,
3
),
(
2
,
2
,
1
),
(
2
,
2
,
2
),
(
2
,
2
,
3
);
>
update
count
:
12
TABLE
TEST
ORDER
BY
A
,
B
;
>
A
B
C
>
-
-
-
>
1
1
1
>
1
1
2
>
1
1
3
>
1
2
1
>
1
2
2
>
1
2
3
>
2
1
1
>
2
1
2
>
2
1
3
>
2
2
1
>
2
2
2
>
2
2
3
>
rows
(
partially
ordered
):
12
TABLE
TEST
ORDER
BY
A
,
B
,
C
FETCH
FIRST
4
ROWS
ONLY
;
>
A
B
C
>
-
-
-
>
1
1
1
>
1
1
2
>
1
1
3
>
1
2
1
>
rows
(
ordered
):
4
SELECT
*
FROM
(
TABLE
TEST
)
ORDER
BY
A
,
B
,
C
FETCH
FIRST
ROW
ONLY
;
>
A
B
C
>
-
-
-
>
1
1
1
>
rows
(
ordered
):
1
SELECT
(
1
,
2
,
3
)
IN
(
TABLE
TEST
);
>>
TRUE
SELECT
(
TABLE
TEST
FETCH
FIRST
ROW
ONLY
)
"ROW"
;
>
ROW
>
-------------
>
ROW
(
1
,
1
,
1
)
>
rows
:
1
DROP
TABLE
TEST
;
>
ok
h2/src/test/org/h2/test/scripts/dml/with.sql
浏览文件 @
c3befc2c
...
...
@@ -129,4 +129,22 @@ WITH CTE_TEST AS (SELECT 1, 2) ((SELECT * FROM CTE_TEST));
>
1
2
>
-
-
>
1
2
>
rows
:
1
\ No newline at end of file
>
rows
:
1
CREATE
TABLE
TEST
(
A
INT
,
B
INT
)
AS
SELECT
1
,
2
;
>
ok
WITH
CTE_TEST
AS
(
TABLE
TEST
)
((
SELECT
*
FROM
CTE_TEST
));
>
A
B
>
-
-
>
1
2
>
rows
:
1
WITH
CTE_TEST
AS
(
TABLE
TEST
)
((
TABLE
CTE_TEST
));
>
A
B
>
-
-
>
1
2
>
rows
:
1
DROP
TABLE
TEST
;
>
ok
h2/src/test/org/h2/test/scripts/functions/system/table.sql
浏览文件 @
c3befc2c
...
...
@@ -31,11 +31,17 @@ SELECT * FROM (SELECT * FROM TEST) x ORDER BY id;
drop
table
test
;
>
ok
call
table
(
id
int
=
(
1
));
>
ID
>
--
>
1
>
rows
:
1
explain
select
*
from
table
(
id
int
=
(
1
,
2
),
name
varchar
=
(
'Hello'
,
'World'
));
>>
SELECT
TABLE
.
ID
,
TABLE
.
NAME
FROM
TABLE
(
ID
INT
=
ROW
(
1
,
2
),
NAME
VARCHAR
=
ROW
(
'Hello'
,
'World'
))
/* function */
>>
SELECT
"TABLE"
.
ID
,
"TABLE"
.
NAME
FROM
TABLE
(
ID
INT
=
ROW
(
1
,
2
),
NAME
VARCHAR
=
ROW
(
'Hello'
,
'World'
))
/* function */
explain
select
*
from
table
(
id
int
=
ARRAY
[
1
,
2
],
name
varchar
=
ARRAY
[
'Hello'
,
'World'
]);
>>
SELECT
TABLE
.
ID
,
TABLE
.
NAME
FROM
TABLE
(
ID
INT
=
ARRAY
[
1
,
2
],
NAME
VARCHAR
=
ARRAY
[
'Hello'
,
'World'
])
/* function */
>>
SELECT
"TABLE"
.
ID
,
"TABLE"
.
NAME
FROM
TABLE
(
ID
INT
=
ARRAY
[
1
,
2
],
NAME
VARCHAR
=
ARRAY
[
'Hello'
,
'World'
])
/* function */
select
*
from
table
(
id
int
=
(
1
,
2
),
name
varchar
=
(
'Hello'
,
'World'
))
x
order
by
id
;
>
ID
NAME
...
...
@@ -43,3 +49,10 @@ select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by i
>
1
Hello
>
2
World
>
rows
(
ordered
):
2
SELECT
*
FROM
(
TABLE
(
ID
INT
=
(
1
,
2
)));
>
ID
>
--
>
1
>
2
>
rows
:
2
h2/src/test/org/h2/test/scripts/other/help.sql
浏览文件 @
c3befc2c
...
...
@@ -16,11 +16,11 @@ HELP ABCDE EF_GH;
HELP
HELP
;
>
ID
SECTION
TOPIC
SYNTAX
TEXT
>
-- ---------------- ----- ----------------------- ----------------------------------------------------
>
6
5
Commands
(
Other
)
HELP
HELP
[
anything
[...]
]
Displays
the
help
pages
of
SQL
commands
or
keywords
.
>
6
6
Commands
(
Other
)
HELP
HELP
[
anything
[...]
]
Displays
the
help
pages
of
SQL
commands
or
keywords
.
>
rows
:
1
HELP
he
lp
;
>
ID
SECTION
TOPIC
SYNTAX
TEXT
>
-- ---------------- ----- ----------------------- ----------------------------------------------------
>
6
5
Commands
(
Other
)
HELP
HELP
[
anything
[...]
]
Displays
the
help
pages
of
SQL
commands
or
keywords
.
>
6
6
Commands
(
Other
)
HELP
HELP
[
anything
[...]
]
Displays
the
help
pages
of
SQL
commands
or
keywords
.
>
rows
:
1
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论