Search in sources :

Example 36 with SQLSyntaxErrorException

use of java.sql.SQLSyntaxErrorException in project jdk8u_jdk by JetBrains.

the class SQLSyntaxErrorExceptionTests method test6.

/**
     * Create SQLSyntaxErrorException with message, SQLState, and Throwable
     */
@Test
public void test6() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state, t);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 37 with SQLSyntaxErrorException

use of java.sql.SQLSyntaxErrorException in project jdk8u_jdk by JetBrains.

the class SQLSyntaxErrorExceptionTests method test8.

/**
     * Create SQLSyntaxErrorException with null Throwable
     */
@Test
public void test8() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException((Throwable) null);
    assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 38 with SQLSyntaxErrorException

use of java.sql.SQLSyntaxErrorException in project jdk8u_jdk by JetBrains.

the class SQLSyntaxErrorExceptionTests method test12.

/**
     * Validate that the ordering of the returned Exceptions is correct
     * using traditional while loop
     */
@Test
public void test12() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1);
    SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2");
    SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
Also used : SQLException(java.sql.SQLException) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 39 with SQLSyntaxErrorException

use of java.sql.SQLSyntaxErrorException in project jdk8u_jdk by JetBrains.

the class SQLSyntaxErrorExceptionTests method test7.

/**
     * Create SQLSyntaxErrorException with message, and Throwable
     */
@Test
public void test7() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, t);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 40 with SQLSyntaxErrorException

use of java.sql.SQLSyntaxErrorException in project jdk8u_jdk by JetBrains.

the class SQLSyntaxErrorExceptionTests method test2.

/**
     * Create SQLSyntaxErrorException with message
     */
@Test
public void test2() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)55 Test (org.junit.Test)14 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 DataAccessException (org.jooq.exception.DataAccessException)9 HashMap (java.util.HashMap)7 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)6 MySqlStatementParser (com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser)6 SQLStatementParser (com.alibaba.druid.sql.parser.SQLStatementParser)6 TableConfig (io.mycat.config.model.TableConfig)6 SQLNonTransientException (java.sql.SQLNonTransientException)6 Expression (com.alibaba.cobar.parser.ast.expression.Expression)5 Identifier (com.alibaba.cobar.parser.ast.expression.primary.Identifier)4 SQLExprTableSource (com.alibaba.druid.sql.ast.statement.SQLExprTableSource)4 SchemaConfig (io.mycat.config.model.SchemaConfig)4 DruidShardingParseInfo (io.mycat.route.parser.druid.DruidShardingParseInfo)4 MycatSchemaStatVisitor (io.mycat.route.parser.druid.MycatSchemaStatVisitor)4 MycatStatementParser (io.mycat.route.parser.druid.MycatStatementParser)4 SQLException (java.sql.SQLException)4 DataSource (javax.sql.DataSource)4