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

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


          List<ODocument> execute = null;
          if (updateCounter % 10 == 0)
            System.out.println(Thread.currentThread() + " : before search cycle(update)" + updateCounter);
          do {
            try {
              execute = database.command(new OSQLSynchQuery<Object>("select * from " + STUDENT_CLASS_NAME + " where counter = ?"))
                  .execute(updateCounter);
            } catch (ORecordNotFoundException onfe) {
              System.out.println("Record not found for doc " + updateCounter);
            } catch (OException e) {
              if (e.getMessage().contains("Error during loading record with id")) {
View Full Code Here


          List<ODocument> execute = null;
          if (updateCounter % 10 == 0)
            System.out.println(Thread.currentThread() + " : before search cycle(update)" + updateCounter);
          do {
            try {
              execute = database.command(
                  new OSQLSynchQuery<Object>("select * from " + TRANSACTIONAL_WORD + STUDENT_CLASS_NAME + " where counter = ?"))
                  .execute(updateCounter);
            } catch (ORecordNotFoundException onfe) {
              // ignore has been deleted
            } catch (OException e) {
View Full Code Here

            List<ODocument> execute;
            if (number % 10 == 0)
              System.out.println(Thread.currentThread() + " : before search cycle (delete) " + number);
            do {
              execute = database.command(new OSQLSynchQuery<Object>("select * from " + STUDENT_CLASS_NAME + " where counter2 = ?"))
                  .execute(number);
            } while (execute == null || execute.isEmpty());

            if (number % 10 == 0)
              System.out.println(Thread.currentThread() + " : after search cycle (delete)" + number);
View Full Code Here

            List<ODocument> execute;
            if (number % 10 == 0)
              System.out.println(Thread.currentThread() + " : before search cycle (delete) " + number);
            do {
              execute = database.command(
                  new OSQLSynchQuery<Object>("select * from " + TRANSACTIONAL_WORD + STUDENT_CLASS_NAME + " where counter2 = ?"))
                  .execute(number);
            } while (execute == null || execute.isEmpty());

            if (number % 10 == 0)
View Full Code Here

    final ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:test").create();
    final OSchema schema = db.getMetadata().getSchema();
    final OClass clazz = schema.createClass("test");
    clazz.createProperty("numericAtt", OType.DOUBLE);

    db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES (28.23)")).execute();

    final List<ODocument> docs = db.query(new OSQLSynchQuery("SELECT FROM test"));
    Double value = (Double) docs.get(0).field("numericAtt");

    System.out.println(value);
View Full Code Here

            } else
              commandAsString = command.toString();

          final OCommandRequestText cmd = (OCommandRequestText) OCommandManager.instance().getRequester(language);
          cmd.setText(commandAsString);
          lastResult = db.command(cmd).execute();
        } else if (type.equals("script")) {
          // COMMAND
          final String language = (String) operation.get("language");
          if (language == null)
            throw new IllegalArgumentException("language parameter is null");
View Full Code Here

              }
            }
          } else
            text.append(script);

          lastResult = db.command(new OCommandScript(language, text.toString())).execute();
        }
      }

      if (tx)
        db.commit();
View Full Code Here

      Assert.assertTrue(e.getCause() instanceof ORecordDuplicatedException);
    } catch (ORecordDuplicatedException oie) {
    }

    Assert.assertEquals(
        ((List<ODocument>) db.command(new OCommandSQL("select from TransactionUniqueIndexWithDotTest")).execute()).size(),
        countClassBefore);

    final List<ODocument> resultAfterCommit = db.query(new OSQLSynchQuery<ODocument>(
        "select from  index:TransactionUniqueIndexWithDotTest.label"));
    Assert.assertEquals(resultAfterCommit.size(), 1);
View Full Code Here

    final OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    final OClass indexWithLimitAndOffset = schema.createClass("IndexWithLimitAndOffsetClass");
    indexWithLimitAndOffset.createProperty("val", OType.INTEGER);
    indexWithLimitAndOffset.createProperty("index", OType.INTEGER);

    databaseDocumentTx.command(new OCommandSQL(
        "create index IndexWithLimitAndOffset on IndexWithLimitAndOffsetClass (val) notunique"));

    for (int i = 0; i < 30; i++) {
      final ODocument document = new ODocument("IndexWithLimitAndOffsetClass");
      document.field("val", i / 10);
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("NullIndexKeysSupportIndex"));
  }

  public void testNullHashIndexKeysSupport() {
    final ODatabaseDocumentTx databaseDocumentTx = (ODatabaseDocumentTx) database.getUnderlying();
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.