当前位置: 首页>>代码示例>>Java>>正文


Java Savepoint类代码示例

本文整理汇总了Java中java.sql.Savepoint的典型用法代码示例。如果您正苦于以下问题:Java Savepoint类的具体用法?Java Savepoint怎么用?Java Savepoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Savepoint类属于java.sql包,在下文中一共展示了Savepoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * @see Connection#setSavepoint(String)
 */
public java.sql.Savepoint setSavepoint(String arg0) throws SQLException {
    checkClosed();

    if (isInGlobalTx()) {
        throw SQLError.createSQLException("Can't set autocommit to 'true' on an XAConnection", SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION,
                MysqlErrorNumbers.ER_XA_RMERR, this.exceptionInterceptor);
    }

    try {
        return this.mc.setSavepoint(arg0);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // we don't reach this code, compiler can't tell
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:20,代码来源:ConnectionWrapper.java

示例2: put

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * Stores the Savepoint in static for username + connectionId
 * 
 * @param savepoint
 *            the Savepoint to store
 */
public void put(Savepoint savepoint) {

	debug("Creating a Savepoint for user: " + connectionKey);
	if (savepoint == null) {
		throw new IllegalArgumentException("savepoint is null!");
	}

	Set<Savepoint> savepointSet = savepointMap.get(connectionKey);
	if (savepointSet == null) {
		savepointSet = new LinkedHashSet<Savepoint>();
	}

	savepointSet.add(savepoint);
	savepointMap.put(connectionKey, savepointSet);
}
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:22,代码来源:ConnectionStore.java

示例3: beginTransaction

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * Begins a transaction on the current database;
 * 
 * @return
 * @throws SQLException
 */
public synchronized Savepoint beginTransaction() throws SQLException {
	if (this.transaction_connection != null)
		throw new RuntimeException("Another transaction is already running: " + transaction_savepoint);

	this.transaction_connection = popConnection();
	this.transaction_connection.setAutoCommit(false);
	this.transaction_savepoint = this.transaction_connection.setSavepoint();
	return this.transaction_savepoint;
}
 
开发者ID:EixoX,项目名称:jetfuel,代码行数:16,代码来源:Database.java

示例4: testRollback

import java.sql.Savepoint; //导入依赖的package包/类
@Test
public void testRollback() throws Exception
{
	thrown.expect(SQLFeatureNotSupportedException.class);
	AbstractCloudSpannerConnection testSubject;
	Savepoint savepoint = null;

	// default test
	testSubject = createTestSubject();
	testSubject.rollback(savepoint);
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:12,代码来源:AbstractCloudSpannerConnectionTest.java

示例5: commit

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * See {@link DatabaseConnection#commit(Savepoint)}
 */
public void commit(Class<?> type, Savepoint savepoint) {
    try {
        String tableName = getDao(type).getTableName();
        getConnectionSource().getReadWriteConnection(tableName).commit(savepoint);
    } catch (SQLException e) {
        throw new Panic(e);
    }
}
 
开发者ID:worldiety,项目名称:homunculus,代码行数:12,代码来源:ORMLiteEntityManager.java

示例6: setSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * @see Connection#setSavepoint()
 */
public java.sql.Savepoint setSavepoint() throws SQLException {
    MysqlSavepoint savepoint = new MysqlSavepoint(getExceptionInterceptor());

    setSavepoint(savepoint);

    return savepoint;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:ConnectionImpl.java

示例7: setSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
public Savepoint setSavepoint(String name) throws SQLException
{
	try
	{
		return realConnection.setSavepoint(name);
	}
	catch(SQLException s)
	{
		String methodCall = "setSavepoint(" + name + ")";
		reportException(methodCall, s, null);
		throw s;
	}
}
 
开发者ID:skeychen,项目名称:dswork.jdbc,代码行数:14,代码来源:ConnectionSpy.java

示例8: setSavePoint

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * 用于在事务中设置一个保存点,属于线程安全的
 */
public static void setSavePoint() {
    Connection connection = tl_conn.get();
    if (connection == null) {
        throw new RuntimeException("You do not start a Transaction so you can not set a savepoint!");
    }
    try {
        Stack<Savepoint> stack_sp = tl_sp.get();
        Savepoint sp = connection.setSavepoint();
        stack_sp.push(sp);
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:FlyingHe,项目名称:UtilsMaven,代码行数:17,代码来源:JDBCUtils.java

示例9: releaseSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * @see Connection#releaseSavepoint(Savepoint)
 */
public void releaseSavepoint(Savepoint arg0) throws SQLException {
    checkClosed();

    try {
        this.mc.releaseSavepoint(arg0);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:13,代码来源:ConnectionWrapper.java

示例10: releaseSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
public void releaseSavepoint(Savepoint savepoint) throws SQLException
{
	try
	{
		realConnection.releaseSavepoint(savepoint);
	}
	catch(SQLException s)
	{
		String methodCall = "releaseSavepoint(" + savepoint + ")";
		reportException(methodCall, s, null);
		throw s;
	}
}
 
开发者ID:skeychen,项目名称:dswork.jdbc,代码行数:14,代码来源:ConnectionSpy.java

示例11: newNodeImplInsert

import java.sql.Savepoint; //导入依赖的package包/类
protected Long newNodeImplInsert(NodeEntity node)
{
    Long id = null;
    Savepoint savepoint = controlDAO.createSavepoint("newNodeImpl");
    try
    {
        // First try a straight insert and risk the constraint violation if the node exists
        id = insertNode(node);
        controlDAO.releaseSavepoint(savepoint);
    }
    catch (Throwable e)
    {
        controlDAO.rollbackToSavepoint(savepoint);
        // This is probably because there is an existing node.  We can handle existing deleted nodes.
        NodeRef targetNodeRef = node.getNodeRef();
        Node dbTargetNode = selectNodeByNodeRef(targetNodeRef);
        if (dbTargetNode == null)
        {
            // There does not appear to be any row that could prevent an insert
            throw new AlfrescoRuntimeException("Failed to insert new node: " + node, e);
        }
        else if (dbTargetNode.getDeleted(qnameDAO))
        {
            Long dbTargetNodeId = dbTargetNode.getId();
            // This is OK.  It happens when we create a node that existed in the past.
            // Remove the row completely
            deleteNodeProperties(dbTargetNodeId, (Set<Long>) null);
            deleteNodeById(dbTargetNodeId);
            // Now repeat the insert but let any further problems just be thrown out
            id = insertNode(node);
        }
        else
        {
            // A live node exists.
            throw new NodeExistsException(dbTargetNode.getNodePair(), e);
        }
    }
    
    return id;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:AbstractNodeDAOImpl.java

示例12: rollback

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * See {@link DatabaseConnection#rollback(Savepoint)}
 */
public void rollback(Class<?> type, Savepoint savepoint) {
    try {
        String tableName = getDao(type).getTableName();
        getConnectionSource().getReadWriteConnection(tableName).rollback(savepoint);
    } catch (SQLException e) {
        throw new Panic(e);
    }
}
 
开发者ID:worldiety,项目名称:homunculus,代码行数:12,代码来源:ORMLiteEntityManager.java

示例13: rollback

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * @see Connection#rollback(Savepoint)
 */
public void rollback(Savepoint arg0) throws SQLException {
    checkClosed();

    if (isInGlobalTx()) {
        throw SQLError.createSQLException("Can't call rollback() on an XAConnection associated with a global transaction",
                SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION, MysqlErrorNumbers.ER_XA_RMERR, this.exceptionInterceptor);
    }

    try {
        this.mc.rollback(arg0);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:18,代码来源:ConnectionWrapper.java

示例14: setSavepoint

import java.sql.Savepoint; //导入依赖的package包/类
/**
 * @see Connection#setSavepoint(String)
 */
public java.sql.Savepoint setSavepoint(String name) throws SQLException {
    synchronized (getConnectionMutex()) {
        MysqlSavepoint savepoint = new MysqlSavepoint(name, getExceptionInterceptor());

        setSavepoint(savepoint);

        return savepoint;
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:13,代码来源:ConnectionImpl.java

示例15: rollback

import java.sql.Savepoint; //导入依赖的package包/类
@Override
public void rollback(Savepoint savepoint) throws SQLException
{
	inner.rollback(savepoint);
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:MigrationConnection.java


注:本文中的java.sql.Savepoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。