本文整理汇总了Java中java.sql.Savepoint.getSavepointName方法的典型用法代码示例。如果您正苦于以下问题:Java Savepoint.getSavepointName方法的具体用法?Java Savepoint.getSavepointName怎么用?Java Savepoint.getSavepointName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.Savepoint
的用法示例。
在下文中一共展示了Savepoint.getSavepointName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: releaseSavepoint
import java.sql.Savepoint; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
* Removes the given <code>Savepoint</code>
* object from the current transaction. Any reference to the
* savepoint after it have been removed will cause an
* <code>SQLException</code> to be thrown. <p>
*
* <!-- end generic documentation -->
*
* @param savepoint the <code>Savepoint</code> object to be removed
* @exception SQLException if a database access error occurs or
* the given <code>Savepoint</code> object is not a valid
* savepoint in the current transaction
*
* @see jdbcSavepoint
* @see java.sql.Savepoint
* @since JDK 1.4, HSQLDB 1.7.2
*/
//#ifdef JAVA4
public synchronized void releaseSavepoint(Savepoint savepoint)
throws SQLException {
String msg;
jdbcSavepoint sp;
Result req;
checkClosed();
if (savepoint == null) {
msg = "savepoint is null";
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT, msg);
}
// fredt - might someone call this with a Savepoint from a different driver???
if (!(savepoint instanceof jdbcSavepoint)) {
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT);
}
sp = (jdbcSavepoint) savepoint;
if (this != sp.connection) {
msg = savepoint.getSavepointName()
+ " was not issued on this connection";
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT, msg);
}
req = Result.newReleaseSavepointRequest(sp.name);
try {
Result result = sessionProxy.execute(req);
if (result.isError()) {
Util.throwError(result);
}
} catch (HsqlException e) {
Util.throwError(e);
}
}