@Override public void fillRow(List<Object> row, String filePath, VDBMetaData v, TransformationMetadata m, CommandContext cc, SimpleIterator<String> iter) { row.add(filePath); row.add(new BlobType(m.getVDBResourceAsBlob(filePath))); } });
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } }
@Override public void fillRow(List<Object> row, String filePath, VDBMetaData v, TransformationMetadata m, CommandContext cc, SimpleIterator<String> iter) { row.add(filePath); row.add(new BlobType(m.getVDBResourceAsBlob(filePath))); } });
@Override public void fillRow(List<Object> row, String filePath, VDBMetaData v, TransformationMetadata m, CommandContext cc, SimpleIterator<String> iter) { row.add(filePath); row.add(new BlobType(m.getVDBResourceAsBlob(filePath))); } });
public static BlobType asBlob(GeometryType geometry, String encoding) throws FunctionExecutionException { if ("NDR".equals(encoding)) { //$NON-NLS-1$ return new BlobType(GeometryUtils.getBytes(GeometryUtils.getGeometry(geometry), false)); } Blob b = geometry.getReference(); return new BlobType(b); }
public static BlobType asBlob(AbstractGeospatialType geometry, String encoding) throws FunctionExecutionException { if ("NDR".equals(encoding)) { //$NON-NLS-1$ return new BlobType(GeometryUtils.getBytes(GeometryUtils.getGeometry(geometry), false)); } Blob b = geometry.getReference(); return new BlobType(b); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeographyType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeographyType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeometryType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOMETRY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeometryType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { if (version < VERSION_GEOMETRY) { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } GeometryType bt = new GeometryType(); bt.readExternal(in); return bt; } }
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { if (version < VERSION_GEOMETRY) { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } GeometryType bt = new GeometryType(); bt.readExternal(in); return bt; } }
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { if (version < VERSION_GEOGRAPHY) { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } GeographyType bt = new GeographyType(); bt.readExternal(in); return bt; } }
public void testBlobCompare() throws Exception { String testString = "this is test clob"; //$NON-NLS-1$ SerialBlob blob = new SerialBlob(testString.getBytes()); BlobType bv = new BlobType(blob); SerialBlob blob1 = new SerialBlob(testString.getBytes()); BlobType bv1 = new BlobType(blob1); assertEquals(0, bv1.compareTo(bv)); }
private static Object asLob(InputStreamFactory value, Class<?> desiredType) { if (desiredType == DataTypeManager.DefaultDataClasses.CLOB) { //assumes UTF-8 return new ClobType(new ClobImpl(value, -1)); } return new BlobType(new BlobImpl(value)); }
public void testBlobValue() throws Exception { String testString = "this is test blob"; //$NON-NLS-1$ SerialBlob blob = new SerialBlob(testString.getBytes()); BlobType bv = new BlobType(blob); assertEquals(testString, new String(bv.getBytes(1L, (int)bv.length()))); }
@Test public void testToChars2() throws Exception { Clob result = (Clob)helpInvokeMethod("to_chars", new Class<?>[] {DefaultDataClasses.BLOB, DefaultDataClasses.STRING}, new Object[] { new BlobType(new SerialBlob("hello world".getBytes("ASCII"))), "HEX" }, null); //$NON-NLS-1$ String string = result.getSubString(1, (int)result.length()); assertEquals("68656C6C6F20776F726C64", string); }
@Test public void testJSONParseBlob() throws Exception { HardcodedDataManager dataManager = new HardcodedDataManager(); String sql = "select jsonParse(cast(? as blob), false) x"; //$NON-NLS-1$ 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")))))); }
@Test public void testReferencePersistence() throws Exception { String testString = "this is test clob"; //$NON-NLS-1$ SerialBlob blob = new SerialBlob(testString.getBytes()); BlobType bv = new BlobType(blob); bv.setReferenceStreamId(null); // now force to serialize BlobType read = UnitTestUtil.helpSerialize(bv); assertNull(read.getReferenceStreamId()); assertEquals(testString, new String(read.getBytes(1, (int)blob.length()))); }
public void testBlobValuePersistence() throws Exception { String testString = "this is test clob"; //$NON-NLS-1$ SerialBlob blob = new SerialBlob(testString.getBytes()); BlobType bv = new BlobType(blob); String key = bv.getReferenceStreamId(); // now force to serialize BlobType read = UnitTestUtil.helpSerialize(bv); // make sure we have kept the reference stream id assertEquals(key, read.getReferenceStreamId()); // and lost the original object assertNull(read.getReference()); }