Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SerialClob


        throw new WebServiceException(WSExecutionFactory.UTIL.getString("http_usage_error")); //$NON-NLS-1$
      }

      DataSource ds = null;
      if (payload instanceof String) {
        ds = new InputStreamFactory.ClobInputStreamFactory(new SerialClob(((String)payload).toCharArray()));
      } else if (payload instanceof SQLXML) {
        ds = new InputStreamFactory.SQLXMLInputStreamFactory((SQLXML)payload);
      } else if (payload instanceof Clob) {
        ds = new InputStreamFactory.ClobInputStreamFactory((Clob)payload);
      } else if (payload instanceof Blob) {
View Full Code Here


@SuppressWarnings("nls")
public class TestClobValue {

    @Test public void testClobValue() throws Exception {
        String testString = "this is test clob"; //$NON-NLS-1$
        SerialClob clob = new SerialClob(testString.toCharArray());
       
        ClobType cv = new ClobType(clob);
        assertEquals(testString, cv.getSubString(1L, (int)cv.length()));
    }
View Full Code Here

        assertEquals(testString, cv.getSubString(1L, (int)cv.length()));
    }
   
    @Test public void testClobValuePersistence() throws Exception {
        String testString = "this is test clob"; //$NON-NLS-1$
        SerialClob clob = new SerialClob(testString.toCharArray());
       
        ClobType cv = new ClobType(clob);
        String key = cv.getReferenceStreamId();
       
        // now force to serialize
View Full Code Here

    return this.reference.getCharacterStream(pos, length);
  }
 
  public static SerialClob createClob(char[] chars) {
    try {
      return new SerialClob(chars);
    } catch (SQLException e) {
      throw new TeiidRuntimeException(e);
    }
  }
View Full Code Here

    */
    public long position(String searchstr, long start) throws SQLException {
      if (searchstr == null) {
            return -1;
        }
      return position(new SerialClob(searchstr.toCharArray()), start);
    }
View Full Code Here

    String string = result.getSubString(1, (int)result.length());
    assertEquals("hello world", string);
  }
 
  @Test public void testToBytes() throws Exception {
    Blob result = (Blob)helpInvokeMethod("to_bytes", new Class<?>[] {DefaultDataClasses.CLOB, DefaultDataClasses.STRING}, new Object[] { new ClobType(new SerialClob("hello world".toCharArray())), "UTF32" }, null); //$NON-NLS-1$
    assertEquals(44, result.length()); //4 bytes / char
  }
View Full Code Here

    String string = result.getSubString(1, (int)result.length());
    assertEquals("68656C6C6F20776F726C64", string);
  }
 
  @Test public void testToBytes2() throws Exception {
    Blob result = (Blob)helpInvokeMethod("to_bytes", new Class<?>[] {DefaultDataClasses.CLOB, DefaultDataClasses.STRING}, new Object[] { new ClobType(new SerialClob("68656C6C6F20776F726C64".toCharArray())), "HEX" }, null); //$NON-NLS-1$
    assertEquals("hello world", new String(ObjectConverterUtil.convertToCharArray(result.getBinaryStream(), -1, "ASCII")));
  }
View Full Code Here

    Blob result = (Blob)helpInvokeMethod("to_bytes", new Class<?>[] {DefaultDataClasses.CLOB, DefaultDataClasses.STRING}, new Object[] { new ClobType(new SerialClob("68656C6C6F20776F726C64".toCharArray())), "HEX" }, null); //$NON-NLS-1$
    assertEquals("hello world", new String(ObjectConverterUtil.convertToCharArray(result.getBinaryStream(), -1, "ASCII")));
  }
 
  @Test(expected=FunctionExecutionException.class) public void testToBytes3() throws Exception {
    helpInvokeMethod("to_bytes", new Class<?>[] {DefaultDataClasses.CLOB, DefaultDataClasses.STRING}, new Object[] { new ClobType(new SerialClob("a".toCharArray())), "BASE64" }, null); //$NON-NLS-1$
  }
View Full Code Here

  @Test public void testLobHandling() throws Exception {
    ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
    x.setType(DataTypeManager.DefaultDataClasses.CLOB);
    List<ElementSymbol> schema = Arrays.asList(x);
    TupleBuffer tb = new TupleBuffer(new FakeBatchManager(), "x", schema, LobManager.getLobIndexes(schema), 32); //$NON-NLS-1$
    ClobType c = new ClobType(new SerialClob(new char[0]));
    TupleBatch batch = new TupleBatch(1, new List[] {Arrays.asList(c)});
    tb.addTupleBatch(batch, false);
    assertNotNull(tb.getLobReference(c.getReferenceStreamId()));
  }
View Full Code Here

import junit.framework.TestCase;

public class TestDataTypeTransformer extends TestCase {
 
  public void testClobToStringConversion() throws Exception {
    Clob clob = new SerialClob("foo".toCharArray()); //$NON-NLS-1$
    String value = DataTypeTransformer.getString(clob);
    assertEquals("foo", value); //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SerialClob

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.