Package java.sql

Examples of java.sql.SQLSyntaxErrorException


    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_18() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, 1, cause);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be 1",
                sQLSyntaxErrorException.getErrorCode(), 1);
        assertEquals(
                "The cause of SQLSyntaxErrorException set and get should be equivalent",
                cause, sQLSyntaxErrorException.getCause());
    }
View Full Code Here


    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_19() {
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, 1, null);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be 1",
                sQLSyntaxErrorException.getErrorCode(), 1);
        assertNull("The cause of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_20() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, 0, cause);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be 0",
                sQLSyntaxErrorException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLSyntaxErrorException set and get should be equivalent",
                cause, sQLSyntaxErrorException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_21() {
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, 0, null);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be 0",
                sQLSyntaxErrorException.getErrorCode(), 0);
        assertNull("The cause of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_22() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, -1, cause);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be -1",
                sQLSyntaxErrorException.getErrorCode(), -1);
        assertEquals(
                "The cause of SQLSyntaxErrorException set and get should be equivalent",
                cause, sQLSyntaxErrorException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLSyntaxErrorException(String, String, int, Throwable)
     */
    public void test_Constructor_LStringLStringILThrowable_23() {
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException(
                null, null, -1, null);
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be -1",
                sQLSyntaxErrorException.getErrorCode(), -1);
        assertNull("The cause of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLSyntaxErrorException()
     */
    public void test_Constructor() {
        SQLSyntaxErrorException sQLSyntaxErrorException = new SQLSyntaxErrorException();
        assertNotNull(sQLSyntaxErrorException);
        assertNull("The SQLState of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getSQLState());
        assertNull("The reason of SQLSyntaxErrorException should be null",
                sQLSyntaxErrorException.getMessage());
        assertEquals("The error code of SQLSyntaxErrorException should be 0",
                sQLSyntaxErrorException.getErrorCode(), 0);
    }
View Full Code Here

  public static SQLException newSQLNonTransientConnectionException(String reason, String SQLState, int vendorCode) {
    return new SQLNonTransientConnectionException(reason, SQLState, vendorCode);
  }

  public static SQLException newSQLSyntaxErrorException(String reason, String SQLState, int vendorCode) {
    return new SQLSyntaxErrorException(reason, SQLState, vendorCode);
  }
View Full Code Here

            // Clearly, we should differentiate between DIRECT and DYNAMIC
            // SQL forms.  And clearly, our current "37000" is "wrong" in
            // that we do not actually support dynamic SQL syntax, but
            // rather implement similar behaviour only through JDBC
            // Prepared and Callable statements.
            return new SQLSyntaxErrorException(msg, sqlstate, code, cause);
        } else if (sqlstate.startsWith("40")) {

            // TODO: our 40xxx exceptions are not currently used (correctly)
            //       for transaction rollback exceptions:
            //
View Full Code Here

            runtime.setArgs(context.getParams());
            runtime.setSQL(context.flushOut());
        } catch (Exception e) {
            String daoInfo = runtime.getMetaData().toString();
            throw new BadSqlGrammarException(daoInfo, runtime.getSQL(),
                    new SQLSyntaxErrorException(daoInfo + " @SQL('" + runtime.getSQL() + "')", e));
        }

    }
View Full Code Here

TOP

Related Classes of java.sql.SQLSyntaxErrorException

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.