Java Code Examples for java.sql.Savepoint#getSavepointName()
The following examples show how to use
java.sql.Savepoint#getSavepointName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcDatabaseConnection.java From ormlite-jdbc with ISC License | 6 votes |
@Override public void commit(Savepoint savepoint) throws SQLException { if (savepoint == null) { connection.commit(); logger.trace("connection committed"); } else { // release might clear the name so we record it beforehand Object obj = savepoint.getSavepointName(); if (obj == null) { obj = savepoint; } /* * Initially I was doing a connection.releaseSavepoint(savepoint) which was only dropping the savepoint -- * not committing it like I thought. I'm still surprised there is not a commit(savepoint). */ connection.commit(); logger.trace("connection is committed for save-point {}", obj); } }
Example 2
Source File: MockConnection.java From doma with Apache License 2.0 | 5 votes |
@Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { String savepointName = savepoint.getSavepointName(); int pos = savepointNames.lastIndexOf(savepointName); if (pos == -1) { throw new SQLException(); } savepointNames.subList(0, pos + 1).clear(); }
Example 3
Source File: MockConnection.java From doma with Apache License 2.0 | 5 votes |
@Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { String savepointName = savepoint.getSavepointName(); int pos = savepointNames.lastIndexOf(savepointName); if (pos == -1) { throw new SQLException(); } savepointNames.subList(0, pos + 1).clear(); }
Example 4
Source File: JdbcDatabaseConnection.java From ormlite-jdbc with ISC License | 5 votes |
@Override public void rollback(Savepoint savepoint) throws SQLException { if (savepoint == null) { connection.rollback(); logger.trace("connection is rolled back"); } else { // rollback might clear the name so we record it beforehand Object obj = savepoint.getSavepointName(); if (obj == null) { obj = savepoint; } connection.rollback(savepoint); logger.trace("save-point {} is rolled back", obj); } }
Example 5
Source File: SavepointJdbc30Test.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** * Test 9 test savepoint name and verify case sensitivity */ public void testSavepointName() throws SQLException { Connection con = getConnection(); Savepoint savepoint1 = con.setSavepoint("myname"); String savepointName = savepoint1.getSavepointName(); assertEquals(savepointName, "myname"); con.rollback(); }
Example 6
Source File: SavepointJdbc30Test.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** * Test 10 test savepoint name case sensitivity */ public void testNameCaseSensitivity() throws SQLException { Connection con = getConnection(); Savepoint savepoint1 = con.setSavepoint("MyName"); String savepointName = savepoint1.getSavepointName(); assertEquals(savepointName, "MyName"); con.rollback(); }
Example 7
Source File: TransactionManager.java From ormlite-core with ISC License | 5 votes |
private static void commit(DatabaseConnection connection, Savepoint savePoint) throws SQLException { String name = (savePoint == null ? null : savePoint.getSavepointName()); connection.commit(savePoint); if (name == null) { logger.trace("committed savePoint transaction"); } else { logger.trace("committed savePoint transaction {}", name); } }
Example 8
Source File: TransactionManager.java From ormlite-core with ISC License | 5 votes |
private static void release(DatabaseConnection connection, Savepoint savePoint) throws SQLException { String name = (savePoint == null ? null : savePoint.getSavepointName()); connection.releaseSavePoint(savePoint); if (name == null) { logger.trace("released savePoint transaction"); } else { logger.trace("released savePoint transaction {}", name); } }
Example 9
Source File: TransactionManager.java From ormlite-core with ISC License | 5 votes |
private static void rollBack(DatabaseConnection connection, Savepoint savePoint) throws SQLException { String name = (savePoint == null ? null : savePoint.getSavepointName()); connection.rollback(savePoint); if (name == null) { logger.trace("rolled back savePoint transaction"); } else { logger.trace("rolled back savePoint transaction {}", name); } }
Example 10
Source File: MockConnection.java From doma with Apache License 2.0 | 4 votes |
@Override public void rollback(Savepoint savepoint) throws SQLException { String name = savepoint.getSavepointName(); savepointNames.remove(name); }
Example 11
Source File: MockConnection.java From doma with Apache License 2.0 | 4 votes |
@Override public void rollback(Savepoint savepoint) throws SQLException { String name = savepoint.getSavepointName(); savepointNames.remove(name); }