use of com.orientechnologies.orient.core.record.impl.ORecordBytes in project orientdb by orientechnologies.
the class Account method toStream.
@OBeforeSerialization
public void toStream(final ODocument iDocument) {
if (thumbnail != null) {
// WRITE THE PHOTO IN AN EXTERNAL RECORD AS PURE BINARY
OBlob externalPhoto = new ORecordBytes(thumbnail);
iDocument.field("externalPhoto", externalPhoto);
}
}
use of com.orientechnologies.orient.core.record.impl.ORecordBytes in project orientdb by orientechnologies.
the class LocalCreateBinaryDocumentSpeedTest method cycle.
@Override
@Test(enabled = false)
public void cycle() {
final OStorage storage = database.getStorage();
((OAbstractPaginatedStorage) storage).startGatheringPerformanceStatisticForCurrentThread();
record = new ORecordBytes(database, payload);
record.save();
if (data.getCyclesDone() == data.getCycles() - 1)
database.commit();
OSessionStoragePerformanceStatistic sessionStoragePerformanceStatistic = ((OAbstractPaginatedStorage) storage).completeGatheringPerformanceStatisticForCurrentThread();
System.out.println(sessionStoragePerformanceStatistic.toDocument().toJSON("prettyPrint"));
}
use of com.orientechnologies.orient.core.record.impl.ORecordBytes in project orientdb by orientechnologies.
the class OConsoleDatatabaseAppTest method testSelectBinaryDoc.
@Test
public void testSelectBinaryDoc() throws IOException {
final StringBuilder builder = new StringBuilder();
OConsoleDatabaseApp app = new OConsoleDatabaseApp(new String[] {}) {
@Override
public void message(String iMessage, Object... iArgs) {
builder.append(String.format(iMessage, iArgs)).append("\n");
}
};
app.createDatabase("memory:test", null, null, "memory", null, null);
ODatabaseDocument db = app.getCurrentDatabase();
db.addBlobCluster("blobTest");
ORecord record = db.save(new ORecordBytes("blobContent".getBytes()), "blobTest");
builder.setLength(0);
app.select(" from " + record.getIdentity() + " limit -1 ");
assertTrue(builder.toString().contains("<binary>"));
}
Aggregations