Package java.sql

Examples of java.sql.Clob


  public Object get(ResultSet rs, String name) throws SQLException {
    return get( rs, name, NonContextualLobCreator.INSTANCE );
  }

  public Clob get(ResultSet rs, String name, LobCreator lobCreator) throws SQLException {
    Clob value = rs.getClob( name );
    return rs.wasNull() ? null : lobCreator.wrap( value );
  }
View Full Code Here


    return new int[] { Types.CLOB };
  }
 
  public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
    if (value!=null) {
      Clob clob = (Clob) value;
      try {
        int len = (int) clob.length();
        node.setText( clob.getSubString(0, len) );
      }
      catch (SQLException sqle) {
        throw new HibernateException("could not read XML from Clob", sqle);
      }
    }
View Full Code Here

  }

  @Override
  public Clob createClob(String string) {
    try {
      final Clob clob = createClob();
      clob.setString( 1, string );
      return clob;
    }
    catch ( SQLException e ) {
      throw new JDBCException( "Unable to set CLOB string after creation", e );
    }
View Full Code Here

    }
   
  }

  public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
    Clob value = rs.getClob(name);
    return rs.wasNull() ? null : new SerializableClob(value);
  }
View Full Code Here

    return new int[] { Types.CLOB };
  }
 
  public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
    if (value!=null) {
      Clob clob = (Clob) value;
      try {
        int len = (int) clob.length();
        node.setText( clob.getSubString(0, len) );
      }
      catch (SQLException sqle) {
        throw new HibernateException("could not read XML from Clob", sqle);
      }
    }
View Full Code Here

    }
   
  }

  public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
    Clob value = rs.getClob(name);
    return rs.wasNull() ? null : new SerializableClob(value);
  }
View Full Code Here

    return new int[] { Types.CLOB };
  }
 
  public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
    if (value!=null) {
      Clob clob = (Clob) value;
      try {
        int len = (int) clob.length();
        node.setText( clob.getSubString(0, len) );
      }
      catch (SQLException sqle) {
        throw new HibernateException("could not read XML from Clob", sqle);
      }
    }
View Full Code Here

          // otherwise we need to build a CharacterStream...
          return (X) new CharacterStreamImpl( DataHelper.extractString( value.getCharacterStream() ) );
        }
      }
      else if (Clob.class.isAssignableFrom( type )) {
        final Clob clob =  WrappedClob.class.isInstance( value )
            ? ( (WrappedClob) value ).getWrappedClob()
            : value;
        return (X) clob;
      }
    }
View Full Code Here

    return result;
  }

  private static String convertClobToString(ResultSet aRow, int aColumnIdx) throws SQLException {
    String result = null;
    Clob clob = aRow.getClob(aColumnIdx);
    if (clob != null){
      int length = new Long(clob.length()).intValue();
      result = clob.getSubString(1, length);
    }
    return result;
  }
View Full Code Here

        assertNull(rs.getClob(1));
        assertTrue(rs.wasNull());
        assertNull(rs.getClob("column"));
        assertTrue(rs.wasNull());
        // Set what gets returned to something other than the default
        Clob clob = new SqlNullCheckedResultSetMockClob();
        rs2.setNullClob(clob);
        assertNotNull(rs.getClob(1));
        assertEquals(clob, rs.getClob(1));
        assertNotNull(rs.getClob("column"));
        assertEquals(clob, rs.getClob("column"));
View Full Code Here

TOP

Related Classes of java.sql.Clob

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.