Package com.akiban.sql

Examples of com.akiban.sql.StandardException


        while (commaSeparatedProperties.hasMoreTokens()) {
            //Now verify that tokens delimited by ,s follow propertyName=value pattern
            String currentProperty = commaSeparatedProperties.nextToken();
            equalOperatorSeparatedProperty = new StringTokenizer(currentProperty,"=", true);
            if (equalOperatorSeparatedProperty.countTokens() != 3)
                {if (true) throw new StandardException("Invalid properties syntax");}
            else {
                String key = equalOperatorSeparatedProperty.nextToken().trim();
                if (!equalOperatorSeparatedProperty.nextToken().equals("="))
                    {if (true) throw new StandardException("Invalid properties syntax");}
                String value = equalOperatorSeparatedProperty.nextToken().trim();
                parserContext.checkStringLiteralLengthLimit(value);
                /* Trim off the leading and trailing ', and compress all '' to ' */
                if (value.startsWith("'") && value.endsWith("'"))
                    value = trimAndCompressQuotes(value, SINGLEQUOTES, false);
                /* Trim off the leading and trailing ", and compress all "" to " */
                else if (value.startsWith("\u005c"") && value.endsWith("\u005c""))
                    value = trimAndCompressQuotes(value, DOUBLEQUOTES, false);
                else
                    value = value.toUpperCase();
                // Do not allow user to specify multiple values for the same key
                if (properties.put(key, value) != null) {
                    {if (true) throw new StandardException("Duplicate property: " + key);}
                }
            }
        }
        //if this property override is supported in internal mode only, then do that verification here.
        if (!propertiesUseAllowed) {
View Full Code Here


        }
        else {
            /* schema name specified for both */
            if (! (indexName.getSchemaName().equals(
                        tableName.getSchemaName()))) {
                {if (true) throw new StandardException("Specified schemas do not match: " +
                                            indexName + ", " + tableName);}
            }
        }
        {if (true) return (StatementNode)nodeFactory.getNode(NodeTypes.CREATE_INDEX_NODE,
                                                  unique,
View Full Code Here

    switch (jj_nt.kind) {
    case SPECIFIC:
      jj_consume_token(SPECIFIC);
      clauseValue = qualifiedName();
        clausePosition = CreateAliasNode.TABLE_NAME;
        {if (true) throw new StandardException("Not implemented SPECIFIC identifier");}
      break;
    case DYNAMIC:
    case RESULT:
      switch (jj_nt.kind) {
      case DYNAMIC:
        jj_consume_token(DYNAMIC);
        break;
      default:
        jj_la1[297] = jj_gen;
        ;
      }
      jj_consume_token(RESULT);
      jj_consume_token(SETS);
      drs = uint_value();
        if (!isProcedure)
            {if (true) throw new StandardException("Only allowed on procedure: RESULT SETS");}
        clauseValue = drs;
        clausePosition = CreateAliasNode.DYNAMIC_RESULT_SET_COUNT;
      break;
    case LANGUAGE:
      jj_consume_token(LANGUAGE);
      clauseValue = routineLanguage();
                                                 clausePosition = CreateAliasNode.LANGUAGE;
      break;
    case DETERMINISTIC:
      jj_consume_token(DETERMINISTIC);
        clauseValue = Boolean.TRUE;
        clausePosition = CreateAliasNode.DETERMINISTIC;
      break;
    case NOT:
      jj_consume_token(NOT);
      jj_consume_token(DETERMINISTIC);
        clauseValue = Boolean.FALSE;
        clausePosition = CreateAliasNode.DETERMINISTIC;
      break;
    case EXTERNAL:
      jj_consume_token(EXTERNAL);
      switch (jj_nt.kind) {
      case NAME:
        jj_consume_token(NAME);
        clauseValue = string();
      clausePosition = CreateAliasNode.EXTERNAL_NAME;
        break;
      case SECURITY:
        jj_consume_token(SECURITY);
        clauseValue = new Boolean(routineSecurityClause());
        clausePosition = CreateAliasNode.ROUTINE_SECURITY_DEFINER;
        break;
      default:
        jj_la1[298] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    case PARAMETER:
      jj_consume_token(PARAMETER);
      jj_consume_token(STYLE);
      clauseValue = parameterStyle();
        clausePosition = CreateAliasNode.PARAMETER_STYLE;
      break;
    case AS:
      jj_consume_token(AS);
      clauseValue = string();
        clausePosition = CreateAliasNode.INLINE_DEFINITION;
      break;
    case NO:
      jj_consume_token(NO);
      jj_consume_token(SQL);
        clauseValue = RoutineAliasInfo.SQLAllowed.NO_SQL;
        clausePosition = CreateAliasNode.SQL_CONTROL;
      break;
    case CONTAINS:
      jj_consume_token(CONTAINS);
      jj_consume_token(SQL);
        clauseValue = RoutineAliasInfo.SQLAllowed.CONTAINS_SQL;
        clausePosition = CreateAliasNode.SQL_CONTROL;
      break;
    case READS:
      jj_consume_token(READS);
      jj_consume_token(SQL);
      jj_consume_token(DATA);
        clauseValue = RoutineAliasInfo.SQLAllowed.READS_SQL_DATA;
        clausePosition = CreateAliasNode.SQL_CONTROL;
      break;
    case MODIFIES:
      jj_consume_token(MODIFIES);
      jj_consume_token(SQL);
      jj_consume_token(DATA);
        if (!isProcedure)
            {if (true) throw new StandardException("Only allowed on procedure: MODIFIES SQL DATA");}
        clauseValue = RoutineAliasInfo.SQLAllowed.MODIFIES_SQL_DATA;
        clausePosition = CreateAliasNode.SQL_CONTROL;
      break;
    case CALLED:
    case RETURNS:
      clauseValue = calledOnNullInput(isProcedure);
                                                   clausePosition = CreateAliasNode.NULL_ON_NULL_INPUT;
      break;
    default:
      jj_la1[299] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
        if (clausePosition != -1) {
            // check for repeated clause
            if (routineElements[clausePosition] != null) {

                String which = ROUTINE_CLAUSE_NAMES[clausePosition];
                {if (true) throw new StandardException("Repeated " + which + " clause");}
            }

            routineElements[clausePosition] = clauseValue;
        }
  }
View Full Code Here

      break;
    case RETURNS:
      jj_consume_token(RETURNS);
      jj_consume_token(NULL);
        if (isProcedure)
            {if (true) throw new StandardException("Not allowed for procedure RETURNS NULL ON NULL INPUT");}
        calledOnNull = Boolean.FALSE;
      break;
    default:
      jj_la1[300] = jj_gen;
      jj_consume_token(-1);
View Full Code Here

        /* Parameters not allowed in create view */
        HasNodeVisitor visitor = new HasNodeVisitor(ParameterNode.class);
        queryExpression.accept(visitor);
        if (visitor.hasNode()) {
            {if (true) throw new StandardException("Parameters not allowed in CREATE VIEW");}
        }

        {if (true) return (StatementNode)nodeFactory.getNode(NodeTypes.CREATE_VIEW_NODE,
                                                  tableName,
                                                  resultColumns,
View Full Code Here

        actionEnd = getToken(0).endOffset;
        actionBegin = tokenHolder[0].beginOffset;

        // No DML in action node for BEFORE triggers.
        if (isBefore.booleanValue() && (actionNode instanceof DMLModStatementNode)) {
            {if (true) throw new StandardException("DML not allowed in BEFORE trigger");}
        }

        // No params in trigger action.
        HasNodeVisitor visitor = new HasNodeVisitor(ParameterNode.class);
        actionNode.accept(visitor);
        if (visitor.hasNode()) {
            {if (true) throw new StandardException("Parameters not allowed in trigger action");}
        }

        {if (true) return (StatementNode)nodeFactory.getNode(NodeTypes.CREATE_TRIGGER_NODE,
                                                  triggerName,
                                                  tableName,
View Full Code Here

        // which can be either the 2nd token (w/ normal function name)
        // or the 4th token (w/ qualified function name)), then
        // it's not valid.  Catch it here and throw an "invalid
        // default" error (42894) instead of letting it go as
        // a syntax error (this matches DB2 UDB behavior).
        {if (true) throw new StandardException("Invalid default for " + columnName);}
        } else if (jj_2_88(1)) {
          value = datetimeValueFunction();
        {if (true) return value;}
        } else if (jj_2_89(1)) {
          // Only (valid) thing left is literals (i.e. actual constants).
View Full Code Here

    tok = jj_consume_token(EXACT_NUMERIC);
        try {
            {if (true) return getNumericNode(getNumericString(tok, sign), true);}
        }
        catch (NumberFormatException e) {
            {if (true) throw new StandardException("Integer literal expected", e);}
        }
    throw new Error("Missing return statement in function");
  }
View Full Code Here

            ePosn = doubleString.indexOf('e');
        assert (ePosn != -1) : "no E or e in approximate numeric";

        // there is a limit on the length of a floatingpoint literal in DB2
        if (doubleString.length() > MAX_FLOATINGPOINT_LITERAL_LENGTH)
            {if (true) throw new StandardException("Floating point literal too long");}
        // if there is no '.' before the e, put one in
        dotPosn = doubleString.substring(0,ePosn).indexOf('.');
        if (dotPosn == -1) {
            doubleImage.insert(ePosn,'.');
            doubleString = doubleImage.toString();
            ePosn++;
        }

        try
        {
            doubleValue = Double.valueOf(doubleString);

        }
        catch (NumberFormatException nfe)
        {
            {if (true) throw new StandardException("Invalid double", nfe);}
        }

        double dv = doubleValue.doubleValue();

        // When the value is 0 it's possible rounded, try to detect it by checking if the mantissa is 0.0
        //   "proof of correctness": any nonzero value (mantissa) with less than 30 characters will not be
        //                                                   rounded to 0.0 by a float/real. This correctly detects the case when
        //                                                   the radix/exponent being "too small" (1e-900) giving a value rounded to zero.
        if ( (dv == 0.0d) && (Double.parseDouble(doubleString.substring(0, ePosn-1)) != 0.0d) )
        {
            {if (true) throw new StandardException("Floating point exponent underflow");}
        }

        if (Double.isNaN(dv) || Double.isInfinite(dv))
            {if (true) throw new StandardException("Floating point exponent overflow");}

        {if (true) return (ValueNode)nodeFactory.getNode(NodeTypes.DOUBLE_CONSTANT_NODE,
                                              doubleValue,
                                              parserContext);}
      break;
View Full Code Here

    tok = jj_consume_token(HEX_STRING);
        String hexLiteral = tok.image;

        //there is a maximum limit on the length of the hex constant
        if (hexLiteral.length()-3 > 65535*2)
            {if (true) throw new StandardException("Hex literal too long");}
        if ((hexLiteral.length()-3)%2 == 1)
            {if (true) throw new StandardException("Hex literal invalid");}

        int bitLength = ((hexLiteral.length() - 3) / 2);
        {if (true) return (ValueNode)
                nodeFactory.getNode(NodeTypes.VARBIT_CONSTANT_NODE,
                                    hexLiteral.substring(2, hexLiteral.length() - 1), bitLength,
View Full Code Here

TOP

Related Classes of com.akiban.sql.StandardException

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.