Examples of ORecordFlat


Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    db1.open("admin", "admin");

    ODatabaseFlat db2 = new ODatabaseFlat(url);
    db2.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    try {
      db1.begin();

      // RE-READ THE RECORD
      record1.load();
      int v1 = record1.getVersion();
      record1.value("This is the second version").save();

      db1.commit();

      ORecordFlat record2 = db2.load(record1.getIdentity());
      Assert.assertEquals(record2.getVersion(), v1 + 1);
      Assert.assertTrue(record2.value().contains("second"));

    } finally {

      db1.close();
      db2.close();
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

          value = "byte[" + ((byte[]) value).length + "]";
        out.printf("%20s : %-20s\n", fieldName, value);
      }

    } else if (currentRecord instanceof ORecordFlat) {
      ORecordFlat rec = (ORecordFlat) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      out.print(rec.value());

    } else if (currentRecord instanceof ORecordBytes) {
      ORecordBytes rec = (ORecordBytes) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      byte[] value = rec.toStream();
      for (int i = 0; i < Array.getLength(value); ++i) {
        out.printf("%03d", Array.getByte(value, i));
      }

    } else {
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

          value = "byte[" + ((byte[]) value).length + "]";
        out.printf("%20s : %-20s\n", fieldName, value);
      }

    } else if (currentRecord instanceof ORecordFlat) {
      ORecordFlat rec = (ORecordFlat) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      out.print(rec.value());

    } else if (currentRecord instanceof ORecordBytes) {
      ORecordBytes rec = (ORecordBytes) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      byte[] value = rec.toStream();
      for (int i = 0; i < Array.getLength(value); ++i) {
        out.printf("%03d", Array.getByte(value, i));
      }

    } else {
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    db1.open("admin", "admin");

    ODatabaseFlat db2 = new ODatabaseFlat(url);
    db2.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    // RE-READ THE RECORD
    record1.load();
    ORecordFlat record2 = db2.load(record1.getIdentity());

    record2.value("This is the second version").save();
    record1.value("This is the third version").save();

    record1 = db1.load(record1.getIdentity());

    Assert.assertTrue(record1.value().equals("This is the third version"));
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    long rec = db1.countClusterElements("binary");

    db1.begin();

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    db1.rollback();

    Assert.assertEquals(db1.countClusterElements("binary"), rec);
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    long tot = db1.countClusterElements("binary");

    db1.begin();

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save("binary");

    db1.commit();

    Assert.assertEquals(db1.countClusterElements("binary"), tot + 1);
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    db1.open("admin", "admin");

    ODatabaseFlat db2 = new ODatabaseFlat(url);
    db2.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    try {
      db1.begin();

      // RE-READ THE RECORD
      record1.load();
      ORecordFlat record2 = db2.load(record1.getIdentity());

      record2.value("This is the second version").save();
      record1.value("This is the third version").save();

      db1.commit();

      Assert.assertTrue(false);
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

  @Test(dependsOnMethods = "testTransactionOptimisticCuncurrentException")
  public void testTransactionOptimisticCacheMgmt1Db() throws IOException {
    ODatabaseFlat db = new ODatabaseFlat(url);
    db.open("admin", "admin");

    ORecordFlat record = new ORecordFlat(db);
    record.value("This is the first version").save();

    try {
      db.begin();

      // RE-READ THE RECORD
      record.load();
      int v1 = record.getVersion();
      record.value("This is the second version").save();
      db.commit();

      record.load();
      Assert.assertEquals(record.getVersion(), v1 + 1);
      Assert.assertTrue(record.value().contains("second"));
    } finally {

      db.close();
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

    db1.open("admin", "admin");

    ODatabaseFlat db2 = new ODatabaseFlat(url);
    db2.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    try {
      db1.begin();

      // RE-READ THE RECORD
      record1.load();
      int v1 = record1.getVersion();
      record1.value("This is the second version").save();

      db1.commit();

      ORecordFlat record2 = db2.load(record1.getIdentity());
      Assert.assertEquals(record2.getVersion(), v1 + 1);
      Assert.assertTrue(record2.value().contains("second"));

    } finally {

      db1.close();
      db2.close();
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordFlat

  }

  @SuppressWarnings("unchecked")
  @Override
  public ORecordFlat newInstance() {
    return new ORecordFlat(this);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.