Package java.sql

Examples of java.sql.Savepoint


    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl mdControl = MockControl.createControl(DatabaseMetaData.class);
    DatabaseMetaData md = (DatabaseMetaData) mdControl.getMock();
    MockControl spControl = MockControl.createControl(Savepoint.class);
    Savepoint sp = (Savepoint) spControl.getMock();

    con.getAutoCommit();
    conControl.setReturnValue(false, 1);
    md.supportsSavepoints();
    mdControl.setReturnValue(true, 1);
View Full Code Here


    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl mdControl = MockControl.createControl(DatabaseMetaData.class);
    DatabaseMetaData md = (DatabaseMetaData) mdControl.getMock();
    MockControl spControl = MockControl.createControl(Savepoint.class);
    Savepoint sp = (Savepoint) spControl.getMock();

    ds.getConnection();
    dsControl.setReturnValue(con, 1);
    con.getAutoCommit();
    conControl.setReturnValue(false, 1);
View Full Code Here

    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl mdControl = MockControl.createControl(DatabaseMetaData.class);
    DatabaseMetaData md = (DatabaseMetaData) mdControl.getMock();
    MockControl spControl = MockControl.createControl(Savepoint.class);
    Savepoint sp = (Savepoint) spControl.getMock();

    con.getAutoCommit();
    conControl.setReturnValue(false, 1);
    md.supportsSavepoints();
    mdControl.setReturnValue(true, 1);
View Full Code Here

    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl mdControl = MockControl.createControl(DatabaseMetaData.class);
    DatabaseMetaData md = (DatabaseMetaData) mdControl.getMock();
    MockControl spControl = MockControl.createControl(Savepoint.class);
    Savepoint sp = (Savepoint) spControl.getMock();

    ds.getConnection();
    dsControl.setReturnValue(con, 1);
    con.getAutoCommit();
    conControl.setReturnValue(false, 1);
View Full Code Here

    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl mdControl = MockControl.createControl(DatabaseMetaData.class);
    DatabaseMetaData md = (DatabaseMetaData) mdControl.getMock();
    MockControl spControl = MockControl.createControl(Savepoint.class);
    Savepoint sp = (Savepoint) spControl.getMock();
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(Session.class);
    Session session = (Session) sessionControl.getMock();
    MockControl txControl = MockControl.createControl(Transaction.class);
View Full Code Here

        // Create a savepoint that we can roll back to if drop table fails.
        // This is not needed by Derby, but some databases (e.g., PostgreSQL)
        // don't allow more operations in a transaction if a statement fails,
        // and we want to be able to run these tests against other databases
        // than Derby.
        Savepoint sp = c.setSavepoint();
        Statement stmt = c.createStatement();
        try {
            stmt.executeUpdate("DROP TABLE " + table);
        } catch (SQLException e) {
            // OK to fail if table doesn't exist, roll back to savepoint
View Full Code Here

    /**
     * Test2 - After releasing a savepoint, should be able to reuse it.
     */
    public void testReusingSavepoints() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("s1");
        con.releaseSavepoint(savepoint1);
        con.setSavepoint("s1");
        con.rollback();
    }
View Full Code Here

     * @throws SQLException
     */
    public void testNamesAndIds() throws SQLException {
        Connection con = getConnection();
        try {
            Savepoint savepoint1 = con.setSavepoint();
            savepoint1.getSavepointId();
            // following should throw exception for unnamed savepoint
            savepoint1.getSavepointName();
            fail("FAIL 4 getSavepointName on id savepoint");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("XJ014", se);
        }
        con.rollback();
        try {
            Savepoint savepoint1 = con.setSavepoint("s1");
            savepoint1.getSavepointName();
            // following should throw exception for named savepoint
            savepoint1.getSavepointId();
            fail("FAIL 4 getSavepointId on named savepoint ");
        } catch (SQLException se) {
            // Expected exception.
            assertSQLState("XJ013", se);
        }
View Full Code Here

     * different transactions and release the first one in the subsequent
     * transaction
     */
    public void testBug4465() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("s1");
        con.commit();
        // The following savepoint was earlier named s1. Changed it to s2 while
        // working on DRDA support
        // for savepoints. The reason for that is as follows
        // The client translates all savepoint jdbc calls to equivalent sql and
View Full Code Here

     * test 6a - create a savepoint release it and then create another with the
     * same name. and release the first one
     */
    public void testReleaseReleasedSavepoint() throws SQLException {
        Connection con = getConnection();
        Savepoint savepoint1 = con.setSavepoint("s1");
        con.releaseSavepoint(savepoint1);
        // The following savepoint was earlier named s1. Changed it to s2 while
        // working on DRDA support
        // for savepoints. The reason for that is as follows
        // The client translates all savepoint jdbc calls to equivalent sql and
View Full Code Here

TOP

Related Classes of java.sql.Savepoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.