Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d92043cb
提交
d92043cb
authored
3月 03, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
When enabling autocommit, the transaction is now committed (as required by the JDBC API).
上级
c8631bc5
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
26 行增加
和
38 行删除
+26
-38
Session.java
h2/src/main/org/h2/engine/Session.java
+1
-4
SessionInterface.java
h2/src/main/org/h2/engine/SessionInterface.java
+2
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+23
-33
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
d92043cb
...
@@ -349,11 +349,8 @@ public class Session extends SessionWithState {
...
@@ -349,11 +349,8 @@ public class Session extends SessionWithState {
}
}
public
void
setAutoCommit
(
boolean
b
)
{
public
void
setAutoCommit
(
boolean
b
)
{
if
(
autoCommit
!=
b
)
{
commit
(
false
);
autoCommit
=
b
;
autoCommit
=
b
;
}
}
}
public
int
getLockTimeout
()
{
public
int
getLockTimeout
()
{
return
lockTimeout
;
return
lockTimeout
;
...
...
h2/src/main/org/h2/engine/SessionInterface.java
浏览文件 @
d92043cb
...
@@ -109,7 +109,8 @@ public interface SessionInterface extends Closeable {
...
@@ -109,7 +109,8 @@ public interface SessionInterface extends Closeable {
boolean
getAutoCommit
();
boolean
getAutoCommit
();
/**
/**
* Set the auto-commit mode.
* Set the auto-commit mode. This call doesn't commit the current
* transaction.
*
*
* @param autoCommit the new value
* @param autoCommit the new value
*/
*/
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
d92043cb
...
@@ -253,8 +253,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -253,8 +253,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*
*
* @param sql the SQL statement
* @param sql the SQL statement
* @return the prepared statement
* @return the prepared statement
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
PreparedStatement
prepareStatement
(
String
sql
)
throws
SQLException
{
public
PreparedStatement
prepareStatement
(
String
sql
)
throws
SQLException
{
try
{
try
{
...
@@ -297,8 +296,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -297,8 +296,7 @@ public class JdbcConnection extends TraceObject implements Connection {
* Gets the database meta data for this database.
* Gets the database meta data for this database.
*
*
* @return the database meta data
* @return the database meta data
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
DatabaseMetaData
getMetaData
()
throws
SQLException
{
public
DatabaseMetaData
getMetaData
()
throws
SQLException
{
try
{
try
{
...
@@ -393,13 +391,11 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -393,13 +391,11 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Switches auto commit on or off.
Calling this function does not commit the
* Switches auto commit on or off.
Enabling it commits an uncommitted
*
current transaction
.
*
transaction, if there is one
.
*
*
* @param autoCommit
* @param autoCommit true for auto commit on, false for off
* true for auto commit on, false for off
* @throws SQLException if the connection is closed
* @throws SQLException
* if the connection is closed
*/
*/
public
synchronized
void
setAutoCommit
(
boolean
autoCommit
)
throws
SQLException
{
public
synchronized
void
setAutoCommit
(
boolean
autoCommit
)
throws
SQLException
{
try
{
try
{
...
@@ -407,6 +403,9 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -407,6 +403,9 @@ public class JdbcConnection extends TraceObject implements Connection {
debugCode
(
"setAutoCommit("
+
autoCommit
+
");"
);
debugCode
(
"setAutoCommit("
+
autoCommit
+
");"
);
}
}
checkClosed
();
checkClosed
();
if
(
autoCommit
&&
!
session
.
getAutoCommit
())
{
commit
();
}
session
.
setAutoCommit
(
autoCommit
);
session
.
setAutoCommit
(
autoCommit
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -417,8 +416,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -417,8 +416,7 @@ public class JdbcConnection extends TraceObject implements Connection {
* Gets the current setting for auto commit.
* Gets the current setting for auto commit.
*
*
* @return true for on, false for off
* @return true for on, false for off
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
synchronized
boolean
getAutoCommit
()
throws
SQLException
{
public
synchronized
boolean
getAutoCommit
()
throws
SQLException
{
try
{
try
{
...
@@ -431,11 +429,10 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -431,11 +429,10 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Commits the current transaction. This call has only an effect if
* Commits the current transaction. This call has only an effect if
auto
*
auto
commit is switched off.
* commit is switched off.
*
*
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
synchronized
void
commit
()
throws
SQLException
{
public
synchronized
void
commit
()
throws
SQLException
{
try
{
try
{
...
@@ -453,11 +450,10 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -453,11 +450,10 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Rolls back the current transaction. This call has only an effect if
* Rolls back the current transaction. This call has only an effect if
auto
*
auto
commit is switched off.
* commit is switched off.
*
*
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
synchronized
void
rollback
()
throws
SQLException
{
public
synchronized
void
rollback
()
throws
SQLException
{
try
{
try
{
...
@@ -492,8 +488,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -492,8 +488,7 @@ public class JdbcConnection extends TraceObject implements Connection {
*
*
* @param sql the SQL statement with or without JDBC escape sequences
* @param sql the SQL statement with or without JDBC escape sequences
* @return the translated statement
* @return the translated statement
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
String
nativeSQL
(
String
sql
)
throws
SQLException
{
public
String
nativeSQL
(
String
sql
)
throws
SQLException
{
try
{
try
{
...
@@ -506,13 +501,11 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -506,13 +501,11 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* According to the JDBC specs, this
* According to the JDBC specs, this setting is only a hint to the database
* setting is only a hint to the database to enable optimizations - it does
* to enable optimizations - it does not cause writes to be prohibited.
* not cause writes to be prohibited.
*
*
* @param readOnly ignored
* @param readOnly ignored
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
void
setReadOnly
(
boolean
readOnly
)
throws
SQLException
{
public
void
setReadOnly
(
boolean
readOnly
)
throws
SQLException
{
try
{
try
{
...
@@ -529,8 +522,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -529,8 +522,7 @@ public class JdbcConnection extends TraceObject implements Connection {
* Returns true if the database is read-only.
* Returns true if the database is read-only.
*
*
* @return if the database is read-only
* @return if the database is read-only
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
boolean
isReadOnly
()
throws
SQLException
{
public
boolean
isReadOnly
()
throws
SQLException
{
try
{
try
{
...
@@ -547,8 +539,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -547,8 +539,7 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Set the default catalog name.
* Set the default catalog name. This call is ignored.
* This call is ignored.
*
*
* @param catalog ignored
* @param catalog ignored
* @throws SQLException if the connection is closed
* @throws SQLException if the connection is closed
...
@@ -807,8 +798,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -807,8 +798,7 @@ public class JdbcConnection extends TraceObject implements Connection {
* Gets the type map.
* Gets the type map.
*
*
* @return null
* @return null
* @throws SQLException
* @throws SQLException if the connection is closed
* if the connection is closed
*/
*/
public
Map
<
String
,
Class
<?>>
getTypeMap
()
throws
SQLException
{
public
Map
<
String
,
Class
<?>>
getTypeMap
()
throws
SQLException
{
try
{
try
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论