當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。