Package com.foundationdb.server.error

Examples of com.foundationdb.server.error.SQLParserInternalException


        SQLParser parser = server.getParser();
        StatementNode stmt;
        try {
            stmt = parser.parseStatement(queryExpression);
        } catch (StandardException e) {
            throw new SQLParserInternalException(e);
        }
        StoreAdapter adapter = store().createAdapter(session, SchemaCache.globalSchema(ais));
        CreateAsCompiler compiler = new CreateAsCompiler(server, adapter, false, ais);
        PlanContext plan = new PlanContext(compiler);
        ASTStatementLoader astStatementLoader = new ASTStatementLoader();
        AISBinder binder = new AISBinder(ais, table.getName().getSchemaName());
        try {
            binder.bind(stmt);
            BooleanNormalizer booleanNormalizer = new BooleanNormalizer(parser);
            stmt = booleanNormalizer.normalize(stmt);
            SubqueryFlattener subqueryFlattener = new SubqueryFlattener(parser);
            stmt = subqueryFlattener.flatten((DMLStatementNode)stmt);
        } catch (StandardException ex) {
            throw new SQLParserInternalException(ex);
        }
        plan.setPlan(new AST((DMLStatementNode)stmt, null));
        astStatementLoader.apply(plan);

        List<TableName> tableNames = new ArrayList<>();
View Full Code Here


            ReferenceCollector collector = new ReferenceCollector();
            try {
                getSubquery().accept(collector);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            tableColumnReferences = collector.references;
        }
        return tableColumnReferences;
    }
View Full Code Here

        parameters = new ArrayList<>();
        try {
            root.accept(this);
        }
        catch (StandardException ex) {
            throw new SQLParserInternalException(ex);
        }
        return parameters;
    }
View Full Code Here

                rcl.addResultColumn(resultColumn);
            }
            updateStmt.setReturningList(rcl);
        }
        catch (StandardException ex) {
            throw new SQLParserInternalException(ex);
        }
    }
View Full Code Here

            try {
                typeId = TypeId.getUserDefinedTypeId(metaData.getColumnTypeName(i),
                                                     false);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
        }
        if (typeId.isDecimalTypeId()) {
            return new DataTypeDescriptor(typeId,
                                          metaData.getPrecision(i),
View Full Code Here

                                    throw new UnsupportedFKIndexException();
                                } else {
                                    try {
                                        fkNode.setConstraintName(fkeys.iterator().next().getConstraintName().getTableName());
                                    } catch(StandardException ex) {
                                        throw new SQLParserInternalException(ex);
                                    }
                                }
                            } else if(origTable.getReferencingForeignKey(fkNode.getConstraintName().getTableName()) == null) {
                                skipOrThrow(context,
                                            fkNode.getExistenceCheck(),
View Full Code Here

                                                            StatementType.DROP_DEFAULT,
                                                            isGrouping,
                                                            null /*existence*/,
                                                            node.getParserContext());
        } catch(StandardException ex) {
            throw new SQLParserInternalException(ex);
        }
    }
View Full Code Here

        if (subqueryNode.getLeftOperand() != null) {
            try {
                subqueryNode.getLeftOperand().accept(this);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
        }

        ResultSetNode resultSet = subqueryNode.getResultSet();
        ResultColumnList resultColumns = resultSet.getResultColumns();
        // The parser does not enforce the fact that a subquery can only
        // return a single column, so we must check here.
        if (resultColumns.size() != 1) {
            switch (subqueryNode.getSubqueryType()) {
            case IN:
            case NOT_IN:
            case EXISTS:
            case NOT_EXISTS:
                break;
            case EXPRESSION:
                if (allowSubqueryMultipleColumns)
                    break;
                /* else falls through */
            default:
                throw new SubqueryOneColumnException();
            }
        }

        SubqueryNode.SubqueryType subqueryType = subqueryNode.getSubqueryType();
        /* Verify the usage of "*" in the select list:
         *  o    Only valid in EXISTS subqueries
         *  o    If the AllResultColumn is qualified, then we have to verify
         *       that the qualification is a valid exposed name.
         *       NOTE: The exposed name can come from an outer query block.
         */
        verifySelectStarSubquery(resultSet, subqueryType);

        /* For an EXISTS subquery:
         *  o    If the SELECT list is a "*", then we convert it to a true.
         *       (We need to do the conversion since we don't want the "*" to
         *       get expanded.)
         */
        if (subqueryType == SubqueryNode.SubqueryType.EXISTS) {
            try {
                resultSet = setResultToBooleanTrueNode(resultSet);
            }
            catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            subqueryNode.setResultSet(resultSet);
        }
    }
View Full Code Here

            default:
                return null;
            }
        }
        catch (StandardException ex) {
            throw new SQLParserInternalException(ex);
        }
    }
View Full Code Here

                fromTable.setUserData(new TableBinding(table, false));

                fromList = (FromList)nodeFactory.getNode(NodeTypes.FROM_LIST, Boolean.FALSE, parserContext);
                fromList.add(fromTable);
            } catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            node.setUserData(fromTable);
           
            for (int index = 0; index < rcl.size(); index ++) {
                ResultColumn rc = rcl.get(index);
                if (rc instanceof AllResultColumn) {
                    AllResultColumn arc = (AllResultColumn)rc;
                    ResultColumnList allExpansion = expandAll(tableName, fromList, false);
                    // Make sure that every column has a name.
                    for (ResultColumn nrc : allExpansion) {
                        guaranteeColumnName(nrc);
                    }
                    // Replace the AllResultColumn with the expanded list.
                    rcl.remove(index);
                    for (int inner = 0; inner < allExpansion.size(); inner++) {
                        rcl.add(index + inner, allExpansion.get(inner));
                    }
                    index += allExpansion.size() - 1;
                } else {
                    // Make sure that every column has a name.
                    guaranteeColumnName(rc);
                }
            }
            pushBindingContext(null);
            getBindingContext().tables.add(fromTable);
            try {
                rcl.accept(this);
            } catch (StandardException ex) {
                throw new SQLParserInternalException(ex);
            }
            popBindingContext();
        }
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.error.SQLParserInternalException

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.