Package java.sql

Examples of java.sql.Clob


                checkProcedureOutput(param,paramType,val);
            return true;
        }
        case Types.CLOB: {
            // clob not allowed for procedures
            Clob clob = cs.getClob(param);
            boolean wn = cs.wasNull();
            return true;
        }
        case Types.BLOB: {
            // blob not allowed for procedures
View Full Code Here


        Statement st = createStatement();
        createTestObjects(st);
       
        //increase the maximum size of the clob
       
        Clob clob = null;
        Blob blob=null;
        int val = 1;
        int size = 15 * 1024;
        InputStream stream;
              
View Full Code Here

     *
     * @param columnIndex (1,2,...)
     * @return the value
     */
    public Clob getClob(int columnIndex) throws SQLException {
        Clob c = (Clob) get(columnIndex);
        return c == null ? null : c;
    }
View Full Code Here

        if (o == null) {
            return null;
        }
        switch (columns.get(columnIndex - 1).sqlType) {
        case Types.CLOB:
            Clob c = (Clob) o;
            return c.getSubString(1, MathUtils.convertLongToInt(c.length()));
        }
        return o.toString();
    }
View Full Code Here

    if ( value == null ) {
      return null;
    }

    final Clob clob =  WrappedClob.class.isInstance( value )
        ? ( (WrappedClob) value ).getWrappedClob()
        : value;
    return (X) clob;
  }
View Full Code Here

      return output.toByteArray();
   }

   private synchronized String loadClob(ResultSet resultSet, String name) throws Exception
   {
      Clob clob = resultSet.getClob(name);
      if (clob == null)
         return null;
      Reader input = clob.getCharacterStream();
      if (input == null)
         return null;
      LineNumberReader lineReader = new LineNumberReader(input);
      StringBuilder builder = new StringBuilder();
      String line;
View Full Code Here

    if ( value == null ) {
      st.setNull( index, Types.CLOB );
      return;
    }

    Clob clob = ( Clob ) value;

    if ( WrappedClob.class.isInstance( clob ) ) {
      clob = ( (WrappedClob) value ).getWrappedClob();
    }

    final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob()
        && ClobImplementer.class.isInstance( clob );

    if ( useInputStream ) {
      st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() );
    }
    else {
      st.setClob( index, clob );
    }
  }
View Full Code Here

  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 {
      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

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.