Search in sources :

Example 31 with SQLSyntaxErrorException

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

the class SQLSyntaxErrorExceptionTests method test13.

/**
     * Create SQLSyntaxErrorException and validate it is an instance of
     * SQLNonTransientException
     */
@Test
public void test13() {
    Exception ex = new SQLSyntaxErrorException();
    assertTrue(ex instanceof SQLNonTransientException);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) SQLException(java.sql.SQLException) SQLNonTransientException(java.sql.SQLNonTransientException) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 32 with SQLSyntaxErrorException

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

the class SQLSyntaxErrorExceptionTests method test5.

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

Example 33 with SQLSyntaxErrorException

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

the class SQLSyntaxErrorExceptionTests method test4.

/**
     * Create SQLSyntaxErrorException with message, SQLState, and error code
     */
@Test
public void test4() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state, errorCode);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == errorCode);
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 34 with SQLSyntaxErrorException

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

the class SQLSyntaxErrorExceptionTests method test9.

/**
     * Create SQLSyntaxErrorException with Throwable
     */
@Test
public void test9() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException(t);
    assertTrue(ex.getMessage().equals(cause) && 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 35 with SQLSyntaxErrorException

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

the class SQLSyntaxErrorExceptionTests method test10.

/**
     * Serialize a SQLSyntaxErrorException and make sure you can read it back properly
     */
@Test
public void test10() throws Exception {
    SQLSyntaxErrorException e = new SQLSyntaxErrorException(reason, state, errorCode, t);
    SQLSyntaxErrorException ex1 = createSerializedException(e);
    assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
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