Package com.orientechnologies.orient.core.db.document

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.command()


    Assert.assertEquals(result.size(), 4);
    for (ODocument document : result)
      Assert.assertNull(document.field("nullField"));

    final ODocument explain = databaseDocumentTx.command(new OCommandSQL("explain " + query)).execute();
    Assert.assertTrue(explain.<Set<String>> field("involvedIndexes").contains("NullHashIndexKeysSupportIndex"));
  }

  public void testNullIndexKeysSupportInTx() {
    final ODatabaseDocumentTx databaseDocumentTx = (ODatabaseDocumentTx) database.getUnderlying();
View Full Code Here


    Assert.assertEquals(result.size(), 4);
    for (ODocument document : result)
      Assert.assertNull(document.field("nullField"));

    final ODocument explain = databaseDocumentTx.command(new OCommandSQL("explain " + query)).execute();
    Assert.assertTrue(explain.<Set<String>> field("involvedIndexes").contains("NullIndexKeysSupportInTxIndex"));
  }

  public void testNullIndexKeysSupportInMiddleTx() {
    if (database.getURL().startsWith("remote:"))
View Full Code Here

    Assert.assertEquals(result.size(), 4);
    for (ODocument document : result)
      Assert.assertNull(document.field("nullField"));

    final ODocument explain = databaseDocumentTx.command(new OCommandSQL("explain " + query)).execute();
    Assert.assertTrue(explain.<Set<String>> field("involvedIndexes").contains("NullIndexKeysSupportInMiddleTxIndex"));

    database.commit();
  }
View Full Code Here

    List<ODocument> resultOne = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(queryOne));
    Assert.assertEquals(resultOne.size(), 1);
    Assert.assertEquals(resultOne.get(0), docOne);

    ODocument explain = databaseDocumentTx.command(new OCommandSQL("explain " + queryOne)).execute();
    Assert.assertTrue(explain.<Collection<String>> field("involvedIndexes").contains("TestCreateIndexAbstractClass.value"));

    final String queryTwo = "select from TestCreateIndexAbstractClass where value = 'val2'";

    List<ODocument> resultTwo = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(queryTwo));
View Full Code Here

    List<ODocument> resultTwo = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(queryTwo));
    Assert.assertEquals(resultTwo.size(), 1);
    Assert.assertEquals(resultTwo.get(0), docTwo);

    explain = databaseDocumentTx.command(new OCommandSQL("explain " + queryTwo)).execute();
    Assert.assertTrue(explain.<Collection<String>> field("involvedIndexes").contains("TestCreateIndexAbstractClass.value"));
  }

  public void testValuesContainerIsRemovedIfIndexIsRemoved() {
    if (database.getURL().startsWith("remote:"))
View Full Code Here

    ODatabaseDocumentTx db = new ODatabaseDocumentTx(url).open("admin", "admin");

    for (int i = 0;; ++i) {
      try {
        ODocument parent;
        final List<ODocument> result = db.command(new OCommandSQL("select from Person where name = '" + parentName + "'"))
            .execute();
        parent = result.get(0);
        if (parent == null) {
          db.close();
          return;
View Full Code Here

  public static void deleteSubTree(String parentName) {
    ODatabaseDocumentTx db = new ODatabaseDocumentTx(url).open("admin", "admin");
    for (int i = 0;; ++i) {
      try {
        final List<ODocument> result = db.command(new OCommandSQL("select from Person where name = '" + parentName + "'"))
            .execute();
        ODocument parent = result.get(0);
        if (parent == null) {
          db.close();
          return;
View Full Code Here

        Collection<ODocument> out = parent.field("out");
        if (out.size() > 0) {
          ODocument edge = out.iterator().next();
          if (edge != null) {
            out.remove(edge);
            final List<ODocument> result2 = db.command(new OCommandSQL("traverse out from " + edge.getIdentity())).execute();
            for (ODocument d : result2) {
              db.delete(d);
            }
          }
        }
View Full Code Here

    final Long total = db.countClass("Profile");

    final List<ODocument> resultset = db.query(new OSQLSynchQuery<Object>(
        "select from Profile where sex = 'male' and salary > 120 and salary <= 133"));

    final Number records = (Number) db.command(
        new OCommandSQL("delete from Profile where sex = 'male' and salary > 120 and salary <= 133")).execute();

    Assert.assertEquals(records.intValue(), resultset.size());

    Assert.assertEquals(db.countClass("Profile"), total - records.intValue());
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.