Examples of OCommandScript


Examples of com.orientechnologies.orient.core.command.script.OCommandScript

        buffer.append(o.toString());
      }
      code = buffer.toString();
    }

    final OCommandScript script = new OCommandScript(language, code.toString());
    script.getContext().setParent(iContext);

    iContext.setVariable("block", this);

    return script.execute();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

      return;

    resetResultSet();

    final OCommandExecutorScript cmd = new OCommandExecutorScript();
    cmd.parse(new OCommandScript("Javascript", iText));

    long start = System.currentTimeMillis();

    final Object result = cmd.execute(null);
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

      return;

    resetResultSet();

    long start = System.currentTimeMillis();
    Object result = currentDatabase.command(new OCommandScript(iLanguage, iText)).execute();
    float elapsedSeconds = getElapsedSecs(start);

    if (OMultiValue.isMultiValue(result) && !(result instanceof Map<?, ?>)) {
      if (result instanceof List<?>)
        currentResultSet = (List<OIdentifiable>) result;
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

      else if (className.equalsIgnoreCase("c"))
        // SQL COMMAND
        stream = new OCommandSQL();
      else if (className.equalsIgnoreCase("s"))
        // SCRIPT COMMAND
        stream = new OCommandScript();
      else
        // CREATE THE OBJECT BY INVOKING THE EMPTY CONSTRUCTOR
        stream = (OSerializableStream) Class.forName(className).newInstance();

      return stream.fromStream(OArrays.copyOfRange(iStream, 4 + classNameSize, iStream.length));
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

          cmd += "let a = create vertex set type = 'Citizen', id = '" + threadId + "-" + i + "';";
          cmd += "create edge from $a to " + superNode.getIdentity() + ";";
          cmd += "commit retry " + MAX_RETRIES + ";";
          cmd += "return $transactionRetries;";

          final OCommandRequest command = graph.command(new OCommandScript("sql", cmd));
          final Object res = command.execute();
          if (res instanceof Integer) {
            int retries = (Integer) res;

            counter.incrementAndGet();
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

          cmd += "select from " + superNode.getIdentity() + " lock record;";
          cmd += "let a = create vertex set type = 'Citizen', id = '" + threadId + "-" + i + "';";
          cmd += "create edge from $a to " + superNode.getIdentity() + ";";
          cmd += "commit;";

          Object result = graph.command(new OCommandScript("sql", cmd)).execute();

          counter.incrementAndGet();
        }
        graph.shutdown();
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

    Assert.assertTrue(res3doc.containsField("version"));

    // create record using content keyword and update it in sql batch passing recordID between commands
    final String sql2 = "let var1=INSERT INTO Actor2 CONTENT {Name:\"content\"} RETURN $current.@rid\n"
        + "let var2=UPDATE $var1 SET Bingo=1 RETURN AFTER @rid\n" + "return $var2\n" + "end";
    List<?> res_sql2 = database.command(new OCommandScript("sql", sql2)).execute();
    Assert.assertEquals(res_sql2.size(), 1);
    Assert.assertTrue(((List) res_sql2).get(0) instanceof ORecordId);

    // create record using content keyword and update it in sql batch passing recordID between commands
    final String sql3 = "let var1=INSERT INTO Actor2 CONTENT {Name:\"Bingo owner\"} RETURN @this\n"
        + "let var2=UPDATE $var1 SET Bingo=1 RETURN AFTER\n" + "return $var2\n" + "end";
    List<?> res_sql3 = database.command(new OCommandScript("sql", sql3)).execute();
    Assert.assertEquals(res_sql3.size(), 1);
    Assert.assertTrue(((List) res_sql3).get(0) instanceof ODocument);
    final ODocument sql3doc = (ODocument) (((List) res_sql3).get(0));
    Assert.assertEquals(sql3doc.field("Bingo"), 1);
    Assert.assertEquals(sql3doc.field("Name"), "Bingo owner");
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

      @Override
      public void run() {
        ODatabaseDocumentTx db = new ODatabaseDocumentTx(url).open("admin", "admin");
        try {
          System.out.println("Start sleeping...");
          db.command(new OCommandScript("SQL", "sleep 5000")).execute();
          System.out.println("Sleeping done!");

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

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

  public Object execute(final Map<Object, Object> iArgs) {
    final long start = Orient.instance().getProfiler().startChrono();

    final OCommandExecutorScript command = new OCommandExecutorScript();
    command.parse(new OCommandScript(getLanguage(), getCode()));
    final Object result = command.execute(iArgs);

    if (Orient.instance().getProfiler().isRecording())
      Orient
          .instance()
View Full Code Here

Examples of com.orientechnologies.orient.core.command.script.OCommandScript

    if (language.equalsIgnoreCase("sql"))
      result = graph.command(new OCommandSQL(iText)).execute(iArgs);
    else if (language.equalsIgnoreCase("gremlin"))
      result = graph.command(new OCommandGremlin(iText)).execute(iArgs);
    else
      result = graph.command(new OCommandScript(language, iText)).execute(iArgs);

    if (result instanceof Iterable<?>) {
      // FOR SAKE OF SIMPLICITY TRANSFORM ANY ITERABLE IN ARRAY
      final List<Object> list = new ArrayList<Object>();
      for (Object o : (Iterable<Object>) result) {
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.