Package com.orientechnologies.orient.core.command

Examples of com.orientechnologies.orient.core.command.OCommandRequestText


    Object response;

    try {
      db = getProfiledDatabaseInstance(iRequest);

      final OCommandRequestText cmd = (OCommandRequestText) OCommandManager.instance().getRequester(language);

      cmd.setText(text);
      cmd.setLimit(limit);
      cmd.setFetchPlan(fetchPlan);

      final OCommandExecutor executor = OCommandManager.instance().getExecutor(cmd);
      executor.setContext(cmd.getContext());
      executor.setProgressListener(cmd.getProgressListener());
      executor.parse(cmd);

      if (!executor.isIdempotent() && iRequest.httpMethod.equals("GET"))
        throw new OCommandExecutionException("Cannot execute non idempotent command using HTTP GET");
View Full Code Here


    command = (String) resolveValue(iContext, command, true);

    debug(iContext, "Executing: " + (iReadOnly ? "query" : "command") + ": " + command.replace("%", "%%") + "...");

    final OCommandRequestText cmd = new OSQLSynchQuery<OIdentifiable>(command.toString());

    cmd.getContext().setParent(iContext);

    // CREATE THE RIGHT COMMAND BASED ON IDEMPOTENCY
    // final OCommandRequestText cmd = iReadOnly ? new OSQLSynchQuery<OIdentifiable>(command.toString()) : new OCommandSQL(
    // command.toString());

    final String returnVariable = getFieldOfClass(iContext, iConfig, "return", String.class);
    if (returnVariable != null) {
      final List<?> result = cmd.execute();
      debug(iContext, "Returned %d records", result.size());
      return result;
    }

    return cmd;
View Full Code Here

     if (!dbSerializerName.equals(name)) {
       ORecordSerializer ser = ORecordSerializerFactory.instance().getFormat(name);
       ONetworkThreadLocalSerializer.setNetworkSerializer(ser);
     }
     final OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(channel
         .readBytes());
     ONetworkThreadLocalSerializer.setNetworkSerializer(null);

     connection.data.commandDetail = command.getText();

     // ENABLES THE CACHE TO IMPROVE PERFORMANCE OF COMPLEX COMMANDS LIKE TRAVERSE
     // connection.database.getLocalCache().setEnable(true);
     beginResponse();
     try {
       final OAbstractCommandResultListener listener;

       if (asynch) {
         listener = new OAsyncCommandResultListener(this, clientTxId, command.getResultListener());
         command.setResultListener(listener);
       } else
         listener = new OSyncCommandResultListener();

       final long serverTimeout = OGlobalConfiguration.COMMAND_TIMEOUT.getValueAsLong();

       if (serverTimeout > 0 && command.getTimeoutTime() > serverTimeout)
         // FORCE THE SERVER'S TIMEOUT
         command.setTimeout(serverTimeout, command.getTimeoutStrategy());

       if (!isConnectionAlive())
         return;

       // ASSIGNED THE PARSED FETCHPLAN
       listener.setFetchPlan(connection.database.command(command).getFetchPlan());

       final Object result = connection.database.command(command).execute();

       // FETCHPLAN HAS TO BE ASSIGNED AGAIN, because it can be changed by SQL statement
       listener.setFetchPlan(command.getFetchPlan());

       if (asynch) {
         // ASYNCHRONOUS
         if (listener.isEmpty())
           try {
View Full Code Here

  protected OCommandExecutorSQLAbstract delegate;

  @SuppressWarnings("unchecked")
  public OCommandExecutorSQLDelegate parse(final OCommandRequest iCommand) {
    if (iCommand instanceof OCommandRequestText) {
      final OCommandRequestText textRequest = (OCommandRequestText) iCommand;
      final String text = textRequest.getText();
      if (text == null)
        throw new IllegalArgumentException("Command text is null");

      final String textUpperCase = text.toUpperCase(Locale.ENGLISH);
View Full Code Here

  /**
   * Compile the filter conditions only the first time.
   */
  public OCommandExecutorSQLResultsetAbstract parse(final OCommandRequest iRequest) {
    final OCommandRequestText textRequest = (OCommandRequestText) iRequest;

    init(textRequest);

    if (iRequest instanceof OSQLSynchQuery) {
      request = (OSQLSynchQuery<ODocument>) iRequest;
    } else if (iRequest instanceof OSQLAsynchQuery)
      request = (OSQLAsynchQuery<ODocument>) iRequest;
    else {
      // BUILD A QUERY OBJECT FROM THE COMMAND REQUEST
      request = new OSQLSynchQuery<ODocument>(textRequest.getText());
      if (textRequest.getResultListener() != null)
        request.setResultListener(textRequest.getResultListener());
    }
    return this;
  }
View Full Code Here

                  commandAsString += ";" + c.toString();
              }
            } 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)
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.command.OCommandRequestText

Copyright © 2018 www.massapicom. 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.