Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
433bf879
提交
433bf879
authored
1月 26, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
0ea30d28
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
106 行增加
和
80 行删除
+106
-80
TestCancel.java
h2/src/test/org/h2/test/jdbc/TestCancel.java
+4
-4
TestDataSource.java
h2/src/test/org/h2/test/jdbc/TestDataSource.java
+29
-4
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+4
-4
TestNativeSQL.java
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
+1
-1
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+6
-6
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+4
-4
TestXA.java
h2/src/test/org/h2/test/jdbc/TestXA.java
+6
-6
TestZloty.java
h2/src/test/org/h2/test/jdbc/TestZloty.java
+2
-2
Listener.java
h2/src/test/org/h2/test/poweroff/Listener.java
+2
-2
DbConnection.java
h2/src/test/org/h2/test/synth/DbConnection.java
+1
-1
Result.java
h2/src/test/org/h2/test/synth/Result.java
+5
-5
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+2
-2
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+2
-2
TestHaltApp.java
h2/src/test/org/h2/test/synth/TestHaltApp.java
+2
-2
TestMultiNews.java
h2/src/test/org/h2/test/synth/TestMultiNews.java
+13
-13
TestMultiNewsSimple.java
h2/src/test/org/h2/test/synth/TestMultiNewsSimple.java
+4
-4
TestMultiOrder.java
h2/src/test/org/h2/test/synth/TestMultiOrder.java
+5
-5
TestRandomSQL.java
h2/src/test/org/h2/test/synth/TestRandomSQL.java
+2
-2
TestSynth.java
h2/src/test/org/h2/test/synth/TestSynth.java
+2
-1
TestExit.java
h2/src/test/org/h2/test/unit/TestExit.java
+1
-1
TestSampleApps.java
h2/src/test/org/h2/test/unit/TestSampleApps.java
+3
-3
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+3
-3
TestStreams.java
h2/src/test/org/h2/test/unit/TestStreams.java
+3
-3
没有找到文件。
h2/src/test/org/h2/test/jdbc/TestCancel.java
浏览文件 @
433bf879
...
...
@@ -14,10 +14,10 @@ import org.h2.test.TestBase;
public
class
TestCancel
extends
TestBase
{
class
Cancel
ler
extends
Thread
{
class
Cancel
Thread
extends
Thread
{
private
Statement
cancel
;
private
int
wait
;
Cancel
ler
(
Statement
cancel
,
int
wait
)
{
Cancel
Thread
(
Statement
cancel
,
int
wait
)
{
this
.
cancel
=
cancel
;
this
.
wait
=
wait
;
}
...
...
@@ -53,8 +53,8 @@ public class TestCancel extends TestBase {
// TODO test insert.. select
for
(
int
i
=
1
;;)
{
Statement
query
=
conn
.
createStatement
();
Cancel
ler
canceller
=
new
Canceller
(
query
,
i
);
cancel
ler
.
start
();
Cancel
Thread
cancel
=
new
CancelThread
(
query
,
i
);
cancel
.
start
();
Thread
.
yield
();
int
j
=
0
;
try
{
...
...
h2/src/test/org/h2/test/jdbc/TestDataSource.java
浏览文件 @
433bf879
...
...
@@ -7,6 +7,10 @@ package org.h2.test.jdbc;
import
java.sql.Connection
;
import
java.sql.Statement
;
import
javax.sql.ConnectionEvent
;
import
javax.sql.ConnectionEventListener
;
import
javax.sql.XAConnection
;
import
org.h2.jdbcx.JdbcDataSource
;
import
org.h2.test.TestBase
;
...
...
@@ -36,12 +40,33 @@ public class TestDataSource extends TestBase {
// }
public
void
test
()
throws
Exception
{
deleteDb
(
"datasource"
);
testDataSource
();
testXAConnection
();
}
private
void
testXAConnection
()
throws
Exception
{
deleteDb
(
BASE_DIR
,
"dataSource"
);
JdbcDataSource
ds
=
new
JdbcDataSource
();
ds
.
setURL
(
"jdbc:h2:"
+
BASE_DIR
+
"/dataSource"
);
XAConnection
xaConn
=
ds
.
getXAConnection
();
xaConn
.
addConnectionEventListener
(
new
ConnectionEventListener
()
{
public
void
connectionClosed
(
ConnectionEvent
event
)
{
}
public
void
connectionErrorOccurred
(
ConnectionEvent
event
)
{
}
});
Connection
conn
=
xaConn
.
getConnection
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SELECT * FROM DUAL"
);
conn
.
close
();
xaConn
.
close
();
}
private
void
testDataSource
()
throws
Exception
{
deleteDb
(
BASE_DIR
,
"dataSource"
);
JdbcDataSource
ds
=
new
JdbcDataSource
();
ds
.
setURL
(
"jdbc:h2:"
+
BASE_DIR
+
"/data
s
ource"
);
ds
.
setURL
(
"jdbc:h2:"
+
BASE_DIR
+
"/data
S
ource"
);
ds
.
setUser
(
"sa"
);
ds
.
setPassword
(
""
);
Connection
conn
=
ds
.
getConnection
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SELECT * FROM DUAL"
);
...
...
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
433bf879
...
...
@@ -499,11 +499,11 @@ public class TestMetaData extends TestBase {
int
minor
=
meta
.
getDriverMinorVersion
();
trace
(
"meta.getDriverMinorVersion:"
+
minor
);
String
driver
n
ame
=
meta
.
getDriverName
();
trace
(
"meta.getDriverName:"
+
driver
n
ame
);
String
driver
N
ame
=
meta
.
getDriverName
();
trace
(
"meta.getDriverName:"
+
driver
N
ame
);
String
driver
v
ersion
=
meta
.
getDriverVersion
();
trace
(
"meta.getDriverVersion:"
+
driver
v
ersion
);
String
driver
V
ersion
=
meta
.
getDriverVersion
();
trace
(
"meta.getDriverVersion:"
+
driver
V
ersion
);
meta
.
getSearchStringEscape
();
...
...
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
浏览文件 @
433bf879
...
...
@@ -29,7 +29,7 @@ public class TestNativeSQL extends TestBase {
conn
.
nativeSQL
(
"TEST-TEST/TEST/*TEST*/TEST--\rTEST--{fn }"
);
conn
.
nativeSQL
(
"TEST-TEST//TEST"
);
conn
.
nativeSQL
(
"'{}' '' \"1\" \"\"\"\""
);
conn
.
nativeSQL
(
"{?= call HE
E
LO{t '10'}}"
);
conn
.
nativeSQL
(
"{?= call HE
L
LO{t '10'}}"
);
conn
.
nativeSQL
(
"TEST 'test'{OJ OUTER JOIN}'test'{oj OUTER JOIN}"
);
conn
.
nativeSQL
(
"{call {ts '2001-01-10'}}"
);
conn
.
nativeSQL
(
"call ? { 1: '}' };"
);
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
433bf879
...
...
@@ -46,13 +46,13 @@ public class TestPreparedStatement extends TestBase {
private
void
testUUIDGeneratedKeys
(
Connection
conn
)
throws
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TESTUUID(id UUID DEFAULT random_UUID() PRIMARY KEY)"
);
stat
.
execute
(
"INSERT INTO TESTUUID() VALUES()"
);
stat
.
execute
(
"CREATE TABLE TEST
_
UUID(id UUID DEFAULT random_UUID() PRIMARY KEY)"
);
stat
.
execute
(
"INSERT INTO TEST
_
UUID() VALUES()"
);
ResultSet
rs
=
stat
.
getGeneratedKeys
();
rs
.
next
();
byte
[]
data
=
rs
.
getBytes
(
1
);
check
(
data
.
length
,
16
);
stat
.
execute
(
"DROP TABLE TESTUUID"
);
stat
.
execute
(
"DROP TABLE TEST
_
UUID"
);
}
private
void
testSetObject
(
Connection
conn
)
throws
Exception
{
...
...
@@ -592,12 +592,12 @@ public class TestPreparedStatement extends TestBase {
PreparedStatement
prep
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE T_CLOB(ID INT PRIMARY KEY,V1 CLOB,V2 CLOB)"
);
StringBuffer
ascii
b
uffer
=
new
StringBuffer
();
StringBuffer
ascii
B
uffer
=
new
StringBuffer
();
int
len
=
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
ascii
b
uffer
.
append
((
char
)(
'a'
+(
i
%
20
)));
ascii
B
uffer
.
append
((
char
)(
'a'
+(
i
%
20
)));
}
String
ascii1
=
ascii
b
uffer
.
toString
();
String
ascii1
=
ascii
B
uffer
.
toString
();
String
ascii2
=
"Number2 "
+
ascii1
;
prep
=
conn
.
prepareStatement
(
"INSERT INTO T_CLOB VALUES(?,?,?)"
);
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
433bf879
...
...
@@ -29,8 +29,8 @@ public class TestResultSet extends TestBase {
Statement
stat
;
public
void
test
()
throws
Exception
{
deleteDb
(
"result
s
et"
);
conn
=
getConnection
(
"result
s
et"
);
deleteDb
(
"result
S
et"
);
conn
=
getConnection
(
"result
S
et"
);
stat
=
conn
.
createStatement
();
...
...
@@ -134,7 +134,7 @@ public class TestResultSet extends TestBase {
ResultSetMetaData
meta
=
rs
.
getMetaData
();
check
(
meta
.
getColumnCount
(),
3
);
check
(
meta
.
getCatalogName
(
1
),
"
RESULTSET"
);
check
(
meta
.
getCatalogName
(
1
),
"
resultSet"
.
toUpperCase
()
);
check
(
"PUBLIC"
.
equals
(
meta
.
getSchemaName
(
2
)));
check
(
"TEST"
.
equals
(
meta
.
getTableName
(
1
)));
check
(
"ID"
.
equals
(
meta
.
getColumnName
(
1
)));
...
...
@@ -670,7 +670,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"INSERT INTO TEST VALUES(1,X'01010101')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(2,X'02020202')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(3,X'00')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(4,X'ff
FF
ff')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(4,X'ff
ff
ff')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(5,X'0bcec1')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(6,NULL)"
);
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST ORDER BY ID"
);
...
...
h2/src/test/org/h2/test/jdbc/TestXA.java
浏览文件 @
433bf879
...
...
@@ -15,8 +15,8 @@ public class TestXA {
Class
.
forName
(
"org.h2.Driver"
);
// InitialContext
ictx
= new InitialContext();
//
ictx.rebind(USER_TRANSACTION_JNDI_NAME, jotm
.getUserTransaction());
// InitialContext
context
= new InitialContext();
//
context.rebind(USER_TRANSACTION_JNDI_NAME, j
.getUserTransaction());
JdbcDataSource
ds1
=
new
JdbcDataSource
();
ds1
.
setPassword
(
""
);
...
...
@@ -28,7 +28,7 @@ public class TestXA {
ds2
.
setUser
(
"sa"
);
ds2
.
setURL
(
"jdbc:h2:db2H2"
);
// UserTransaction ut = (UserTransaction)
ictx
.lookup("UserTransaction");
// UserTransaction ut = (UserTransaction)
context
.lookup("UserTransaction");
// ut.begin();
Connection
c1
=
ds1
.
getXAConnection
().
getConnection
();
...
...
@@ -36,15 +36,15 @@ public class TestXA {
Connection
c2
=
ds2
.
getXAConnection
().
getConnection
();
c2
.
setAutoCommit
(
false
);
c1
.
createStatement
().
executeUpdate
(
"create table test(id int, test
e
varchar(255))"
);
c2
.
createStatement
().
executeUpdate
(
"create table test(id int, test
e
varchar(255))"
);
c1
.
createStatement
().
executeUpdate
(
"create table test(id int, test varchar(255))"
);
c2
.
createStatement
().
executeUpdate
(
"create table test(id int, test varchar(255))"
);
// ut.rollback();
c1
.
close
();
c2
.
close
();
// j
otm
.stop();
// j.stop();
// System.exit(0);
}
...
...
h2/src/test/org/h2/test/jdbc/TestZloty.java
浏览文件 @
433bf879
...
...
@@ -82,11 +82,11 @@ public class TestZloty extends TestBase {
prep
.
setInt
(
1
,
3
);
try
{
BigDecimal
crappyVal
=
new
BigDecimal
(
"12.100000"
)
{
BigDecimal
value
=
new
BigDecimal
(
"12.100000"
)
{
private
static
final
long
serialVersionUID
=
-
7909023971521750844L
;
public
String
toString
()
{
return
"12,100000 EURO"
;
}
};
prep
.
setBigDecimal
(
2
,
crappyVal
);
prep
.
setBigDecimal
(
2
,
value
);
prep
.
execute
();
error
(
"unexpected success"
);
}
catch
(
SQLException
e
)
{
...
...
h2/src/test/org/h2/test/poweroff/Listener.java
浏览文件 @
433bf879
...
...
@@ -61,8 +61,8 @@ public class Listener implements Runnable {
System
.
out
.
println
(
"Closed with Exception: "
+
e
);
}
time
=
System
.
currentTimeMillis
()
-
time
;
int
op
s
=
(
int
)
(
1000
*
maxValue
/
time
);
System
.
out
.
println
(
"Max="
+
maxValue
+
" operations/sec="
+
op
s
);
int
op
erationsPerSecond
=
(
int
)
(
1000
*
maxValue
/
time
);
System
.
out
.
println
(
"Max="
+
maxValue
+
" operations/sec="
+
op
erationsPerSecond
);
}
}
...
...
h2/src/test/org/h2/test/synth/DbConnection.java
浏览文件 @
433bf879
...
...
@@ -56,7 +56,7 @@ class DbConnection implements DbInterface {
tables
.
remove
(
i
);
i
--;
}
catch
(
SQLException
e
)
{
// maybe a referen
c
ial integrity
// maybe a referen
t
ial integrity
}
}
// could not drop any table and still tables to drop
...
...
h2/src/test/org/h2/test/synth/Result.java
浏览文件 @
433bf879
...
...
@@ -12,7 +12,7 @@ import java.util.*;
import
org.h2.test.TestBase
;
class
Result
implements
Comparable
{
static
final
int
SUCCESS
=
0
,
BOOLEAN
=
1
,
INT
=
2
,
EXCEPTION
=
3
,
RESULTSET
=
4
;
static
final
int
SUCCESS
=
0
,
BOOLEAN
=
1
,
INT
=
2
,
EXCEPTION
=
3
,
RESULT
_
SET
=
4
;
private
int
type
;
private
boolean
bool
;
private
int
intValue
;
...
...
@@ -46,7 +46,7 @@ class Result implements Comparable {
Result
(
TestSynth
config
,
String
sql
,
ResultSet
rs
)
{
this
.
sql
=
sql
;
type
=
RESULTSET
;
type
=
RESULT
_
SET
;
try
{
rows
=
new
ArrayList
();
header
=
new
ArrayList
();
...
...
@@ -81,7 +81,7 @@ class Result implements Comparable {
exception
.
printStackTrace
(
new
PrintWriter
(
w
));
return
"exception: "
+
exception
.
getSQLState
()+
": "
+
exception
.
getMessage
()
+
"\r\n"
+
w
.
toString
();
}
case
RESULTSET:
case
RESULT
_
SET:
String
result
=
"ResultSet { // size="
+
rows
.
size
()
+
"\r\n "
;
for
(
int
i
=
0
;
i
<
header
.
size
();
i
++)
{
Column
column
=
(
Column
)
header
.
get
(
i
);
...
...
@@ -110,7 +110,7 @@ class Result implements Comparable {
case
BOOLEAN:
case
INT:
case
SUCCESS:
case
RESULTSET:
case
RESULT
_
SET:
return
toString
().
compareTo
(
r
.
toString
());
default
:
throw
new
Error
(
"internal"
);
...
...
@@ -132,7 +132,7 @@ class Result implements Comparable {
System
.
out
.
println
(
"> update count: "
+
intValue
);
}
break
;
case
RESULTSET:
case
RESULT
_
SET:
System
.
out
.
println
(
"> rs "
+
rows
.
size
());
break
;
}
...
...
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
433bf879
...
...
@@ -61,7 +61,7 @@ public class TestCrashAPI extends TestBase {
if
(
delete
)
{
deleteDb
();
}
// can not use FILE_LOCK=NO, otherwise something could be written into the database in the finalize
r
// can not use FILE_LOCK=NO, otherwise something could be written into the database in the finalize
method
String
add
=
""
;
// ";STORAGE=TEXT";
// int testing;
...
...
@@ -75,7 +75,7 @@ public class TestCrashAPI extends TestBase {
// config.logMode = 2;
// }
String
url
=
getURL
(
DIR
+
"/crash
a
pi"
+
seed
,
true
)
+
add
;
String
url
=
getURL
(
DIR
+
"/crash
A
pi"
+
seed
,
true
)
+
add
;
Connection
conn
=
null
;
// System.gc();
...
...
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
433bf879
...
...
@@ -25,7 +25,7 @@ public abstract class TestHalt extends TestBase {
private
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"MM-dd HH:mm:ss "
);
protected
static
final
int
OP_INSERT
=
1
,
OP_DELETE
=
2
,
OP_UPDATE
=
4
,
OP_SELECT
=
8
;
protected
static
final
int
FLAG_NODELAY
=
1
,
FLAG_LOBS
=
2
;
protected
static
final
int
FLAG_NO
_
DELAY
=
1
,
FLAG_LOBS
=
2
;
protected
int
operations
,
flags
,
value
;
protected
Connection
conn
;
protected
Random
random
=
new
Random
();
...
...
@@ -120,7 +120,7 @@ public abstract class TestHalt extends TestBase {
// int operations = OP_INSERT;
// OP_DELETE = 1, OP_UPDATE = 2, OP_SELECT = 4;
// int flags = FLAG_NODELAY;
// FLAG_NO
DELAY = 1, FLAG_AUTOCOMMIT = 2, FLAG_SMALL
CACHE = 4;
// FLAG_NO
_DELAY = 1, FLAG_AUTO_COMMIT = 2, FLAG_SMALL_
CACHE = 4;
int
value
=
random
.
nextInt
(
1000
);
// for Derby and HSQLDB
// String classPath = "-cp .;D:/data/java/hsqldb.jar;D:/data/java/derby.jar";
...
...
h2/src/test/org/h2/test/synth/TestHaltApp.java
浏览文件 @
433bf879
...
...
@@ -53,7 +53,7 @@ public class TestHaltApp extends TestHalt {
protected
void
appStart
()
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
if
((
flags
&
FLAG_NODELAY
)
!=
0
)
{
if
((
flags
&
FLAG_NO
_
DELAY
)
!=
0
)
{
stat
.
execute
(
"SET WRITE_DELAY 0"
);
stat
.
execute
(
"SET MAX_LOG_SIZE 1"
);
}
...
...
@@ -97,7 +97,7 @@ public class TestHaltApp extends TestHalt {
conn
.
commit
();
log
(
"committed: "
+
rowCount
,
null
);
}
if
((
flags
&
FLAG_NODELAY
)
!=
0
)
{
if
((
flags
&
FLAG_NO
_
DELAY
)
!=
0
)
{
if
(
random
.
nextInt
(
100
)
==
0
)
{
stat
.
execute
(
"CHECKPOINT"
);
}
...
...
h2/src/test/org/h2/test/synth/TestMultiNews.java
浏览文件 @
433bf879
...
...
@@ -35,10 +35,10 @@ public class TestMultiNews extends TestMultiThread {
PreparedStatement
prep
;
if
(
random
.
nextBoolean
())
{
prep
=
conn
.
prepareStatement
(
"SELECT * FROM NEWS WHERE
F
LINK = ?"
);
"SELECT * FROM NEWS WHERE LINK = ?"
);
}
else
{
prep
=
conn
.
prepareStatement
(
"SELECT * FROM NEWS WHERE
F
VALUE = ?"
);
"SELECT * FROM NEWS WHERE VALUE = ?"
);
}
prep
.
setString
(
1
,
PREFIX_URL
+
random
.
nextInt
(
len
));
ResultSet
rs
=
prep
.
executeQuery
();
...
...
@@ -50,7 +50,7 @@ public class TestMultiNews extends TestMultiThread {
}
}
else
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"UPDATE NEWS SET
F
STATE = ? WHERE FID = ?"
);
"UPDATE NEWS SET STATE = ? WHERE FID = ?"
);
prep
.
setInt
(
1
,
random
.
nextInt
(
100
));
prep
.
setInt
(
2
,
random
.
nextInt
(
len
));
int
count
=
prep
.
executeUpdate
();
...
...
@@ -77,16 +77,16 @@ public class TestMultiNews extends TestMultiThread {
stat
.
execute
(
"CREATE TABLE TEST (ID IDENTITY, NAME VARCHAR)"
);
stat
.
execute
(
"CREATE TABLE NEWS (FID NUMERIC(19) PRIMARY KEY,
F
COMMENTS LONGVARCHAR, "
+
"
FLINK VARCHAR(255), FSTATE INTEGER, F
VALUE VARCHAR(255))"
);
"CREATE TABLE NEWS (FID NUMERIC(19) PRIMARY KEY, COMMENTS LONGVARCHAR, "
+
"
LINK VARCHAR(255), STATE INTEGER,
VALUE VARCHAR(255))"
);
stat
.
execute
(
"CREATE INDEX IF NOT EXISTS NEWS_GUID_VALUE_INDEX ON NEWS(
F
VALUE)"
);
"CREATE INDEX IF NOT EXISTS NEWS_GUID_VALUE_INDEX ON NEWS(VALUE)"
);
stat
.
execute
(
"CREATE INDEX IF NOT EXISTS NEWS_LINK_INDEX ON NEWS(
F
LINK)"
);
"CREATE INDEX IF NOT EXISTS NEWS_LINK_INDEX ON NEWS(LINK)"
);
stat
.
execute
(
"CREATE INDEX IF NOT EXISTS NEWS_STATE_INDEX ON NEWS(
F
STATE)"
);
"CREATE INDEX IF NOT EXISTS NEWS_STATE_INDEX ON NEWS(STATE)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO NEWS (FID,
FCOMMENTS, FLINK, FSTATE, F
VALUE) VALUES "
+
"INSERT INTO NEWS (FID,
COMMENTS, LINK, STATE,
VALUE) VALUES "
+
"(?, ?, ?, ?, ?) "
);
PreparedStatement
prep2
=
conn
.
prepareStatement
(
"INSERT INTO TEST (NAME) VALUES (?)"
);
...
...
@@ -100,10 +100,10 @@ public class TestMultiNews extends TestMultiThread {
}
String
comment
=
buff
.
toString
();
prep
.
setInt
(
1
,
i
);
// FID
prep
.
setString
(
2
,
comment
);
//
F
COMMENTS
prep
.
setString
(
3
,
PREFIX_URL
+
i
);
//
F
LINK
prep
.
setInt
(
4
,
0
);
//
F
STATE
prep
.
setString
(
5
,
PREFIX_URL
+
i
);
//
F
VALUE
prep
.
setString
(
2
,
comment
);
// COMMENTS
prep
.
setString
(
3
,
PREFIX_URL
+
i
);
// LINK
prep
.
setInt
(
4
,
0
);
// STATE
prep
.
setString
(
5
,
PREFIX_URL
+
i
);
// VALUE
prep
.
execute
();
prep2
.
setString
(
1
,
comment
);
prep2
.
execute
();
...
...
h2/src/test/org/h2/test/synth/TestMultiNewsSimple.java
浏览文件 @
433bf879
...
...
@@ -25,12 +25,12 @@ public class TestMultiNewsSimple extends TestMultiThread {
void
first
()
throws
SQLException
{
Connection
conn
=
base
.
getConnection
();
conn
.
createStatement
().
execute
(
"create table news(
fid identity, f
state int default 0, text varchar default '')"
);
conn
.
createStatement
().
execute
(
"create table news(
id identity,
state int default 0, text varchar default '')"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"insert into news() values()"
);
for
(
int
i
=
0
;
i
<
newsCount
;
i
++)
{
prep
.
executeUpdate
();
}
conn
.
createStatement
().
execute
(
"update news set text = 'Text' ||
f
id"
);
conn
.
createStatement
().
execute
(
"update news set text = 'Text' || id"
);
conn
.
close
();
}
...
...
@@ -52,12 +52,12 @@ public class TestMultiNewsSimple extends TestMultiThread {
}
}
else
{
if
(
random
.
nextBoolean
())
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"update news set
fstate = ? where f
id = ?"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"update news set
state = ? where
id = ?"
);
prep
.
setInt
(
1
,
random
.
nextInt
(
getNewsCount
()));
prep
.
setInt
(
2
,
random
.
nextInt
(
10
));
prep
.
execute
();
}
else
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select * from news where
f
id = ?"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"select * from news where id = ?"
);
prep
.
setInt
(
1
,
random
.
nextInt
(
getNewsCount
()));
ResultSet
rs
=
prep
.
executeQuery
();
if
(!
rs
.
next
())
{
...
...
h2/src/test/org/h2/test/synth/TestMultiOrder.java
浏览文件 @
433bf879
...
...
@@ -27,7 +27,7 @@ public class TestMultiOrder extends TestMultiThread {
}
void
begin
()
throws
SQLException
{
insertLine
=
conn
.
prepareStatement
(
"insert into order
l
ine(orderid, lineid, text, amount) values(?, ?, ?, ?)"
);
insertLine
=
conn
.
prepareStatement
(
"insert into order
L
ine(orderid, lineid, text, amount) values(?, ?, ?, ?)"
);
insertCustomer
();
}
...
...
@@ -114,10 +114,10 @@ public class TestMultiOrder extends TestMultiThread {
Connection
conn
=
base
.
getConnection
();
conn
.
createStatement
().
execute
(
"drop table customer if exists"
);
conn
.
createStatement
().
execute
(
"drop table orders if exists"
);
conn
.
createStatement
().
execute
(
"drop table order
l
ine if exists"
);
conn
.
createStatement
().
execute
(
"drop table order
L
ine if exists"
);
conn
.
createStatement
().
execute
(
"create table customer(id int primary key, name varchar, account decimal)"
);
conn
.
createStatement
().
execute
(
"create table orders(id int identity primary key, customer_id int, total decimal)"
);
conn
.
createStatement
().
execute
(
"create table order
l
ine(orderid int, lineid int, text varchar, amount decimal, primary key(orderid, lineid))"
);
conn
.
createStatement
().
execute
(
"create table order
L
ine(orderid int, lineid int, text varchar, amount decimal, primary key(orderid, lineid))"
);
conn
.
close
();
}
...
...
@@ -133,10 +133,10 @@ public class TestMultiOrder extends TestMultiThread {
base
.
check
(
rs
.
getInt
(
1
),
orderCount
);
// System.out.println("orders: " + rs.getInt(1));
rs
=
conn
.
createStatement
().
executeQuery
(
"select count(*) from order
l
ine"
);
rs
=
conn
.
createStatement
().
executeQuery
(
"select count(*) from order
L
ine"
);
rs
.
next
();
base
.
check
(
rs
.
getInt
(
1
),
orderLineCount
);
// System.out.println("order
l
ines: " + rs.getInt(1));
// System.out.println("order
L
ines: " + rs.getInt(1));
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/synth/TestRandomSQL.java
浏览文件 @
433bf879
...
...
@@ -35,8 +35,8 @@ public class TestRandomSQL extends TestBase {
}
private
String
getDatabaseName
()
{
// return "dataSynth/random
s
ql" + dbId+";TRACE_LEVEL_FILE=3";
return
"dataSynth/random
s
ql"
+
dbId
;
// return "dataSynth/random
S
ql" + dbId+";TRACE_LEVEL_FILE=3";
return
"dataSynth/random
S
ql"
+
dbId
;
}
private
Connection
connect
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/synth/TestSynth.java
浏览文件 @
433bf879
...
...
@@ -182,7 +182,8 @@ public class TestSynth extends TestBase {
Result
copy
=
(
Result
)
results
.
get
(
i
);
if
(
original
.
compareTo
(
copy
)
!=
0
)
{
if
(
showError
)
{
throw
new
Error
(
"Results don't match: original (0): \r\n"
+
original
+
"\r\nother:\r\n"
+
copy
);
throw
new
Error
(
"Results don't match: original (0): \r\n"
+
original
+
"\r\n"
+
"other:\r\n"
+
copy
);
}
else
{
throw
new
Error
(
"Results don't match"
);
}
...
...
h2/src/test/org/h2/test/unit/TestExit.java
浏览文件 @
433bf879
...
...
@@ -45,7 +45,7 @@ public class TestExit extends TestBase implements DatabaseEventListener {
}
proc
.
waitFor
();
if
(!
getClosedFile
().
exists
())
{
error
(
"did
n
t close database"
);
error
(
"did
no
t close database"
);
}
procDef
=
new
String
[]{
"java"
,
"-cp"
,
classPath
,
...
...
h2/src/test/org/h2/test/unit/TestSampleApps.java
浏览文件 @
433bf879
...
...
@@ -18,16 +18,16 @@ public class TestSampleApps extends TestBase {
testApp
(
org
.
h2
.
samples
.
Compact
.
class
,
null
,
"Compacting...\nDone."
);
testApp
(
org
.
h2
.
samples
.
CsvSample
.
class
,
null
,
"NAME: Bob Meier\n"
+
"EMAIL: bob.meier@abcde.
fgh
\n"
+
"EMAIL: bob.meier@abcde.
abc
\n"
+
"PHONE: +41123456789\n\n"
+
"NAME: John Jones\n"
+
"EMAIL: john
jones@abcde.fgh
\n"
+
"EMAIL: john
.jones@abcde.abc
\n"
+
"PHONE: +41976543210\n"
);
testApp
(
org
.
h2
.
samples
.
Function
.
class
,
null
,
"2 is prime\n3 is prime\n5 is prime\n7 is prime\n11 is prime\n13 is prime\n17 is prime\n19 is prime"
);
testApp
(
org
.
h2
.
samples
.
SecurePassword
.
class
,
null
,
"Hello"
);
// TODO test ShowProgress (percent numbers are hardware specific)
// TODO test ShutdownServer (server needs to be started in a separate
r
process)
// TODO test ShutdownServer (server needs to be started in a separate process)
testApp
(
org
.
h2
.
samples
.
TriggerSample
.
class
,
null
,
"The sum is 20.00"
);
// tools
...
...
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
433bf879
...
...
@@ -56,10 +56,10 @@ public class TestSecurity extends TestBase {
public
void
testXTEA
()
throws
Exception
{
byte
[]
test
=
new
byte
[
4096
];
XTEA
tea
=
new
XTEA
();
tea
.
setKey
(
"abcdefghijklmnop"
.
getBytes
());
XTEA
x
tea
=
new
XTEA
();
x
tea
.
setKey
(
"abcdefghijklmnop"
.
getBytes
());
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
tea
.
decryptBlock
(
test
,
test
,
0
);
x
tea
.
decryptBlock
(
test
,
test
,
0
);
}
}
...
...
h2/src/test/org/h2/test/unit/TestStreams.java
浏览文件 @
433bf879
...
...
@@ -58,20 +58,20 @@ public class TestStreams extends TestBase {
comp
.
close
();
byte
[]
compressed
=
out
.
toByteArray
();
ByteArrayInputStream
in
=
new
ByteArrayInputStream
(
compressed
);
LZFInputStream
decomp
=
new
LZFInputStream
(
in
);
LZFInputStream
decomp
ress
=
new
LZFInputStream
(
in
);
byte
[]
test
=
new
byte
[
buffer
.
length
];
for
(
int
j
=
0
;
j
<
buffer
.
length
;)
{
int
[]
sizes
=
new
int
[]{
0
,
1
,
random
.
nextInt
(
100
),
random
.
nextInt
(
100000
)};
int
size
=
sizes
[
random
.
nextInt
(
sizes
.
length
)];
if
(
size
==
1
)
{
int
x
=
decomp
.
read
();
int
x
=
decomp
ress
.
read
();
if
(
x
<
0
)
{
break
;
}
test
[
j
++]
=
(
byte
)
x
;
}
else
{
size
=
Math
.
min
(
size
,
test
.
length
-
j
);
int
l
=
decomp
.
read
(
test
,
j
,
size
);
int
l
=
decomp
ress
.
read
(
test
,
j
,
size
);
if
(
l
<
0
)
{
break
;
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论