Package com.orientechnologies.orient.core.sql

Examples of com.orientechnologies.orient.core.sql.OCommandSQLParsingException


    if (function == null)
      // AGGREGATION ?
      function = OSQLEngine.getInstance().getAggregationFunction(funcName);

    if (function == null)
      throw new OCommandSQLParsingException("Unknow function " + funcName + "()");

    if (function.getMinParams() > -1 && funcParamsText.size() < function.getMinParams() || function.getMaxParams() > -1
        && funcParamsText.size() > function.getMaxParams())
      throw new IllegalArgumentException("Syntax error. Expected: " + function.getSyntax());
View Full Code Here


    final List<String> funcParamsText = OStringSerializerHelper.getParameters(iText);

    function = OSQLEngine.getInstance().getFunction(funcName);
    if (function == null)
      throw new OCommandSQLParsingException("Unknown function " + funcName + "()");

    // PARSE PARAMETERS
    this.configuredParameters = new Object[funcParamsText.size()];
    for (int i = 0; i < funcParamsText.size(); ++i)
      this.configuredParameters[i] = funcParamsText.get(i);
View Full Code Here

              "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by ttt) UNIQUE"))
          .execute();
      Assert.fail();
    } catch (OResponseProcessingException e) {
      Assert.assertTrue(e.getCause() instanceof OCommandSQLParsingException);
      OCommandSQLParsingException exception = (OCommandSQLParsingException) e.getCause();

      Assert
          .assertTrue(exception
              .getMessage()
              .contains(
                  "Error on parsing command at position #84: Illegal field name format, should be '<property> [by key|value]' but was 'prop3 by ttt'\n"
                      + "Command: CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by ttt) UNIQUE\n"
                      + "--------------------------------------------------------------------------------------------^"));
View Full Code Here

              "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 b value) UNIQUE"))
          .execute();
      Assert.fail();
    } catch (OResponseProcessingException e) {
      Assert.assertTrue(e.getCause() instanceof OCommandSQLParsingException);
      OCommandSQLParsingException exception = (OCommandSQLParsingException) e.getCause();

      Assert
          .assertTrue(exception
              .getMessage()
              .contains(
                  "Error on parsing command at position #84: Illegal field name format, should be '<property> [by key|value]' but was 'prop3 b value'\n"
                      + "Command: CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 b value) UNIQUE\n"
                      + "--------------------------------------------------------------------------------------------^"));
View Full Code Here

              "CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by value t) UNIQUE"))
          .execute();
      Assert.fail();
    } catch (OResponseProcessingException e) {
      Assert.assertTrue(e.getCause() instanceof OCommandSQLParsingException);
      OCommandSQLParsingException exception = (OCommandSQLParsingException) e.getCause();

      Assert
          .assertTrue(exception
              .getMessage()
              .contains(
                  "Error on parsing command at position #84: Illegal field name format, should be '<property> [by key|value]' but was 'prop3 by value t'\n"
                      + "Command: CREATE INDEX sqlCreateIndexEmbeddedMapWrongSpecifierIndex ON sqlCreateIndexTestClass (prop3 by value t) UNIQUE\n"
                      + "--------------------------------------------------------------------------------------------^"));
View Full Code Here

  public static List<String> getParameters(final String iText) {
    final List<String> params = new ArrayList<String>();
    try {
      getParameters(iText, 0, -1, params);
    } catch (Exception e) {
      throw new OCommandSQLParsingException("Error on reading parameters in: " + iText);
    }
    return params;
  }
View Full Code Here

        // skip to text end
        int tend = i;
        while (true) {
          tend = iOrigin.indexOf('\'', tend + 1);
          if (tend < 0) {
            throw new OCommandSQLParsingException("Could not find end of text area.", iOrigin, i);
          }

          if (iOrigin.charAt(tend - 1) == '\\') {
            // inner quote, skip it
            continue;
View Full Code Here

    return empty;
  }

  @Override
  protected void throwSyntaxErrorException(String iText) {
    throw new OCommandSQLParsingException(iText + ". Use " + getSyntax(), parserText, parserGetPreviousPosition());
  }
View Full Code Here

      executor.setProgressListener(subCommand.getProgressListener());
      executor.parse(subCommand);
      context.setChild(executor.getContext());

      if (!(executor instanceof Iterable<?>))
        throw new OCommandSQLParsingException("Sub-query cannot be iterated because doesn't implement the Iterable interface: "
            + subCommand);

      targetQuery = executor;
      targetRecords = (Iterable<? extends OIdentifiable>) executor;
View Full Code Here

  }

  protected void throwSyntaxErrorException(final String iText) {
    final String syntax = getSyntax();
    if (syntax.equals("?"))
      throw new OCommandSQLParsingException(iText, parserText, parserGetPreviousPosition());

    throw new OCommandSQLParsingException(iText + ". Use " + syntax, parserText, parserGetPreviousPosition());
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.sql.OCommandSQLParsingException

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.