Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
391f3743
提交
391f3743
authored
11月 09, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
8294e0f1
全部展开
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
1143 行增加
和
1057 行删除
+1143
-1057
features.html
h2/src/docsrc/html/features.html
+11
-0
_docs_de.utf8.txt
h2/src/docsrc/text/_docs_de.utf8.txt
+233
-275
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+233
-218
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+233
-275
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+221
-216
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+88
-13
JdbcDataSourceFactory.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
+2
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+20
-50
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+5
-9
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+46
-0
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+1
-0
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+6
-1
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+44
-0
没有找到文件。
h2/src/docsrc/html/features.html
浏览文件 @
391f3743
...
...
@@ -353,6 +353,17 @@ This is achieved using different database URLs. The settings in the URLs are not
jdbc:h2:
<
url
>
;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws
<br
/>
</td>
</tr>
<tr>
<td>
In-Memory (private)
</td>
<td>
jdbc:h2:mem:
</td>
</tr>
<tr>
<td>
Database in Jar or Zip File
</td>
<td>
jdbc:h2:zip:
<
zipFileName
>
!/
<
databaseName
>
<br
/>
jdbc:h2:zip:db.zip!/test
</td>
</tr>
<tr>
<td>
Changing Other Settings
</td>
<td>
...
...
h2/src/docsrc/text/_docs_de.utf8.txt
浏览文件 @
391f3743
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
391f3743
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
391f3743
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
391f3743
差异被折叠。
点击展开。
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
391f3743
...
...
@@ -33,7 +33,8 @@ import org.h2.message.Message;
//#endif
/**
* A data source for H2 database connections
* A data source for H2 database connections. It is a factory for XAConnection and Connection objects.
* This class is usually registered in a JNDI naming service.
*/
public
class
JdbcDataSource
extends
TraceObject
implements
//#ifdef JDK14
...
...
@@ -45,7 +46,7 @@ Serializable, Referenceable {
private
transient
JdbcDataSourceFactory
factory
;
private
transient
PrintWriter
logWriter
;
private
int
t
imeout
;
private
int
loginT
imeout
;
private
String
user
=
""
;
private
String
password
=
""
;
private
String
url
=
""
;
...
...
@@ -54,6 +55,9 @@ Serializable, Referenceable {
org
.
h2
.
Driver
.
load
();
}
/**
* Public constructor.
*/
public
JdbcDataSource
()
{
initFactory
();
int
id
=
getNextId
(
TraceObject
.
DATA_SOURCE
);
...
...
@@ -69,37 +73,72 @@ Serializable, Referenceable {
factory
=
new
JdbcDataSourceFactory
();
}
/**
* Get the login timeout in seconds, 0 meaning no timeout.
*
* @return the timeout in seconds
*/
public
int
getLoginTimeout
()
throws
SQLException
{
debugCodeCall
(
"getLoginTimeout"
);
return
t
imeout
;
return
loginT
imeout
;
}
/**
* Set the login timeout in seconds, 0 meaning no timeout.
* The default value is 0.
* This value is ignored by this database.
*
* @param timeout the timeout in seconds
*/
public
void
setLoginTimeout
(
int
timeout
)
throws
SQLException
{
debugCodeCall
(
"setLoginTimeout"
,
timeout
);
this
.
t
imeout
=
timeout
;
this
.
loginT
imeout
=
timeout
;
}
/**
* Get the current log writer for this object.
*
* @return the log writer
*/
public
PrintWriter
getLogWriter
()
throws
SQLException
{
debugCodeCall
(
"getLogWriter"
);
return
logWriter
;
}
/**
* Set the current log writer for this object.
* This value is ignored by this database.
*
* @param out the log writer
*/
public
void
setLogWriter
(
PrintWriter
out
)
throws
SQLException
{
debugCodeCall
(
"setLogWriter(out)"
);
logWriter
=
out
;
}
/**
* Open a new connection using the current URL, user name and password.
*
* @return the connection
*/
public
Connection
getConnection
()
throws
SQLException
{
debugCodeCall
(
"getConnection"
);
return
getJdbcConnection
(
user
,
password
);
}
/**
* Open a new connection using the current URL and the specified user name and password.
*
* @param the user name
* @param the password
* @return the connection
*/
public
Connection
getConnection
(
String
user
,
String
password
)
throws
SQLException
{
debugCode
(
"getConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
return
getJdbcConnection
(
user
,
password
);
}
p
ublic
JdbcConnection
getJdbcConnection
(
String
user
,
String
password
)
throws
SQLException
{
p
rivate
JdbcConnection
getJdbcConnection
(
String
user
,
String
password
)
throws
SQLException
{
debugCode
(
"getJdbcConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
Properties
info
=
new
Properties
();
info
.
setProperty
(
"user"
,
user
);
...
...
@@ -107,43 +146,79 @@ Serializable, Referenceable {
return
new
JdbcConnection
(
url
,
info
);
}
/**
* Get the current URL.
*
* @return the URL
*/
public
String
getURL
()
{
debugCodeCall
(
"getURL"
);
return
url
;
}
/**
* Set the current URL.
*
* @param url the new URL
*/
public
void
setURL
(
String
url
)
{
debugCodeCall
(
"setURL"
,
url
);
this
.
url
=
url
;
}
public
String
getPassword
()
{
debugCodeCall
(
"getPassword"
);
return
password
;
}
/**
* Set the current password
*
* @param password the new password.
*/
public
void
setPassword
(
String
password
)
{
debugCodeCall
(
"setPassword"
,
password
);
this
.
password
=
password
;
}
/**
* Get the current password.
*
* @return the password
*/
public
String
getPassword
()
{
debugCodeCall
(
"getPassword"
);
return
password
;
}
/**
* Get the current user name.
*
* @return the user name
*/
public
String
getUser
()
{
debugCodeCall
(
"getUser"
);
return
user
;
}
/**
* Set the current user name.
*
* @param user the new user name
*/
public
void
setUser
(
String
user
)
{
debugCodeCall
(
"setUser"
,
user
);
this
.
user
=
user
;
}
/**
* Get a new reference for this object, using the current settings.
*
* @return the new reference
*/
public
Reference
getReference
()
throws
NamingException
{
debugCodeCall
(
"getReference"
);
String
factoryClassName
=
JdbcDataSourceFactory
.
class
.
getName
();
Reference
ref
=
new
Reference
(
getClass
().
getName
(),
factoryClassName
,
null
);
ref
.
add
(
new
StringRefAddr
(
"url"
,
getURL
()
));
ref
.
add
(
new
StringRefAddr
(
"user"
,
getUser
()
));
ref
.
add
(
new
StringRefAddr
(
"url"
,
url
));
ref
.
add
(
new
StringRefAddr
(
"user"
,
user
));
ref
.
add
(
new
StringRefAddr
(
"password"
,
password
));
ref
.
add
(
new
StringRefAddr
(
"loginTimeout"
,
String
.
valueOf
(
loginTimeout
)));
return
ref
;
}
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
浏览文件 @
391f3743
...
...
@@ -39,6 +39,8 @@ public class JdbcDataSourceFactory implements ObjectFactory {
dataSource
.
setURL
((
String
)
ref
.
get
(
"url"
).
getContent
());
dataSource
.
setUser
((
String
)
ref
.
get
(
"user"
).
getContent
());
dataSource
.
setPassword
((
String
)
ref
.
get
(
"password"
).
getContent
());
String
s
=
(
String
)
ref
.
get
(
"loginTimeout"
).
getContent
();
dataSource
.
setLoginTimeout
(
Integer
.
parseInt
(
s
));
return
dataSource
;
}
return
null
;
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
391f3743
...
...
@@ -54,8 +54,7 @@ public class TableFilter implements ColumnResolver {
private
Row
current
;
private
int
state
;
private
ObjectArray
joins
;
// private TableFilter join;
private
TableFilter
join
;
private
boolean
outerJoin
;
private
boolean
foundOne
;
...
...
@@ -82,15 +81,11 @@ public class TableFilter implements ColumnResolver {
public
void
lock
(
Session
session
,
boolean
exclusive
,
boolean
force
)
throws
SQLException
{
table
.
lock
(
session
,
exclusive
,
force
);
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++
)
{
getTableFilter
(
i
)
.
lock
(
session
,
exclusive
,
force
);
if
(
join
!=
null
)
{
join
.
lock
(
session
,
exclusive
,
force
);
}
}
private
TableFilter
getTableFilter
(
int
i
)
{
return
(
TableFilter
)
joins
.
get
(
i
);
}
public
PlanItem
getBestPlanItem
(
Session
session
)
throws
SQLException
{
PlanItem
item
;
if
(
indexConditions
.
size
()
==
0
)
{
...
...
@@ -114,8 +109,7 @@ public class TableFilter implements ColumnResolver {
}
item
=
table
.
getBestPlanItem
(
session
,
masks
);
}
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
setEvaluatable
(
join
);
item
.
setJoinPlan
(
join
.
getBestPlanItem
(
session
));
// TODO optimizer: calculate cost of a join: should use separate
...
...
@@ -138,8 +132,7 @@ public class TableFilter implements ColumnResolver {
public
void
setPlanItem
(
PlanItem
item
)
{
setIndex
(
item
.
getIndex
());
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
if
(
item
.
getJoinPlan
()
!=
null
)
{
join
.
setPlanItem
(
item
.
getJoinPlan
());
}
...
...
@@ -158,8 +151,7 @@ public class TableFilter implements ColumnResolver {
}
}
}
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
if
(
SysProperties
.
CHECK
&&
join
==
this
)
{
throw
Message
.
getInternalError
(
"self join"
);
}
...
...
@@ -176,15 +168,13 @@ public class TableFilter implements ColumnResolver {
public
void
startQuery
(
Session
session
)
throws
SQLException
{
this
.
session
=
session
;
scanCount
=
0
;
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
startQuery
(
session
);
}
}
public
void
reset
()
{
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
reset
();
}
state
=
BEFORE_FIRST
;
...
...
@@ -233,23 +223,14 @@ public class TableFilter implements ColumnResolver {
}
if
(!
alwaysFalse
)
{
cursor
=
index
.
find
(
session
,
start
,
end
);
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
reset
();
}
}
}
else
{
// state == FOUND || LAST_ROW
// the last row was ok - try next row of the join
boolean
found
=
joins
!=
null
;
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(!
join
.
next
())
{
found
=
false
;
break
;
}
}
if
(
found
)
{
if
(
join
!=
null
&&
join
.
next
())
{
return
true
;
}
}
...
...
@@ -290,13 +271,11 @@ public class TableFilter implements ColumnResolver {
if
(
state
==
FOUND
&&
joinConditionOk
)
{
foundOne
=
true
;
}
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
reset
();
}
boolean
doContinue
=
false
;
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
if
(!
join
.
next
())
{
doContinue
=
true
;
}
...
...
@@ -376,16 +355,13 @@ public class TableFilter implements ColumnResolver {
if
(
on
!=
null
)
{
on
.
mapColumns
(
this
,
0
);
}
if
(
joins
==
null
)
{
this
.
joins
=
new
ObjectArray
();
joins
.
add
(
filter
);
if
(
join
==
null
)
{
this
.
join
=
filter
;
filter
.
outerJoin
=
outer
;
if
(
on
!=
null
)
{
filter
.
mapAndAddFilter
(
on
);
}
}
else
{
int
todoAddJoinNestedOrSameLevel
;
TableFilter
join
=
getTableFilter
(
0
);
join
.
addJoin
(
filter
,
outer
,
on
);
}
}
...
...
@@ -394,15 +370,13 @@ public class TableFilter implements ColumnResolver {
on
.
mapColumns
(
this
,
0
);
addFilterCondition
(
on
,
true
);
on
.
createIndexConditions
(
session
,
this
);
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
mapAndAddFilter
(
on
);
}
}
public
TableFilter
getJoin
()
{
int
todoGetJoin
;
return
joins
==
null
?
null
:
getTableFilter
(
0
);
return
join
;
}
public
boolean
isJoinOuter
()
{
...
...
@@ -495,8 +469,7 @@ public class TableFilter implements ColumnResolver {
}
public
void
removeJoin
()
{
int
todoRemoveJoin
;
this
.
joins
=
null
;
this
.
join
=
null
;
}
public
Expression
getJoinCondition
()
{
...
...
@@ -517,8 +490,7 @@ public class TableFilter implements ColumnResolver {
public
void
setFullCondition
(
Expression
condition
)
{
this
.
fullCondition
=
condition
;
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
setFullCondition
(
condition
);
}
}
...
...
@@ -526,8 +498,7 @@ public class TableFilter implements ColumnResolver {
public
void
optimizeFullCondition
(
boolean
fromOuterJoin
)
{
if
(
fullCondition
!=
null
)
{
fullCondition
.
addFilterConditions
(
this
,
fromOuterJoin
||
outerJoin
);
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
optimizeFullCondition
(
fromOuterJoin
||
outerJoin
);
}
}
...
...
@@ -540,8 +511,7 @@ public class TableFilter implements ColumnResolver {
if
(
joinCondition
!=
null
)
{
joinCondition
.
setEvaluatable
(
filter
,
b
);
}
for
(
int
i
=
0
;
joins
!=
null
&&
i
<
joins
.
size
();
i
++)
{
TableFilter
join
=
getTableFilter
(
i
);
if
(
join
!=
null
)
{
join
.
setEvaluatable
(
filter
,
b
);
}
}
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
391f3743
...
...
@@ -47,6 +47,7 @@ import org.h2.test.db.TestTransaction;
import
org.h2.test.db.TestTriggersConstraints
;
import
org.h2.test.db.TestTwoPhaseCommit
;
import
org.h2.test.db.TestView
;
import
org.h2.test.jdbc.TestCallableStatement
;
import
org.h2.test.jdbc.TestCancel
;
import
org.h2.test.jdbc.TestDataSource
;
import
org.h2.test.jdbc.TestDatabaseEventListener
;
...
...
@@ -148,16 +149,10 @@ java org.h2.test.TestAll timer
/*
Compile and include FullTextLucene.java
start writing javadocs for jdbcx package
toString() method to print something useful
getDisplaySize
"The display size gives you the limit for how many characters normally fit in a specified column"
start writing javadocs for jdbcx package
Feature request: file system that writes to two file systems (for replication)
Feature request: file system with background thread writing file system (all writes)
...
...
@@ -602,6 +597,7 @@ Features of H2
new
TestPgServer
().
runTest
(
this
);
// jdbc
new
TestCallableStatement
().
runTest
(
this
);
new
TestCancel
().
runTest
(
this
);
new
TestDatabaseEventListener
().
runTest
(
this
);
new
TestDataSource
().
runTest
(
this
);
...
...
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
0 → 100644
浏览文件 @
391f3743
/*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
jdbc
;
import
java.sql.CallableStatement
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
public
class
TestCallableStatement
extends
TestBase
{
public
void
test
()
throws
Exception
{
deleteDb
(
"callableStatement"
);
Connection
conn
=
getConnection
(
"preparedStatement"
);
testPrepare
(
conn
);
conn
.
close
();
}
private
void
testPrepare
(
Connection
conn
)
throws
Exception
{
Statement
stat
=
conn
.
createStatement
();
CallableStatement
call
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR)"
);
call
=
conn
.
prepareCall
(
"INSERT INTO TEST VALUES(?, ?)"
);
call
.
setInt
(
1
,
1
);
call
.
setString
(
2
,
"Hello"
);
call
.
execute
();
call
=
conn
.
prepareCall
(
"SELECT * FROM TEST"
,
ResultSet
.
TYPE_FORWARD_ONLY
,
ResultSet
.
CONCUR_READ_ONLY
);
rs
=
call
.
executeQuery
();
rs
.
next
();
check
(
1
,
rs
.
getInt
(
1
));
check
(
"Hello"
,
rs
.
getString
(
2
));
checkFalse
(
rs
.
next
());
call
=
conn
.
prepareCall
(
"SELECT * FROM TEST"
,
ResultSet
.
TYPE_FORWARD_ONLY
,
ResultSet
.
CONCUR_READ_ONLY
,
ResultSet
.
HOLD_CURSORS_OVER_COMMIT
);
rs
=
call
.
executeQuery
();
rs
.
next
();
check
(
1
,
rs
.
getInt
(
1
));
check
(
"Hello"
,
rs
.
getString
(
2
));
checkFalse
(
rs
.
next
());
}
}
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
391f3743
...
...
@@ -63,6 +63,7 @@ public class TestMetaData extends TestBase {
checkFalse
(
rs
.
next
());
rs
=
meta
.
getTables
(
null
,
Constants
.
SCHEMA_MAIN
,
null
,
new
String
[]
{
"TABLE"
});
check
(
rs
.
getStatement
()
==
null
);
rs
.
next
();
check
(
rs
.
getString
(
"TABLE_NAME"
),
"TEST"
);
checkFalse
(
rs
.
next
());
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
391f3743
...
...
@@ -53,6 +53,7 @@ public class TestResultSet extends TestBase {
testBlob
();
testClob
();
testAutoIncrement
();
testSerialize
();
conn
.
close
();
...
...
@@ -60,7 +61,11 @@ public class TestResultSet extends TestBase {
private
void
testColumnLength
()
throws
Exception
{
trace
(
"Test ColumnLength"
);
int
todo
;
}
private
void
testSerialize
()
throws
Exception
{
int
todo
;
}
private
void
testLimitMaxRows
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
391f3743
...
...
@@ -10,6 +10,7 @@ import java.sql.SQLException;
import
java.sql.Savepoint
;
import
java.sql.Statement
;
import
org.h2.jdbc.JdbcStatement
;
import
org.h2.test.TestBase
;
public
class
TestStatement
extends
TestBase
{
...
...
@@ -22,6 +23,7 @@ public class TestStatement extends TestBase {
if
(
config
.
jdk14
)
{
testSavepoint
();
}
testConnectionRollback
();
testStatement
();
if
(
config
.
jdk14
)
{
testIdentity
();
...
...
@@ -29,6 +31,18 @@ public class TestStatement extends TestBase {
conn
.
close
();
}
private
void
testConnectionRollback
()
throws
Exception
{
Statement
stat
=
conn
.
createStatement
();
conn
.
setAutoCommit
(
false
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
conn
.
rollback
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
checkFalse
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
conn
.
setAutoCommit
(
true
);
}
void
testSavepoint
()
throws
Exception
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"
);
...
...
@@ -86,6 +100,36 @@ public class TestStatement extends TestBase {
void
testStatement
()
throws
Exception
{
Statement
stat
=
conn
.
createStatement
();
//#ifdef JDK14
check
(
ResultSet
.
HOLD_CURSORS_OVER_COMMIT
,
conn
.
getHoldability
());
conn
.
setHoldability
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
);
check
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
,
conn
.
getHoldability
());
//#endif
// ignored
stat
.
setCursorName
(
"x"
);
// fixed return value
check
(
stat
.
getFetchDirection
(),
ResultSet
.
FETCH_FORWARD
);
// ignored
stat
.
setFetchDirection
(
ResultSet
.
FETCH_REVERSE
);
// ignored
stat
.
setMaxFieldSize
(
100
);
check
(
0
,
stat
.
getFetchSize
());
stat
.
setFetchSize
(
10
);
check
(
10
,
stat
.
getFetchSize
());
check
(
ResultSet
.
TYPE_FORWARD_ONLY
,
stat
.
getResultSetType
());
Statement
stat2
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_SENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
,
ResultSet
.
HOLD_CURSORS_OVER_COMMIT
);
check
(
ResultSet
.
TYPE_SCROLL_SENSITIVE
,
stat2
.
getResultSetType
());
check
(
ResultSet
.
HOLD_CURSORS_OVER_COMMIT
,
stat2
.
getResultSetHoldability
());
check
(
ResultSet
.
CONCUR_UPDATABLE
,
stat2
.
getResultSetConcurrency
());
check
(
0
,
stat
.
getMaxFieldSize
());
check
(!((
JdbcStatement
)
stat2
).
isClosed
());
stat2
.
close
();
check
(((
JdbcStatement
)
stat2
).
isClosed
());
ResultSet
rs
;
int
count
;
boolean
result
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论