Package net.sourceforge.squirrel_sql.fw.sql

Examples of net.sourceforge.squirrel_sql.fw.sql.SQLExecutionException


        _executer = null;
    }

    public void sqlExecutionException(Throwable th, String postErrorString)
    {
        SQLExecutionException ex =
            new SQLExecutionException(th, postErrorString);

        String message = getSession().formatException(ex);

        getSession().showErrorMessage(message);
View Full Code Here


     * Test method for {@link net.sourceforge.squirrel_sql.fw.util.DefaultExceptionFormatter#format(java.lang.Throwable)}.
     */   
    @Test
    public void testDefaultFormatForSQLWarning() {
        SQLWarning ex = new SQLWarning("low on memory", "WarningState", 1000);
        SQLExecutionException ee = new SQLExecutionException(ex, "postError");
        Assert.assertTrue(formatterUnderTest.formatsException(ex));
        Assert.assertTrue(formatterUnderTest.formatsException(ee));
       
        StringBuilder expectedMessage =
            new StringBuilder("Warning:   low on memory\n");
View Full Code Here

     */
    @Test
    public final void testFormatsException() {
        Assert.assertTrue(formatterUnderTest.formatsException(new Throwable()));
        Assert.assertTrue(formatterUnderTest.formatsException(new SQLException()));
        Assert.assertTrue(formatterUnderTest.formatsException(new SQLExecutionException(new SQLException(), "")));
        Assert.assertTrue(formatterUnderTest.formatsException(new SQLExecutionException(new SQLException(), "some error")));
        Assert.assertTrue(formatterUnderTest.formatsException(new SQLExecutionException(new SQLException(), null)));
        Assert.assertTrue(formatterUnderTest.formatsException(new IOException()));
        Assert.assertTrue(formatterUnderTest.formatsException(new DataTruncation(0, true, true, 0, 0)));
        Assert.assertTrue(formatterUnderTest.formatsException(new SQLWarning()));
    }
View Full Code Here

     */
    @Test
    public final void testSetCustomExceptionFormatter() throws Exception {
        ExceptionFormatter formatter1 = createMock(ExceptionFormatter.class);
        SQLException ex = new SQLException("table does not exist");
        SQLExecutionException ee = new SQLExecutionException(ex, "");
        expect(formatter1.formatsException(isA(SQLException.class))).andReturn(true).anyTimes();
        expect(formatter1.format(ex)).andReturn("foo").anyTimes();
        replay(formatter1);
        formatterUnderTest.setCustomExceptionFormatter(formatter1);
        String formattedEx = formatterUnderTest.format(ee);
View Full Code Here

    @Test
    public final void testSetMultiCustomExceptionFormatter() throws Exception {
        ExceptionFormatter formatter1 = createMock(ExceptionFormatter.class);
        ExceptionFormatter formatter2 = createMock(ExceptionFormatter.class);
        SQLException ex = new SQLException("table does not exist");
        SQLExecutionException ee = new SQLExecutionException(ex, "");
        expect(formatter1.formatsException(isA(SQLException.class))).andReturn(true).anyTimes();
        expect(formatter1.format(ex)).andReturn("formatter1").anyTimes();
        expect(formatter2.formatsException(isA(SQLException.class))).andReturn(true).anyTimes();
        expect(formatter2.format(ex)).andReturn("formatter2").anyTimes();
        replay(formatter1);
View Full Code Here

    {
    }

    public void sqlExecutionException(Throwable th, String postErrorString)
    {
      String message = _session.formatException(new SQLExecutionException(th, postErrorString));
      _session.showErrorMessage(message);

      if (_session.getProperties().getWriteSQLErrorsToLog())
      {
        s_log.info(message);
View Full Code Here

  {
  }

  public void sqlExecutionException(Throwable th, String postErrorString)
  {
    String message = _session.formatException(new SQLExecutionException(th, postErrorString));
    _session.showErrorMessage(message);

    if (_session.getProperties().getWriteSQLErrorsToLog())
    {
      s_log.info(message);
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.sql.SQLExecutionException

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.