Search in sources :

Example 51 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project teiid by teiid.

the class BlobType method readReference.

@Override
protected void readReference(ObjectInput in) throws IOException {
    byte[] bytes = new byte[(int) getLength()];
    in.readFully(bytes);
    try {
        this.reference = new SerialBlob(bytes);
    } catch (SQLException e) {
        throw new IOException(e);
    }
}
Also used : SQLException(java.sql.SQLException) SerialBlob(javax.sql.rowset.serial.SerialBlob) IOException(java.io.IOException)

Example 52 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project teiid by teiid.

the class TestJSONProcessing method testJSONParseBlob.

@Test
public void testJSONParseBlob() throws Exception {
    HardcodedDataManager dataManager = new HardcodedDataManager();
    // $NON-NLS-1$
    String sql = "select jsonParse(cast(? as blob), false) x";
    String json = "{\"name\":123}";
    List<?>[] expected = new List[] { Arrays.asList(json) };
    processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(new BlobType(new SerialBlob(json.getBytes(Charset.forName("UTF-16BE"))))));
}
Also used : BlobType(org.teiid.core.types.BlobType) List(java.util.List) SerialBlob(javax.sql.rowset.serial.SerialBlob) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Aggregations

SerialBlob (javax.sql.rowset.serial.SerialBlob)52 Test (org.testng.annotations.Test)32 BaseTest (util.BaseTest)32 StubBlob (util.StubBlob)16 InputStream (java.io.InputStream)11 SerialClob (javax.sql.rowset.serial.SerialClob)8 Test (org.junit.Test)8 BlobType (org.teiid.core.types.BlobType)7 Clob (java.sql.Clob)6 SQLException (java.sql.SQLException)6 IOException (java.io.IOException)5 Blob (java.sql.Blob)5 BigDecimal (java.math.BigDecimal)3 BlobImpl (org.teiid.core.types.BlobImpl)3 OutputStream (java.io.OutputStream)2 Reader (java.io.Reader)2 SQLXML (java.sql.SQLXML)2 Time (java.sql.Time)2 Timestamp (java.sql.Timestamp)2 SerialArray (javax.sql.rowset.serial.SerialArray)2