Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fb598f3f
提交
fb598f3f
authored
4月 29, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
a2b139df
全部展开
显示空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
305 行增加
和
461 行删除
+305
-461
download.html
h2/src/docsrc/html/download.html
+3
-3
history.html
h2/src/docsrc/html/history.html
+49
-237
Parser.java
h2/src/main/org/h2/command/Parser.java
+3
-3
AlterTableAddConstraint.java
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
+1
-1
Query.java
h2/src/main/org/h2/command/dml/Query.java
+2
-0
Select.java
h2/src/main/org/h2/command/dml/Select.java
+14
-0
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+5
-0
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+8
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
Engine.java
h2/src/main/org/h2/engine/Engine.java
+9
-2
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+4
-0
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+6
-3
Subquery.java
h2/src/main/org/h2/expression/Subquery.java
+2
-2
AppServer.java
h2/src/main/org/h2/server/web/AppServer.java
+2
-0
query.jsp
h2/src/main/org/h2/server/web/res/query.jsp
+2
-0
Column.java
h2/src/main/org/h2/table/Column.java
+1
-1
ColumnResolver.java
h2/src/main/org/h2/table/ColumnResolver.java
+2
-0
SingleColumnResolver.java
h2/src/main/org/h2/table/SingleColumnResolver.java
+5
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+8
-1
Script.java
h2/src/main/org/h2/tools/Script.java
+3
-3
Server.java
h2/src/main/org/h2/tools/Server.java
+2
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+83
-199
TestWithRecursive.java
h2/src/test/org/h2/test/cases/TestWithRecursive.java
+50
-0
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+7
-0
TestHaltApp.java
h2/src/test/org/h2/test/synth/TestHaltApp.java
+6
-1
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+25
-0
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+2
-2
没有找到文件。
h2/src/docsrc/html/download.html
浏览文件 @
fb598f3f
...
...
@@ -17,10 +17,10 @@ H2 Database Engine
<a
href=
"http://www.h2database.com/h2-2007-04-20.zip"
>
Platform-Independent Zip (3.6 MB)
</a><br
/>
</p>
<h3>
Version 1.0 / 200
6-08-31
(Last Stable)
</h3>
<h3>
Version 1.0 / 200
7-04-20
(Last Stable)
</h3>
<p>
<a
href=
"http://www.h2database.com/h2-setup-200
6-08-31.exe"
>
Windows Installer (2.4
MB)
</a><br
/>
<a
href=
"http://www.h2database.com/h2-200
6-08-31.zip"
>
Platform-Independent Zip (3.1
MB)
</a><br
/>
<a
href=
"http://www.h2database.com/h2-setup-200
7-04-20.exe"
>
Windows Installer (2.7
MB)
</a><br
/>
<a
href=
"http://www.h2database.com/h2-200
7-04-20.zip"
>
Platform-Independent Zip (3.6
MB)
</a><br
/>
</p>
<p>
...
...
h2/src/docsrc/html/history.html
浏览文件 @
fb598f3f
差异被折叠。
点击展开。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
fb598f3f
...
...
@@ -580,7 +580,7 @@ public class Parser {
alias
=
readAliasIdentifier
();
}
}
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
alias
,
rightsChecked
);
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
alias
,
rightsChecked
,
currentSelect
);
return
filter
;
}
...
...
@@ -775,7 +775,7 @@ public class Parser {
alias
=
readAliasIdentifier
();
}
}
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
alias
,
rightsChecked
);
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
alias
,
rightsChecked
,
currentSelect
);
return
filter
;
}
...
...
@@ -1297,7 +1297,7 @@ public class Parser {
// select without FROM: convert to SELECT ... FROM SYSTEM_RANGE(1,1)
Schema
main
=
database
.
findSchema
(
Constants
.
SCHEMA_MAIN
);
Table
dual
=
new
RangeTable
(
main
,
1
,
1
);
TableFilter
filter
=
new
TableFilter
(
session
,
dual
,
null
,
rightsChecked
);
TableFilter
filter
=
new
TableFilter
(
session
,
dual
,
null
,
rightsChecked
,
currentSelect
);
command
.
addTableFilter
(
filter
,
true
);
}
else
{
parseSelectSimpleFromPart
(
command
);
...
...
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
浏览文件 @
fb598f3f
...
...
@@ -74,7 +74,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
int
id
=
getObjectId
(
true
,
true
);
String
name
=
generateConstraintName
(
id
);
ConstraintCheck
check
=
new
ConstraintCheck
(
getSchema
(),
id
,
name
,
table
);
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
null
,
false
);
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
null
,
false
,
null
);
checkExpression
.
mapColumns
(
filter
,
0
);
checkExpression
=
checkExpression
.
optimize
(
session
);
check
.
setExpression
(
checkExpression
);
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
fb598f3f
...
...
@@ -216,4 +216,6 @@ public abstract class Query extends Prepared {
return
isEverything
(
visitor
);
}
public
abstract
void
updateAggregate
(
Session
session
)
throws
SQLException
;
}
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
fb598f3f
...
...
@@ -680,6 +680,20 @@ public class Select extends Query {
}
}
public
void
updateAggregate
(
Session
session
)
throws
SQLException
{
for
(
int
i
=
0
;
i
<
expressions
.
size
();
i
++)
{
Expression
e
=
(
Expression
)
expressions
.
get
(
i
);
e
.
updateAggregate
(
session
);
}
if
(
condition
!=
null
)
{
condition
.
updateAggregate
(
session
);
}
if
(
having
!=
null
)
{
having
.
updateAggregate
(
session
);
}
}
public
boolean
isEverything
(
ExpressionVisitor
visitor
)
{
if
(
visitor
.
type
==
ExpressionVisitor
.
SET_MAX_DATA_MODIFICATION_ID
)
{
for
(
int
i
=
0
;
i
<
filters
.
size
();
i
++)
{
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
fb598f3f
...
...
@@ -309,4 +309,9 @@ public class SelectUnion extends Query {
public
Query
getRightQuery
()
{
return
right
;
}
public
void
updateAggregate
(
Session
session
)
throws
SQLException
{
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
}
}
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
fb598f3f
...
...
@@ -32,6 +32,7 @@ public class ConnectionInfo {
private
boolean
remote
;
private
boolean
ssl
;
private
boolean
persistent
;
private
boolean
unnamed
;
static
{
ObjectArray
list
=
SetTypes
.
getSettings
();
...
...
@@ -84,6 +85,9 @@ public class ConnectionInfo {
name
=
name
.
substring
(
"ssl:"
.
length
());
}
else
if
(
name
.
startsWith
(
"mem:"
))
{
persistent
=
false
;
if
(
name
.
equals
(
"mem:"
))
{
unnamed
=
true
;
}
}
else
if
(
name
.
startsWith
(
"file:"
))
{
name
=
name
.
substring
(
"file:"
.
length
());
persistent
=
true
;
...
...
@@ -119,6 +123,10 @@ public class ConnectionInfo {
return
persistent
;
}
public
boolean
isUnnamed
()
{
return
unnamed
;
}
private
void
readProperties
(
Properties
info
)
throws
SQLException
{
Object
[]
list
=
new
Object
[
info
.
size
()];
info
.
keySet
().
toArray
(
list
);
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
fb598f3f
...
...
@@ -293,7 +293,7 @@ public class Database implements DataHandler {
public
FileStore
openFile
(
String
name
,
boolean
mustExist
)
throws
SQLException
{
if
(
mustExist
&&
!
FileUtils
.
exists
(
name
))
{
throw
Message
.
getSQLException
(
Message
.
FILE_
CORRUPTE
D_1
,
name
);
throw
Message
.
getSQLException
(
Message
.
FILE_
NOT_FOUN
D_1
,
name
);
}
FileStore
store
=
FileStore
.
open
(
this
,
name
,
getMagic
(),
cipher
,
filePasswordHash
);
try
{
...
...
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
fb598f3f
...
...
@@ -34,7 +34,12 @@ public class Engine {
private
Session
openSession
(
ConnectionInfo
ci
,
boolean
ifExists
,
String
cipher
)
throws
SQLException
{
// may not remove properties here, otherwise they are lost if it is required to call it twice
String
name
=
ci
.
getName
();
Database
database
=
(
Database
)
databases
.
get
(
name
);
Database
database
;
if
(
ci
.
isUnnamed
())
{
database
=
null
;
}
else
{
database
=
(
Database
)
databases
.
get
(
name
);
}
User
user
=
null
;
boolean
opened
=
false
;
if
(
database
==
null
)
{
...
...
@@ -50,8 +55,10 @@ public class Engine {
user
.
setUserPasswordHash
(
ci
.
getUserPasswordHash
());
database
.
setMasterUser
(
user
);
}
if
(!
ci
.
isUnnamed
())
{
databases
.
put
(
name
,
database
);
}
}
synchronized
(
database
)
{
if
(
database
.
isClosing
())
{
return
null
;
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
fb598f3f
...
...
@@ -119,6 +119,10 @@ public class Aggregate extends Expression {
// on.updateAggregate();
// }
HashMap
group
=
select
.
getCurrentGroup
();
if
(
group
==
null
)
{
// this is a different level (the enclosing query)
return
;
}
AggregateData
data
=
(
AggregateData
)
group
.
get
(
this
);
if
(
data
==
null
)
{
data
=
new
AggregateData
(
type
);
...
...
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
fb598f3f
...
...
@@ -32,17 +32,14 @@ public class ExpressionColumn extends Expression {
private
int
queryLevel
;
private
Column
column
;
private
boolean
evaluatable
;
private
Select
select
;
public
ExpressionColumn
(
Database
database
,
Select
select
,
Column
column
)
{
this
.
database
=
database
;
this
.
select
=
select
;
this
.
column
=
column
;
}
public
ExpressionColumn
(
Database
database
,
Select
select
,
String
schemaName
,
String
tableAlias
,
String
columnName
)
{
this
.
database
=
database
;
this
.
select
=
select
;
this
.
schemaName
=
schemaName
;
this
.
tableAlias
=
tableAlias
;
this
.
columnName
=
columnName
;
...
...
@@ -114,10 +111,15 @@ public class ExpressionColumn extends Expression {
public
void
updateAggregate
(
Session
session
)
throws
SQLException
{
Value
now
=
resolver
.
getValue
(
column
);
Select
select
=
resolver
.
getSelect
();
if
(
select
==
null
)
{
throw
Message
.
getSQLException
(
Message
.
MUST_GROUP_BY_COLUMN_1
,
getSQL
());
}
HashMap
values
=
select
.
getCurrentGroup
();
if
(
values
==
null
)
{
// this is a different level (the enclosing query)
return
;
}
Value
v
=
(
Value
)
values
.
get
(
this
);
if
(
v
==
null
)
{
values
.
put
(
this
,
now
);
...
...
@@ -131,6 +133,7 @@ public class ExpressionColumn extends Expression {
public
Value
getValue
(
Session
session
)
throws
SQLException
{
// TODO refactor: simplify check if really part of an aggregated value / detection of
// usage of non-grouped by columns without aggregate function
Select
select
=
resolver
.
getSelect
();
if
(
select
!=
null
)
{
HashMap
values
=
select
.
getCurrentGroup
();
if
(
values
!=
null
)
{
...
...
h2/src/main/org/h2/expression/Subquery.java
浏览文件 @
fb598f3f
...
...
@@ -83,8 +83,8 @@ public class Subquery extends Expression {
return
"("
+
query
.
getPlan
()
+
")"
;
}
public
void
updateAggregate
(
Session
session
)
{
// TODO exists: is it possible that the subquery contains related aggregates? probably not
public
void
updateAggregate
(
Session
session
)
throws
SQLException
{
query
.
updateAggregate
(
session
);
}
private
Expression
getExpression
()
{
...
...
h2/src/main/org/h2/server/web/AppServer.java
浏览文件 @
fb598f3f
...
...
@@ -58,6 +58,8 @@ public class AppServer {
ssl
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
}
else
if
(
"-webAllowOthers"
.
equals
(
args
[
i
]))
{
allowOthers
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
// } else if("-baseDir".equals(args[i])) {
// String baseDir = args[++i];
}
}
// TODO gcj: don't load drivers in case of GCJ
...
...
h2/src/main/org/h2/server/web/res/query.jsp
浏览文件 @
fb598f3f
...
...
@@ -359,6 +359,8 @@ function showList(s) {
}
else
{
showOutput
(
''
);
}
// scroll to the top left
top
.
h2result
.
scrollTo
(
0
,
0
);
}
function
retrieveList
(
s
)
{
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
fb598f3f
...
...
@@ -249,7 +249,7 @@ public class Column {
public
void
prepareExpression
(
Session
session
)
throws
SQLException
{
if
(
defaultExpression
!=
null
)
{
computeTableFilter
=
new
TableFilter
(
session
,
table
,
null
,
false
);
computeTableFilter
=
new
TableFilter
(
session
,
table
,
null
,
false
,
null
);
defaultExpression
.
mapColumns
(
computeTableFilter
,
0
);
defaultExpression
=
defaultExpression
.
optimize
(
session
);
}
...
...
h2/src/main/org/h2/table/ColumnResolver.java
浏览文件 @
fb598f3f
...
...
@@ -4,6 +4,7 @@
*/
package
org
.
h2
.
table
;
import
org.h2.command.dml.Select
;
import
org.h2.value.Value
;
public
interface
ColumnResolver
{
...
...
@@ -13,5 +14,6 @@ public interface ColumnResolver {
String
getSchemaName
();
Value
getValue
(
Column
column
);
TableFilter
getTableFilter
();
Select
getSelect
();
}
h2/src/main/org/h2/table/SingleColumnResolver.java
浏览文件 @
fb598f3f
...
...
@@ -4,6 +4,7 @@
*/
package
org
.
h2
.
table
;
import
org.h2.command.dml.Select
;
import
org.h2.value.Value
;
public
class
SingleColumnResolver
implements
ColumnResolver
{
...
...
@@ -39,4 +40,8 @@ public class SingleColumnResolver implements ColumnResolver {
return
null
;
}
public
Select
getSelect
()
{
return
null
;
}
}
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
fb598f3f
...
...
@@ -6,6 +6,7 @@ package org.h2.table;
import
java.sql.SQLException
;
import
org.h2.command.dml.Select
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
...
...
@@ -33,6 +34,7 @@ public class TableFilter implements ColumnResolver {
private
Cursor
cursor
;
private
int
scanCount
;
private
boolean
used
;
// used in the plan
private
Select
select
;
// conditions that can be used for direct index lookup (start or end)
private
ObjectArray
indexConditions
=
new
ObjectArray
();
...
...
@@ -53,11 +55,16 @@ public class TableFilter implements ColumnResolver {
private
Expression
fullCondition
;
private
boolean
rightsChecked
;
public
TableFilter
(
Session
session
,
Table
table
,
String
alias
,
boolean
rightsChecked
)
{
public
TableFilter
(
Session
session
,
Table
table
,
String
alias
,
boolean
rightsChecked
,
Select
select
)
{
this
.
session
=
session
;
this
.
table
=
table
;
this
.
alias
=
alias
;
this
.
rightsChecked
=
rightsChecked
;
this
.
select
=
select
;
}
public
Select
getSelect
()
{
return
select
;
}
public
Session
getSession
()
{
...
...
h2/src/main/org/h2/tools/Script.java
浏览文件 @
fb598f3f
...
...
@@ -27,7 +27,7 @@ public class Script {
private
void
showUsage
()
{
System
.
out
.
println
(
"java "
+
getClass
().
getName
()
+
" -url <url> -user <user> [-password <pwd>] [-
file
<filename>] [-options <option> ...]"
);
+
" -url <url> -user <user> [-password <pwd>] [-
script
<filename>] [-options <option> ...]"
);
}
/**
...
...
@@ -39,7 +39,7 @@ public class Script {
* </li><li>-url jdbc:h2:... (database URL)
* </li><li>-user username
* </li><li>-password password
* </li><li>-
file
filename (default file name is backup.sql)
* </li><li>-
script
filename (default file name is backup.sql)
* </li><li>-options to specify a list of options (only for H2)
* </li></ul>
*
...
...
@@ -63,7 +63,7 @@ public class Script {
user
=
args
[++
i
];
}
else
if
(
args
[
i
].
equals
(
"-password"
))
{
password
=
args
[++
i
];
}
else
if
(
args
[
i
].
equals
(
"-
file
"
))
{
}
else
if
(
args
[
i
].
equals
(
"-
script
"
))
{
file
=
args
[++
i
];
}
else
if
(
args
[
i
].
equals
(
"-options"
))
{
StringBuffer
buff1
=
new
StringBuffer
();
...
...
h2/src/main/org/h2/tools/Server.java
浏览文件 @
fb598f3f
...
...
@@ -74,13 +74,13 @@ public class Server implements Runnable {
* The following options are supported:
* <ul>
* <li>-help or -? (print the list of options)
* </li><li>-web (start the Web Server)
* </li><li>-web (start the Web Server
/ H2 Console application
)
* </li><li>-tcp (start the TCP Server)
* </li><li>-tcpShutdown {url} (shutdown the running TCP Server, URL example: tcp://localhost:9094)
* </li><li>-odbc (start the ODBC Server)
* </li><li>-browser (start a browser and open a page to connect to the Web Server)
* </li><li>-log [true|false] (enable or disable logging)
* </li><li>-baseDir {directory} (sets the base directory for database files)
* </li><li>-baseDir {directory} (sets the base directory for database files
; not for H2 Console
)
* </li><li>-ifExists [true|false] (only existing databases may be opened)
* </li><li>-ftp (start the FTP Server)
* </li></ul>
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
fb598f3f
差异被折叠。
点击展开。
h2/src/test/org/h2/test/cases/TestWithRecursive.java
0 → 100644
浏览文件 @
fb598f3f
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
cases
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.Statement
;
import
org.h2.tools.DeleteDbFiles
;
public
class
TestWithRecursive
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Class
.
forName
(
"org.h2.Driver"
);
DeleteDbFiles
.
execute
(
"."
,
"test"
,
true
);
String
url
=
"jdbc:h2:test"
;
Connection
conn
=
DriverManager
.
getConnection
(
url
,
"sa"
,
"sa"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table parent(id int primary key, parent int)"
);
stat
.
execute
(
"insert into parent values(1, null), (2, 1), (3, 1)"
);
ResultSet
rs
=
stat
.
executeQuery
(
"with test_view(id, parent) as \n"
+
"select id, parent from parent where id = 1 \n"
+
"union all select parent.id, parent.parent from test_view, parent \n"
+
"where parent.parent = test_view.id \n"
+
"select * from test_view"
);
System
.
out
.
println
(
"query:"
);
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
1
));
}
stat
.
execute
(
"drop view if exists test_view"
);
System
.
out
.
println
(
"prepared:"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"with test_view(id, parent) as \n"
+
"select id, parent from parent where id = ? \n"
+
"union all select parent.id, parent.parent from test_view, parent \n"
+
"where parent.parent = test_view.id \n"
+
"select * from test_view"
);
prep
.
setInt
(
1
,
1
);
rs
=
prep
.
executeQuery
();
while
(
rs
.
next
())
{
System
.
out
.
println
(
rs
.
getString
(
1
));
}
conn
.
close
();
}
}
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
fb598f3f
...
...
@@ -17,6 +17,7 @@ import java.util.Date;
import
java.util.LinkedList
;
import
java.util.Random
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.tools.Backup
;
import
org.h2.tools.DeleteDbFiles
;
...
...
@@ -293,4 +294,10 @@ public abstract class TestHalt extends TestBase {
return
buff
.
toString
();
}
public
TestBase
init
(
TestAll
conf
)
throws
Exception
{
super
.
init
(
conf
);
BASE_DIR
=
"dataHalt"
;
return
this
;
}
}
h2/src/test/org/h2/test/synth/TestHaltApp.java
浏览文件 @
fb598f3f
...
...
@@ -8,6 +8,11 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.test.db.TestScript
;
public
class
TestHaltApp
extends
TestHalt
{
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
fb598f3f
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table people (family varchar(1) not null, person varchar(1) not null);
> ok
create table cars (family varchar(1) not null, car varchar(1) not null);
> ok
insert into people values(1, 1), (2, 1), (2, 2), (3, 1), (5, 1);
> update count: 5
insert into cars values(2, 1), (2, 2), (3, 1), (3, 2), (3, 3), (4, 1);
> update count: 6
select family, (select count(car) from cars where cars.family = people.family) as x
from people group by family order by family;
> FAMILY X
> ------ -
> 1 0
> 2 2
> 3 3
> 5 0
> rows (ordered): 4
drop table people, cars;
> ok
select (1, 2);
> 1, 2
> ------
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
fb598f3f
...
...
@@ -44,9 +44,9 @@ public class TestTools extends TestBase {
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
conn
.
createStatement
().
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
conn
.
close
();
Script
.
main
(
new
String
[]{
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-
file
"
,
fileName
,
"-options"
,
"nodata"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
});
Script
.
main
(
new
String
[]{
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-
script
"
,
fileName
,
"-options"
,
"nodata"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
});
DeleteDbFiles
.
main
(
new
String
[]{
"-dir"
,
BASE_DIR
,
"-db"
,
"utils"
,
"-quiet"
});
RunScript
.
main
(
new
String
[]{
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-
file
"
,
fileName
,
"-options"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
});
RunScript
.
main
(
new
String
[]{
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-
script
"
,
fileName
,
"-options"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
});
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
BASE_DIR
+
"/utils"
,
"sa"
,
"abc"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
checkFalse
(
rs
.
next
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论