提交 391f3743 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 8294e0f1
...@@ -353,6 +353,17 @@ This is achieved using different database URLs. The settings in the URLs are not ...@@ -353,6 +353,17 @@ This is achieved using different database URLs. The settings in the URLs are not
jdbc:h2:&lt;url&gt;;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws<br /> jdbc:h2:&lt;url&gt;;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws<br />
</td> </td>
</tr> </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:&lt;zipFileName&gt;!/&lt;databaseName&gt;<br />
jdbc:h2:zip:db.zip!/test
</td>
</tr>
<tr> <tr>
<td>Changing Other Settings</td> <td>Changing Other Settings</td>
<td> <td>
......
...@@ -33,7 +33,8 @@ import org.h2.message.Message; ...@@ -33,7 +33,8 @@ import org.h2.message.Message;
//#endif //#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 public class JdbcDataSource extends TraceObject implements
//#ifdef JDK14 //#ifdef JDK14
...@@ -45,7 +46,7 @@ Serializable, Referenceable { ...@@ -45,7 +46,7 @@ Serializable, Referenceable {
private transient JdbcDataSourceFactory factory; private transient JdbcDataSourceFactory factory;
private transient PrintWriter logWriter; private transient PrintWriter logWriter;
private int timeout; private int loginTimeout;
private String user = ""; private String user = "";
private String password = ""; private String password = "";
private String url = ""; private String url = "";
...@@ -54,6 +55,9 @@ Serializable, Referenceable { ...@@ -54,6 +55,9 @@ Serializable, Referenceable {
org.h2.Driver.load(); org.h2.Driver.load();
} }
/**
* Public constructor.
*/
public JdbcDataSource() { public JdbcDataSource() {
initFactory(); initFactory();
int id = getNextId(TraceObject.DATA_SOURCE); int id = getNextId(TraceObject.DATA_SOURCE);
...@@ -69,37 +73,72 @@ Serializable, Referenceable { ...@@ -69,37 +73,72 @@ Serializable, Referenceable {
factory = new JdbcDataSourceFactory(); factory = new JdbcDataSourceFactory();
} }
/**
* Get the login timeout in seconds, 0 meaning no timeout.
*
* @return the timeout in seconds
*/
public int getLoginTimeout() throws SQLException { public int getLoginTimeout() throws SQLException {
debugCodeCall("getLoginTimeout"); debugCodeCall("getLoginTimeout");
return timeout; return loginTimeout;
} }
/**
* 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 { public void setLoginTimeout(int timeout) throws SQLException {
debugCodeCall("setLoginTimeout", timeout); debugCodeCall("setLoginTimeout", timeout);
this.timeout = timeout; this.loginTimeout = timeout;
} }
/**
* Get the current log writer for this object.
*
* @return the log writer
*/
public PrintWriter getLogWriter() throws SQLException { public PrintWriter getLogWriter() throws SQLException {
debugCodeCall("getLogWriter"); debugCodeCall("getLogWriter");
return logWriter; 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 { public void setLogWriter(PrintWriter out) throws SQLException {
debugCodeCall("setLogWriter(out)"); debugCodeCall("setLogWriter(out)");
logWriter = out; logWriter = out;
} }
/**
* Open a new connection using the current URL, user name and password.
*
* @return the connection
*/
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
debugCodeCall("getConnection"); debugCodeCall("getConnection");
return getJdbcConnection(user, password); 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 { public Connection getConnection(String user, String password) throws SQLException {
debugCode("getConnection("+quote(user)+", "+quote(password)+");"); debugCode("getConnection("+quote(user)+", "+quote(password)+");");
return getJdbcConnection(user, password); return getJdbcConnection(user, password);
} }
public JdbcConnection getJdbcConnection(String user, String password) throws SQLException { private JdbcConnection getJdbcConnection(String user, String password) throws SQLException {
debugCode("getJdbcConnection("+quote(user)+", "+quote(password)+");"); debugCode("getJdbcConnection("+quote(user)+", "+quote(password)+");");
Properties info = new Properties(); Properties info = new Properties();
info.setProperty("user", user); info.setProperty("user", user);
...@@ -107,43 +146,79 @@ Serializable, Referenceable { ...@@ -107,43 +146,79 @@ Serializable, Referenceable {
return new JdbcConnection(url, info); return new JdbcConnection(url, info);
} }
/**
* Get the current URL.
*
* @return the URL
*/
public String getURL() { public String getURL() {
debugCodeCall("getURL"); debugCodeCall("getURL");
return url; return url;
} }
/**
* Set the current URL.
*
* @param url the new URL
*/
public void setURL(String url) { public void setURL(String url) {
debugCodeCall("setURL", url); debugCodeCall("setURL", url);
this.url = url; this.url = url;
} }
public String getPassword() { /**
debugCodeCall("getPassword"); * Set the current password
return password; *
} * @param password the new password.
*/
public void setPassword(String password) { public void setPassword(String password) {
debugCodeCall("setPassword", password); debugCodeCall("setPassword", password);
this.password = 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() { public String getUser() {
debugCodeCall("getUser"); debugCodeCall("getUser");
return user; return user;
} }
/**
* Set the current user name.
*
* @param user the new user name
*/
public void setUser(String user) { public void setUser(String user) {
debugCodeCall("setUser", user); debugCodeCall("setUser", user);
this.user = user; this.user = user;
} }
/**
* Get a new reference for this object, using the current settings.
*
* @return the new reference
*/
public Reference getReference() throws NamingException { public Reference getReference() throws NamingException {
debugCodeCall("getReference"); debugCodeCall("getReference");
String factoryClassName = JdbcDataSourceFactory.class.getName(); String factoryClassName = JdbcDataSourceFactory.class.getName();
Reference ref = new Reference(getClass().getName(), factoryClassName, null); Reference ref = new Reference(getClass().getName(), factoryClassName, null);
ref.add(new StringRefAddr("url", getURL())); ref.add(new StringRefAddr("url", url));
ref.add(new StringRefAddr("user", getUser())); ref.add(new StringRefAddr("user", user));
ref.add(new StringRefAddr("password", password)); ref.add(new StringRefAddr("password", password));
ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
return ref; return ref;
} }
......
...@@ -39,6 +39,8 @@ public class JdbcDataSourceFactory implements ObjectFactory { ...@@ -39,6 +39,8 @@ public class JdbcDataSourceFactory implements ObjectFactory {
dataSource.setURL((String) ref.get("url").getContent()); dataSource.setURL((String) ref.get("url").getContent());
dataSource.setUser((String) ref.get("user").getContent()); dataSource.setUser((String) ref.get("user").getContent());
dataSource.setPassword((String) ref.get("password").getContent()); dataSource.setPassword((String) ref.get("password").getContent());
String s = (String) ref.get("loginTimeout").getContent();
dataSource.setLoginTimeout(Integer.parseInt(s));
return dataSource; return dataSource;
} }
return null; return null;
......
...@@ -54,8 +54,7 @@ public class TableFilter implements ColumnResolver { ...@@ -54,8 +54,7 @@ public class TableFilter implements ColumnResolver {
private Row current; private Row current;
private int state; private int state;
private ObjectArray joins; private TableFilter join;
// private TableFilter join;
private boolean outerJoin; private boolean outerJoin;
private boolean foundOne; private boolean foundOne;
...@@ -82,15 +81,11 @@ public class TableFilter implements ColumnResolver { ...@@ -82,15 +81,11 @@ public class TableFilter implements ColumnResolver {
public void lock(Session session, boolean exclusive, boolean force) throws SQLException { public void lock(Session session, boolean exclusive, boolean force) throws SQLException {
table.lock(session, exclusive, force); table.lock(session, exclusive, force);
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
getTableFilter(i).lock(session, exclusive, force); join.lock(session, exclusive, force);
} }
} }
private TableFilter getTableFilter(int i) {
return (TableFilter) joins.get(i);
}
public PlanItem getBestPlanItem(Session session) throws SQLException { public PlanItem getBestPlanItem(Session session) throws SQLException {
PlanItem item; PlanItem item;
if (indexConditions.size() == 0) { if (indexConditions.size() == 0) {
...@@ -114,8 +109,7 @@ public class TableFilter implements ColumnResolver { ...@@ -114,8 +109,7 @@ public class TableFilter implements ColumnResolver {
} }
item = table.getBestPlanItem(session, masks); item = table.getBestPlanItem(session, masks);
} }
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
setEvaluatable(join); setEvaluatable(join);
item.setJoinPlan(join.getBestPlanItem(session)); item.setJoinPlan(join.getBestPlanItem(session));
// TODO optimizer: calculate cost of a join: should use separate // TODO optimizer: calculate cost of a join: should use separate
...@@ -138,8 +132,7 @@ public class TableFilter implements ColumnResolver { ...@@ -138,8 +132,7 @@ public class TableFilter implements ColumnResolver {
public void setPlanItem(PlanItem item) { public void setPlanItem(PlanItem item) {
setIndex(item.getIndex()); setIndex(item.getIndex());
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
if (item.getJoinPlan() != null) { if (item.getJoinPlan() != null) {
join.setPlanItem(item.getJoinPlan()); join.setPlanItem(item.getJoinPlan());
} }
...@@ -158,8 +151,7 @@ public class TableFilter implements ColumnResolver { ...@@ -158,8 +151,7 @@ public class TableFilter implements ColumnResolver {
} }
} }
} }
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
if (SysProperties.CHECK && join == this) { if (SysProperties.CHECK && join == this) {
throw Message.getInternalError("self join"); throw Message.getInternalError("self join");
} }
...@@ -176,15 +168,13 @@ public class TableFilter implements ColumnResolver { ...@@ -176,15 +168,13 @@ public class TableFilter implements ColumnResolver {
public void startQuery(Session session) throws SQLException { public void startQuery(Session session) throws SQLException {
this.session = session; this.session = session;
scanCount = 0; scanCount = 0;
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.startQuery(session); join.startQuery(session);
} }
} }
public void reset() { public void reset() {
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.reset(); join.reset();
} }
state = BEFORE_FIRST; state = BEFORE_FIRST;
...@@ -233,23 +223,14 @@ public class TableFilter implements ColumnResolver { ...@@ -233,23 +223,14 @@ public class TableFilter implements ColumnResolver {
} }
if (!alwaysFalse) { if (!alwaysFalse) {
cursor = index.find(session, start, end); cursor = index.find(session, start, end);
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.reset(); join.reset();
} }
} }
} else { } else {
// state == FOUND || LAST_ROW // state == FOUND || LAST_ROW
// the last row was ok - try next row of the join // the last row was ok - try next row of the join
boolean found = joins != null; if (join != null && join.next()) {
for (int i = 0; joins != null && i < joins.size(); i++) {
TableFilter join = getTableFilter(i);
if (!join.next()) {
found = false;
break;
}
}
if (found) {
return true; return true;
} }
} }
...@@ -290,13 +271,11 @@ public class TableFilter implements ColumnResolver { ...@@ -290,13 +271,11 @@ public class TableFilter implements ColumnResolver {
if (state == FOUND && joinConditionOk) { if (state == FOUND && joinConditionOk) {
foundOne = true; foundOne = true;
} }
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.reset(); join.reset();
} }
boolean doContinue = false; boolean doContinue = false;
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
if (!join.next()) { if (!join.next()) {
doContinue = true; doContinue = true;
} }
...@@ -376,16 +355,13 @@ public class TableFilter implements ColumnResolver { ...@@ -376,16 +355,13 @@ public class TableFilter implements ColumnResolver {
if (on != null) { if (on != null) {
on.mapColumns(this, 0); on.mapColumns(this, 0);
} }
if (joins == null) { if (join == null) {
this.joins = new ObjectArray(); this.join = filter;
joins.add(filter);
filter.outerJoin = outer; filter.outerJoin = outer;
if (on != null) { if (on != null) {
filter.mapAndAddFilter(on); filter.mapAndAddFilter(on);
} }
} else { } else {
int todoAddJoinNestedOrSameLevel;
TableFilter join = getTableFilter(0);
join.addJoin(filter, outer, on); join.addJoin(filter, outer, on);
} }
} }
...@@ -394,15 +370,13 @@ public class TableFilter implements ColumnResolver { ...@@ -394,15 +370,13 @@ public class TableFilter implements ColumnResolver {
on.mapColumns(this, 0); on.mapColumns(this, 0);
addFilterCondition(on, true); addFilterCondition(on, true);
on.createIndexConditions(session, this); on.createIndexConditions(session, this);
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.mapAndAddFilter(on); join.mapAndAddFilter(on);
} }
} }
public TableFilter getJoin() { public TableFilter getJoin() {
int todoGetJoin; return join;
return joins == null ? null : getTableFilter(0);
} }
public boolean isJoinOuter() { public boolean isJoinOuter() {
...@@ -495,8 +469,7 @@ public class TableFilter implements ColumnResolver { ...@@ -495,8 +469,7 @@ public class TableFilter implements ColumnResolver {
} }
public void removeJoin() { public void removeJoin() {
int todoRemoveJoin; this.join = null;
this.joins = null;
} }
public Expression getJoinCondition() { public Expression getJoinCondition() {
...@@ -517,8 +490,7 @@ public class TableFilter implements ColumnResolver { ...@@ -517,8 +490,7 @@ public class TableFilter implements ColumnResolver {
public void setFullCondition(Expression condition) { public void setFullCondition(Expression condition) {
this.fullCondition = condition; this.fullCondition = condition;
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.setFullCondition(condition); join.setFullCondition(condition);
} }
} }
...@@ -526,8 +498,7 @@ public class TableFilter implements ColumnResolver { ...@@ -526,8 +498,7 @@ public class TableFilter implements ColumnResolver {
public void optimizeFullCondition(boolean fromOuterJoin) { public void optimizeFullCondition(boolean fromOuterJoin) {
if (fullCondition != null) { if (fullCondition != null) {
fullCondition.addFilterConditions(this, fromOuterJoin || outerJoin); fullCondition.addFilterConditions(this, fromOuterJoin || outerJoin);
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.optimizeFullCondition(fromOuterJoin || outerJoin); join.optimizeFullCondition(fromOuterJoin || outerJoin);
} }
} }
...@@ -540,8 +511,7 @@ public class TableFilter implements ColumnResolver { ...@@ -540,8 +511,7 @@ public class TableFilter implements ColumnResolver {
if (joinCondition != null) { if (joinCondition != null) {
joinCondition.setEvaluatable(filter, b); joinCondition.setEvaluatable(filter, b);
} }
for (int i = 0; joins != null && i < joins.size(); i++) { if (join != null) {
TableFilter join = getTableFilter(i);
join.setEvaluatable(filter, b); join.setEvaluatable(filter, b);
} }
} }
......
...@@ -47,6 +47,7 @@ import org.h2.test.db.TestTransaction; ...@@ -47,6 +47,7 @@ import org.h2.test.db.TestTransaction;
import org.h2.test.db.TestTriggersConstraints; import org.h2.test.db.TestTriggersConstraints;
import org.h2.test.db.TestTwoPhaseCommit; import org.h2.test.db.TestTwoPhaseCommit;
import org.h2.test.db.TestView; import org.h2.test.db.TestView;
import org.h2.test.jdbc.TestCallableStatement;
import org.h2.test.jdbc.TestCancel; import org.h2.test.jdbc.TestCancel;
import org.h2.test.jdbc.TestDataSource; import org.h2.test.jdbc.TestDataSource;
import org.h2.test.jdbc.TestDatabaseEventListener; import org.h2.test.jdbc.TestDatabaseEventListener;
...@@ -148,16 +149,10 @@ java org.h2.test.TestAll timer ...@@ -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 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 that writes to two file systems (for replication)
Feature request: file system with background thread writing file system (all writes) Feature request: file system with background thread writing file system (all writes)
...@@ -602,6 +597,7 @@ Features of H2 ...@@ -602,6 +597,7 @@ Features of H2
new TestPgServer().runTest(this); new TestPgServer().runTest(this);
// jdbc // jdbc
new TestCallableStatement().runTest(this);
new TestCancel().runTest(this); new TestCancel().runTest(this);
new TestDatabaseEventListener().runTest(this); new TestDatabaseEventListener().runTest(this);
new TestDataSource().runTest(this); new TestDataSource().runTest(this);
......
/*
* 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());
}
}
...@@ -63,6 +63,7 @@ public class TestMetaData extends TestBase { ...@@ -63,6 +63,7 @@ public class TestMetaData extends TestBase {
checkFalse(rs.next()); checkFalse(rs.next());
rs = meta.getTables(null, Constants.SCHEMA_MAIN, null, new String[] { "TABLE" }); rs = meta.getTables(null, Constants.SCHEMA_MAIN, null, new String[] { "TABLE" });
check(rs.getStatement() == null);
rs.next(); rs.next();
check(rs.getString("TABLE_NAME"), "TEST"); check(rs.getString("TABLE_NAME"), "TEST");
checkFalse(rs.next()); checkFalse(rs.next());
......
...@@ -53,6 +53,7 @@ public class TestResultSet extends TestBase { ...@@ -53,6 +53,7 @@ public class TestResultSet extends TestBase {
testBlob(); testBlob();
testClob(); testClob();
testAutoIncrement(); testAutoIncrement();
testSerialize();
conn.close(); conn.close();
...@@ -60,7 +61,11 @@ public class TestResultSet extends TestBase { ...@@ -60,7 +61,11 @@ public class TestResultSet extends TestBase {
private void testColumnLength() throws Exception { private void testColumnLength() throws Exception {
trace("Test ColumnLength"); trace("Test ColumnLength");
int todo;
}
private void testSerialize() throws Exception {
int todo;
} }
private void testLimitMaxRows() throws Exception { private void testLimitMaxRows() throws Exception {
......
...@@ -10,6 +10,7 @@ import java.sql.SQLException; ...@@ -10,6 +10,7 @@ import java.sql.SQLException;
import java.sql.Savepoint; import java.sql.Savepoint;
import java.sql.Statement; import java.sql.Statement;
import org.h2.jdbc.JdbcStatement;
import org.h2.test.TestBase; import org.h2.test.TestBase;
public class TestStatement extends TestBase { public class TestStatement extends TestBase {
...@@ -22,6 +23,7 @@ public class TestStatement extends TestBase { ...@@ -22,6 +23,7 @@ public class TestStatement extends TestBase {
if (config.jdk14) { if (config.jdk14) {
testSavepoint(); testSavepoint();
} }
testConnectionRollback();
testStatement(); testStatement();
if (config.jdk14) { if (config.jdk14) {
testIdentity(); testIdentity();
...@@ -29,6 +31,18 @@ public class TestStatement extends TestBase { ...@@ -29,6 +31,18 @@ public class TestStatement extends TestBase {
conn.close(); 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 { void testSavepoint() throws Exception {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
...@@ -86,6 +100,36 @@ public class TestStatement extends TestBase { ...@@ -86,6 +100,36 @@ public class TestStatement extends TestBase {
void testStatement() throws Exception { void testStatement() throws Exception {
Statement stat = conn.createStatement(); 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; ResultSet rs;
int count; int count;
boolean result; boolean result;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论