Package java.sql

Examples of java.sql.SQLWarning


    /**
     * Get the java.sql.SQLWarning for this SqlWarning
     */
    public SQLWarning getSQLWarning()
    {
        SQLWarning sqlw = new SQLWarning(getMessage(), getSQLState(),
            getErrorCode());

        // If we're in a runtime that supports chained exceptions, set the cause
        // of the SQLWarning to be this SqlWarning.
         if (JVMInfo.JDK_ID >= JVMInfo.J2SE_14 )
        {
            sqlw.initCause(this);
        }

        // Set up the nextException chain
        if ( nextWarning_ != null )
        {
            // The exception chain gets constructed automatically through
            // the beautiful power of recursion
            //
            // We have to use the right method to convert the next exception
            // depending upon its type.  Luckily with all the other subclasses
            // of SQLException we don't have to make our own matching
            // subclasses because
            sqlw.setNextException(
                nextException_ instanceof SqlWarning ?
                    ((SqlWarning)nextException_).getSQLWarning() :
                    nextException_.getSQLException());
        }
       
View Full Code Here


        Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY,
                                          ResultSet.CONCUR_UPDATABLE);
        s.setCursorName(getNextCursorName());
        ResultSet rs = s.executeQuery("select * from t1 order by a");
       
        SQLWarning warn = rs.getWarnings();
        assertEquals("Expected resultset to be read only",
                     ResultSet.CONCUR_READ_ONLY,
                     rs.getConcurrency());
        assertWarning(warn, QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET);
        scrollForward(rs);
View Full Code Here

        s.setCursorName(getNextCursorName());
        ResultSet rs = s.executeQuery
            ("select * from t1 as table1,t1 as table2 where " +
             "table1.a=table2.a");
       
        SQLWarning warn = rs.getWarnings();
        assertEquals("Expected resultset to be read only",
                     ResultSet.CONCUR_READ_ONLY,
                     rs.getConcurrency());
        assertWarning(warn, QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET);
        scrollForward(rs);
View Full Code Here

        final int newValue = -3333;
        final int oldValue = rs.getInt(2);
        rs.updateInt(2, newValue);
        rs.updateRow();
       
        SQLWarning warn = rs.getWarnings();
        assertWarning(warn, CURSOR_OPERATION_CONFLICT);
        assertEquals("Did not expect the resultset to be updated", oldValue, rs.getInt(2));
        assertTrue("Expected rs.rowDeleted() to be false", !rs.rowDeleted());
        assertTrue("Expected rs.rowUpdated() to be false", !rs.rowUpdated());
       
View Full Code Here

        int updateCount = s3.executeUpdate
            ("update t1 set A=" + newValue +
             " where current of " + rs.getCursorName());
       
        rs.relative(0);
        SQLWarning warn = s3.getWarnings();
        assertWarning(warn, CURSOR_OPERATION_CONFLICT);
        assertTrue("Expected rs.rowUpdated() to be false", !rs.rowUpdated());
        assertTrue("Expected rs.rowDeleted() to be false", !rs.rowDeleted());
        assertEquals("Did not expect the resultset to be updated", oldValue, rs.getInt(2));
        assertEquals("Expected update count to be 0", 0, updateCount);
View Full Code Here

    }
    if ( export ) {

      statement.executeUpdate( sql );
      try {
        SQLWarning warnings = statement.getWarnings();
        if ( warnings != null) {
          JDBCExceptionReporter.logAndClearWarnings( connectionHelper.getConnection() );
        }
      }
      catch( SQLException sqle ) {
View Full Code Here

    }
    if ( export ) {

      statement.executeUpdate( sql );
      try {
        SQLWarning warnings = statement.getWarnings();
        if ( warnings != null) {
          JDBCExceptionReporter.logAndClearWarnings( connectionHelper.getConnection() );
        }
      }
      catch( SQLException sqle ) {
View Full Code Here

    if ( m_FullErrors )
    {
      for ( int idx = 0 ; idx < m_OpenSQLDocuments.size() ; idx++ )
      {
        SQLDocument doc = (SQLDocument)m_OpenSQLDocuments.elementAt(idx);
        SQLWarning warn = doc.checkWarnings();
        if ( warn != null ) setError(null, doc, warn);
      }
    }

    return(buildErrorDocument());
View Full Code Here

      // @todo
      // Do we need to do something with this ??
      //    m_Error != null || (m_FullErrors && m_Warning != null) )

      ExpressionContext ctx = m_LastSQLDocumentWithError.getExpressionContext();
      SQLWarning        warn = m_LastSQLDocumentWithError.checkWarnings();


      try
      {
        DTMManager mgr =
View Full Code Here

      if ( warn != null )
      {
        // Because the log may not have processed the previous warning yet
        // we need to make a new one.
        SQLWarning tw =
          new SQLWarning(warn.getMessage(), warn.getSQLState(),
            warn.getErrorCode());
        SQLWarning nw = warn.getNextWarning();
        while ( nw != null )
        {
          tw.setNextWarning(new SQLWarning(nw.getMessage(),
            nw.getSQLState(), nw.getErrorCode()));

          nw = nw.getNextWarning();
        }

        tw.setNextWarning(
          new SQLWarning(warn.getMessage(), warn.getSQLState(),
            warn.getErrorCode()));

//        m_Warning = tw;

      }
View Full Code Here

TOP

Related Classes of java.sql.SQLWarning

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.