Package com.orientechnologies.orient.core.sql.functions

Examples of com.orientechnologies.orient.core.sql.functions.OSQLFunction


      // SEARCH FOR THE FUNCTION
      final String funcName = iWord.substring(0, parPos);

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

      OSQLFunction function = OSQLEngine.getInstance().getInlineFunction(funcName);
      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());

      // PARSE PARAMETERS
      final Object[] funcParams = new Object[funcParamsText.size()];
      for (int i = 0; i < funcParamsText.size(); ++i) {
        funcParams[i] = OSQLHelper.parseValue(database, iCommand, funcParamsText.get(i));
View Full Code Here


      // SEARCH FOR THE FUNCTION
      final String funcName = iWord.substring(0, parPos);

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

      OSQLFunction function = OSQLEngine.getInstance().getInlineFunction(funcName);
      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());

      // PARSE PARAMETERS
      final Object[] funcParams = new Object[funcParamsText.size()];
      for (int i = 0; i < funcParamsText.size(); ++i) {
        funcParams[i] = OSQLHelper.parseValue(database, iCommand, funcParamsText.get(i));
View Full Code Here

      // SEARCH FOR THE FUNCTION
      final String funcName = iWord.substring(0, parPos);

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

      OSQLFunction function = OSQLEngine.getInstance().getInlineFunction(funcName);
      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());

      // PARSE PARAMETERS
      final Object[] funcParams = new Object[funcParamsText.size()];
      for (int i = 0; i < funcParamsText.size(); ++i) {
        funcParams[i] = OSQLHelper.parseValue(database, iCommand, funcParamsText.get(i));
View Full Code Here

            } else
              arguments = null;

          } else {
            // LOOK FOR FUNCTION
            final OSQLFunction f = OSQLEngine.getInstance().getFunction(methodName);

            if (f == null)
              // ERROR: METHOD/FUNCTION NOT FOUND OR MISPELLED
              throw new OQueryParsingException(iQueryToParse.parserText,
                  "Syntax error: function or field operator not recognized between the supported ones: "
                      + OSQLEngine.getMethodNames(), 0);

            if (f.getMaxParams() == -1 || f.getMaxParams() > 0) {
              arguments = OStringSerializerHelper.getParameters(part).toArray();
              if (arguments.length + 1 < f.getMinParams() || (f.getMaxParams() > -1 && arguments.length + 1 > f.getMaxParams()))
                throw new OQueryParsingException(iQueryToParse.parserText, "Syntax error: function '" + f.getName() + "' needs "
                    + (f.getMinParams() == f.getMaxParams() ? f.getMinParams() : f.getMinParams() + "-" + f.getMaxParams())
                    + " argument(s) while has been received " + arguments.length, 0);
            } else
              arguments = null;

            method = new OSQLMethodFunctionDelegate(f);
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.sql.functions.OSQLFunction

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.