GVKun编程网logo

mysql No query specified

25

针对mysqlNoqueryspecified这个问题,本篇文章进行了详细的解答,同时本文还将给你拓展+CategoryInfo:NotSpecified:(:)[],PSSecurityExcept

针对mysql No query specified这个问题,本篇文章进行了详细的解答,同时本文还将给你拓展+ CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId :...、C#连接MySQL时出现Unable to connect to any of the specified MySQL hosts.错误、com.facebook.presto.sql.tree.QuerySpecification的实例源码、HierarchyRequestError:Nodecannotbeinsertedatthespecifiedpointinthe等相关知识,希望可以帮助到你。

本文目录一览:

mysql No query specified

mysql No query specified

MysqL

SHOW CREATE TABLE tablename \G;

会出现

ERROR:

No query specified

原因

去掉分号

; \g \G三者选其一即可。

+ CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId :...

+ CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId :...

File C:\Users\danv\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details. At line:1 char:2 + . <<<< ''C:\Users\danv\Documents\WindowsPowerShell\profile.ps1'' + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException

 

 

 

win+R

cmd

 

 

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

C#连接MySQL时出现Unable to connect to any of the specified MySQL hosts.错误

C#连接MySQL时出现Unable to connect to any of the specified MySQL hosts.错误

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="DalAssemblyName" value="DAL"/>
    <!--<add key="connString" value="server=.;database=MyDb;uid=sa;pwd=123456"/>-->
    
    <add key="MySqlDalAssemblyName" value="MySqlDAL"/>
    <add key="connString" value="server=127.0.0.1;port=3306;user id = root;password=root;database=MyDB;charset=utf8"/>
  </appSettings>
</configuration>

此错误的解决办法如下:

1.检查连接语句是否正确
2.检查配置:构造MySqlConnection时是否传递了连接语句m_strConnect

检查一下,发现是某个地方的连接写错了。

3.检查防火墙是否关闭

以上是我的个人经验

com.facebook.presto.sql.tree.QuerySpecification的实例源码

com.facebook.presto.sql.tree.QuerySpecification的实例源码

项目:presto    文件:QueryPlanner.java   
@Override
protected PlanBuilder visitQuerySpecification(QuerySpecification node,Void context)
{
    PlanBuilder builder = planFrom(node);

    builder = appendSemiJoins(builder,analysis.getInPredicates(node));
    builder = appendScalarsubqueryJoins(builder,analysis.getScalarsubqueries(node));

    builder = filter(builder,analysis.getWhere(node));
    builder = aggregate(builder,node);
    builder = filter(builder,analysis.getHaving(node));

    builder = window(builder,node);

    List<FieldOrExpression> orderBy = analysis.getorderByExpressions(node);
    List<FieldOrExpression> outputs = analysis.getoutputExpressions(node);
    builder = project(builder,Iterables.concat(orderBy,outputs));

    builder = distinct(builder,node,outputs,orderBy);
    builder = sort(builder,node);
    builder = project(builder,analysis.getoutputExpressions(node));
    builder = limit(builder,node);

    return builder;
}
项目:presto    文件:QueryPlanner.java   
private PlanBuilder planFrom(QuerySpecification node)
{
    RelationPlan relationPlan;

    if (node.getFrom().isPresent()) {
        relationPlan = new RelationPlanner(analysis,symbolAllocator,idAllocator,Metadata,session)
                .process(node.getFrom().get(),null);
    }
    else {
        relationPlan = planImplicitTable();
    }

    TranslationMap translations = new TranslationMap(relationPlan,analysis);

    // Make field->symbol mapping from underlying relation plan available for translations
    // This makes it possible to rewrite FieldOrExpressions that reference fields from the FROM clause directly
    translations.setFieldMappings(relationPlan.getoutputSymbols());

    return new PlanBuilder(translations,relationPlan.getRoot(),relationPlan.getSampleWeight());
}
项目:presto    文件:QueryPlanner.java   
private PlanBuilder distinct(PlanBuilder subPlan,QuerySpecification node,List<FieldOrExpression> outputs,List<FieldOrExpression> orderBy)
{
    if (node.getSelect().isdistinct()) {
        checkState(outputs.containsAll(orderBy),"Expected ORDER BY terms to be in SELECT. broken analysis");

        AggregationNode aggregation = new AggregationNode(idAllocator.getNextId(),subPlan.getRoot(),subPlan.getRoot().getoutputSymbols(),ImmutableMap.<Symbol,FunctionCall>of(),Signature>of(),Symbol>of(),AggregationNode.Step.SINGLE,Optional.empty(),1.0,Optional.empty());

        return new PlanBuilder(subPlan.getTranslations(),aggregation,subPlan.getSampleWeight());
    }

    return subPlan;
}
项目:presto    文件:StatementAnalyzer.java   
@Override
protected RelationType visitQuerySpecification(QuerySpecification node,AnalysisContext parentContext)
{
    // Todo: extract candidate names from SELECT,WHERE,HAVING,GROUP BY and ORDER BY expressions
    // to pass down to analyzefrom

    AnalysisContext context = new AnalysisContext(parentContext);

    RelationType tupleDescriptor = analyzefrom(node,context);

    node.getWhere().ifPresent(where -> analyzeWhere(node,tupleDescriptor,context,where));

    List<FieldOrExpression> outputExpressions = analyzeSelect(node,context);
    List<List<FieldOrExpression>> groupByExpressions = analyzeGroupBy(node,outputExpressions);
    List<FieldOrExpression> orderByExpressions = analyzeOrderBy(node,outputExpressions);
    analyzeHaving(node,context);

    analyzeAggregations(node,groupByExpressions,outputExpressions,orderByExpressions,analysis.getColumnReferences());
    analyzeWindowFunctions(node,orderByExpressions);

    RelationType descriptor = computeOutputDescriptor(node,tupleDescriptor);
    analysis.setoutputDescriptor(node,descriptor);

    return descriptor;
}
项目:presto    文件:StatementAnalyzer.java   
private void analyzeHaving(QuerySpecification node,RelationType tupleDescriptor,AnalysisContext context)
{
    if (node.getHaving().isPresent()) {
        Expression predicate = node.getHaving().get();

        ExpressionAnalysis expressionAnalysis = analyzeExpression(predicate,context);
        analysis.recordSubqueries(node,expressionAnalysis);

        Type predicateType = expressionAnalysis.getType(predicate);
        if (!predicateType.equals(BOOLEAN) && !predicateType.equals(UNKNowN)) {
            throw new SemanticException(TYPE_MISMATCH,predicate,"HAVING clause must evaluate to a boolean: actual type %s",predicateType);
        }

        analysis.setHaving(node,predicate);
    }
}
项目:presto-query-formatter    文件:StatementFormatter.java   
@Override
protected Void visitQuerySpecification(QuerySpecification node,Integer indent)
{
    process(node.getSelect(),indent);

    if (node.getFrom().isPresent()) {
        append(indent,"FROM");
        builder.append('\n');
        append(indent,"  ");
        process(node.getFrom().get(),indent);
    }

    builder.append('\n');

    if (node.getWhere().isPresent()) {
        append(indent,"WHERE " + formatExpression(node.getWhere().get(),parameters,indent))
                .append('\n');
    }

    if (node.getGroupBy().isPresent()) {
        append(indent,"GROUP BY " + (node.getGroupBy().get().isdistinct() ? " disTINCT " : "") + formatGroupBy(node.getGroupBy().get()
                .getGroupingElements(),indent)).append('\n');
    }

    if (node.getHaving().isPresent()) {
        append(indent,"HAVING " + formatExpression(node.getHaving().get(),indent))
                .append('\n');
    }

    if (node.getorderBy().isPresent()) {
        append(indent,"ORDER BY " + formatSortItems(node.getorderBy().get().getSortItems(),indent))
                .append('\n');
    }

    if (node.getLimit().isPresent()) {
        append(indent,"LIMIT " + node.getLimit().get())
                .append('\n');
    }
    return null;
}
项目:sql4es    文件:QueryParser.java   
/**
 * Builds the provided {@link SearchRequestBuilder} by parsing the {@link Query} using the properties provided.
 * @param sql the original sql statement
 * @param queryBody the Query parsed from the sql
 * @param searchReq the request to build
 * @param props a set of properties to use in certain cases
 * @param tableColumnInfo mapping from available tables to columns and their types
 * @return an array containing [ {@link heading},{@link IComparison} having,List&lt;{@link OrderBy}&gt; orderings,Integer limit]
 * @throws sqlException
 */
public ParseResult parse(String sql,QueryBody queryBody,int maxRows,Properties props,Map<String,Integer>> tableColumnInfo) throws sqlException{
    this.sql = sql.replace("\r"," ").replace("\n"," ");// Todo: this removes lineFeeds from string literals as well!
    this.props = props;
    this.maxRows = maxRows;
    this.tableColumnInfo = tableColumnInfo;

    if(queryBody instanceof QuerySpecification){
        ParseResult result = queryBody.accept(this,null);
        if(result.getException() != null) throw result.getException();
        return result;
    }
    throw new sqlException("The provided query does not contain a QueryBody");
}
项目:sql4es    文件:ESUpdateState.java   
/**
 * Parses and executes the provided insert statement and returns 1 if execution was successful
 * @param sql
 * @param insert
 * @param index
 * @return the number of executed inserts
 * @throws sqlException
 */
public int execute(String sql,Insert insert,String index) throws sqlException{
    if(insert.getQuery().getQueryBody() instanceof Values){
        // parse one or multiple value sets (... VALUES (1,2,'a'),(2,4,'b'),...)
        return this.insertFromValues(sql,insert,index,Utils.getIntProp(props,Utils.PROP_FETCH_SIZE,2500));
    }else if(insert.getQuery().getQueryBody() instanceof QuerySpecification){
        // insert data based on a SELECT statement
        return this.insertFromSelect(sql,2500));
    }else throw new sqlException("UnkNown set of values to insert ("+insert.getQuery().getQueryBody()+")");

}
项目:sql4es    文件:ESUpdateState.java   
/**
 * Creates a view (elasticsearch alias) with given name and query
 * @param sql
 * @param create
 * @param index
 * @return
 * @throws sqlException
 */
public int execute(String sql,CreateView create,String index) throws sqlException{

    String alias = create.getName().toString();
    alias = heading.findOriginal(sql,alias,"\\s+view\\s+","\\s+as\\s+");

    QueryBody queryBody = create.getQuery().getQueryBody();
    if(!(queryBody instanceof QuerySpecification)) throw new sqlException("Statement does not contain expected query specifiction");
    QuerySpecification querySpec = (QuerySpecification)queryBody;
    if(!querySpec.getFrom().isPresent()) throw new sqlException("Add atleast one INDEX to the query to create the view from");

    QueryState state = new BasicQueryState(sql,new heading(),props);
    List<QuerySource> relations = new RelationParser().process(querySpec.getFrom().get(),null);
    String[] indices = new String[relations.size()];
    for(int i=0; i<relations.size(); i++) indices[i] = relations.get(i).getSource();
    new SelectParser().process(querySpec.getSelect(),state);

    IndicesAliasesResponse response;
    if(querySpec.getWhere().isPresent()){
        QueryBuilder query = new WhereParser().process(querySpec.getWhere().get(),state).getQuery();
        response = client.admin().indices().prepareAliases().addalias(indices,query).execute().actionGet();
    }else{
        response = client.admin().indices().prepareAliases().addalias(indices,alias).execute().actionGet();
    }
    if(!response.isAckNowledged()) throw new sqlException("Elasticsearch Failed to create the specified alias");
    this.statement.getConnection().getTypeMap(); // trigger a reload of the table&column set for the connection
    return 0; // the number of altered rows
}
项目:presto    文件:QueryPlanner.java   
private PlanBuilder aggregate(PlanBuilder subPlan,QuerySpecification node)
{
    List<List<FieldOrExpression>> groupingSets = analysis.getGroupingSets(node);
    if (groupingSets.isEmpty()) {
        return subPlan;
    }

    return aggregateGroupingSet(getonlyElement(groupingSets),subPlan,node);
}
项目:presto    文件:RelationPlanner.java   
@Override
protected RelationPlan visitQuerySpecification(QuerySpecification node,Void context)
{
    PlanBuilder subPlan = new QueryPlanner(analysis,session).process(node,null);

    ImmutableList.Builder<Symbol> outputSymbols = ImmutableList.builder();
    for (FieldOrExpression fieldOrExpression : analysis.getoutputExpressions(node)) {
        outputSymbols.add(subPlan.translate(fieldOrExpression));
    }

    return new RelationPlan(subPlan.getRoot(),analysis.getoutputDescriptor(node),outputSymbols.build(),subPlan.getSampleWeight());
}
项目:presto    文件:StatementAnalyzer.java   
private List<List<FieldOrExpression>> analyzeGroupBy(QuerySpecification node,AnalysisContext context,List<FieldOrExpression> outputExpressions)
{
    List<Set<Set<Expression>>> enumeratedGroupingSets = node.getGroupBy().stream()
            .map(GroupingElement::enumerateGroupingSets)
            .distinct()
            .collect(toImmutableList());

    // compute cross product of enumerated grouping sets,if there are any
    List<List<Expression>> computedGroupingSets = ImmutableList.of();
    if (!enumeratedGroupingSets.isEmpty()) {
        computedGroupingSets = Sets.cartesianProduct(enumeratedGroupingSets).stream()
                .map(groupingSetList -> groupingSetList.stream()
                        .flatMap(Collection::stream)
                        .distinct()
                        .collect(toImmutableList()))
                .distinct()
                .collect(toImmutableList());
    }

    // if there are aggregates,but no grouping columns,create a grand total grouping set
    if (computedGroupingSets.isEmpty() && !extractAggregates(node).isEmpty()) {
        computedGroupingSets = ImmutableList.of(ImmutableList.of());
    }

    if (computedGroupingSets.size() > 1) {
        throw new SemanticException(NOT_SUPPORTED,"Grouping by multiple sets of columns is not yet supported");
    }

    List<List<FieldOrExpression>> analyzedGroupingSets = computedGroupingSets.stream()
            .map(groupingSet -> analyzeGroupingColumns(groupingSet,outputExpressions))
            .collect(toImmutableList());

    analysis.setGroupingSets(node,analyzedGroupingSets);
    return analyzedGroupingSets;
}
项目:presto    文件:StatementAnalyzer.java   
private List<FieldOrExpression> analyzeGroupingColumns(List<Expression> groupingColumns,List<FieldOrExpression> outputExpressions)
{
    ImmutableList.Builder<FieldOrExpression> groupingColumnsBuilder = ImmutableList.builder();
    for (Expression groupingColumn : groupingColumns) {
        // first,see if this is an ordinal
        FieldOrExpression groupByExpression;

        if (groupingColumn instanceof LongLiteral) {
            long ordinal = ((LongLiteral) groupingColumn).getValue();
            if (ordinal < 1 || ordinal > outputExpressions.size()) {
                throw new SemanticException(INVALID_ORDINAL,groupingColumn,"GROUP BY position %s is not in select list",ordinal);
            }

            groupByExpression = outputExpressions.get((int) (ordinal - 1));
        }
        else {
            ExpressionAnalysis expressionAnalysis = analyzeExpression(groupingColumn,context);
            analysis.recordSubqueries(node,expressionAnalysis);
            groupByExpression = new FieldOrExpression(groupingColumn);
        }

        Type type;
        if (groupByExpression.isExpression()) {
            Analyzer.verifyNoAggregatesOrWindowFunctions(Metadata,groupByExpression.getExpression(),"GROUP BY");
            type = analysis.getType(groupByExpression.getExpression());
        }
        else {
            type = tupleDescriptor.getFieldByIndex(groupByExpression.getFieldindex()).getType();
        }
        if (!type.isComparable()) {
            throw new SemanticException(TYPE_MISMATCH,"%s is not comparable,and therefore cannot be used in GROUP BY",type);
        }

        groupingColumnsBuilder.add(groupByExpression);
    }
    return groupingColumnsBuilder.build();
}
项目:presto    文件:StatementAnalyzer.java   
private RelationType computeOutputDescriptor(QuerySpecification node,RelationType inputTupleDescriptor)
{
    ImmutableList.Builder<Field> outputFields = ImmutableList.builder();

    for (SelectItem item : node.getSelect().getSelectItems()) {
        if (item instanceof AllColumns) {
            // expand * and T.*
            Optional<Qualifiedname> starPrefix = ((AllColumns) item).getPrefix();

            for (Field field : inputTupleDescriptor.resolveFieldsWithPrefix(starPrefix)) {
                outputFields.add(Field.newUnqualified(field.getName(),field.getType()));
            }
        }
        else if (item instanceof SingleColumn) {
            SingleColumn column = (SingleColumn) item;
            Expression expression = column.getExpression();

            Optional<String> alias = column.getAlias();
            if (!alias.isPresent()) {
                Qualifiedname name = null;
                if (expression instanceof QualifiednameReference) {
                    name = ((QualifiednameReference) expression).getName();
                }
                else if (expression instanceof DereferenceExpression) {
                    name = DereferenceExpression.getQualifiedname((DereferenceExpression) expression);
                }
                if (name != null) {
                    alias = Optional.of(getLast(name.getoriginalParts()));
                }
            }

            outputFields.add(Field.newUnqualified(alias,analysis.getType(expression))); // Todo don't use analysis as a side-channel. Use outputExpressions to look up the type
        }
        else {
            throw new IllegalArgumentException("Unsupported SelectItem type: " + item.getClass().getName());
        }
    }

    return new RelationType(outputFields.build());
}
项目:presto    文件:StatementAnalyzer.java   
private RelationType analyzefrom(QuerySpecification node,AnalysisContext context)
{
    RelationType fromDescriptor = new RelationType();

    if (node.getFrom().isPresent()) {
        fromDescriptor = process(node.getFrom().get(),context);
    }

    return fromDescriptor;
}
项目:presto    文件:StatementAnalyzer.java   
private void analyzeAggregations(QuerySpecification node,List<List<FieldOrExpression>> groupingSets,List<FieldOrExpression> outputExpressions,List<FieldOrExpression> orderByExpressions,Set<Expression> columnReferences)
{
    List<FunctionCall> aggregates = extractAggregates(node);

    if (context.isApproximate()) {
        if (aggregates.stream().anyMatch(FunctionCall::isdistinct)) {
            throw new SemanticException(NOT_SUPPORTED,"disTINCT aggregations not supported for approximate queries");
        }
    }

    ImmutableList<FieldOrExpression> allGroupingColumns = groupingSets.stream()
            .flatMap(Collection::stream)
            .distinct()
            .collect(toImmutableList());

    // is this an aggregation query?
    if (!groupingSets.isEmpty()) {
        // ensure SELECT,ORDER BY and HAVING are constant with respect to group
        // e.g,these are all valid expressions:
        //     SELECT f(a) GROUP BY a
        //     SELECT f(a + 1) GROUP BY a + 1
        //     SELECT a + sum(b) GROUP BY a

        for (FieldOrExpression fieldOrExpression : Iterables.concat(outputExpressions,orderByExpressions)) {
            verifyAggregations(node,allGroupingColumns,fieldOrExpression,columnReferences);
        }

        if (node.getHaving().isPresent()) {
            verifyAggregations(node,new FieldOrExpression(node.getHaving().get()),columnReferences);
        }
    }
}
项目:presto    文件:StatementAnalyzer.java   
private void verifyAggregations(
        QuerySpecification node,List<FieldOrExpression> groupByExpressions,FieldOrExpression fieldOrExpression,Set<Expression> columnReferences)
{
    AggregationAnalyzer analyzer = new AggregationAnalyzer(groupByExpressions,columnReferences);

    if (fieldOrExpression.isExpression()) {
        analyzer.analyze(fieldOrExpression.getExpression());
    }
    else {
        int fieldindex = fieldOrExpression.getFieldindex();
        if (!analyzer.analyze(fieldindex)) {
            Field field = tupleDescriptor.getFieldByIndex(fieldindex);

            if (field.getRelationAlias().isPresent()) {
                if (field.getName().isPresent()) {
                    throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY,"Column '%s.%s' not in GROUP BY clause",field.getRelationAlias().get(),field.getName().get());
                }
                else {
                    throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY,"Columns from '%s' not in GROUP BY clause",field.getRelationAlias().get());
                }
            }
            else {
                if (field.getName().isPresent()) {
                    throw new SemanticException(MUST_BE_AGGREGATE_OR_GROUP_BY,"Column '%s' not in GROUP BY clause","Some columns from FROM clause not in GROUP BY clause");
                }
            }
        }
    }
}
项目:presto    文件:sqlFormatter.java   
@Override
protected Void visitQuerySpecification(QuerySpecification node,"WHERE " + formatExpression(node.getWhere().get()))
                .append('\n');
    }

    if (!node.getGroupBy().isEmpty()) {
        append(indent,"GROUP BY " + formatGroupBy(node.getGroupBy())).append('\n');
    }

    if (node.getHaving().isPresent()) {
        append(indent,"HAVING " + formatExpression(node.getHaving().get()))
                .append('\n');
    }

    if (!node.getorderBy().isEmpty()) {
        append(indent,"ORDER BY " + formatSortItems(node.getorderBy()))
                .append('\n');
    }

    if (node.getLimit().isPresent()) {
        append(indent,"LIMIT " + node.getLimit().get())
                .append('\n');
    }
    return null;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitQueryNowith(sqlbaseParser.QueryNowithContext context)
{
    QueryBody term = (QueryBody) visit(context.queryTerm());

    if (term instanceof QuerySpecification) {
        // When we have a simple query specification
        // followed by order by limit,fold the order by and limit
        // clauses into the query specification (analyzer/planner
        // expects this structure to resolve references with respect
        // to columns defined in the query specification)
        QuerySpecification query = (QuerySpecification) term;

        return new Query(
                getLocation(context),Optional.<With>empty(),new QuerySpecification(
                        getLocation(context),query.getSelect(),query.getFrom(),query.getWhere(),query.getGroupBy(),query.getHaving(),visit(context.sortItem(),SortItem.class),getTextIfPresent(context.limit)),ImmutableList.of(),Optional.<String>empty(),getTextIfPresent(context.confidence)
                        .map(confidence -> new Approximate(getLocation(context),confidence)));
    }

    return new Query(
            getLocation(context),term,getTextIfPresent(context.limit),getTextIfPresent(context.confidence)
                    .map(confidence -> new Approximate(getLocation(context),confidence)));
}
项目:presto    文件:QueryUtil.java   
public static Query simpleQuery(Select select,Relation from,Optional<Expression> where,List<GroupingElement> groupBy,Optional<Expression> having,List<SortItem> ordering,Optional<String> limit)
{
    return query(new QuerySpecification(
            select,Optional.of(from),where,groupBy,having,ordering,limit));
}
项目:presto    文件:TestsqlParser.java   
private static QuerySpecification createSelect123()
{
    return new QuerySpecification(
            selectList(new LongLiteral("123")),Optional.empty()
    );
}
项目:EchoQuery    文件:sqlFormatter.java   
@Override
protected Void visitQuerySpecification(QuerySpecification node,"LIMIT " + node.getLimit().get())
                .append('\n');
    }
    return null;
}
项目:presto    文件:QueryPlanner.java   
private PlanBuilder sort(PlanBuilder subPlan,QuerySpecification node)
{
    return sort(subPlan,node.getorderBy(),node.getLimit(),analysis.getorderByExpressions(node));
}
项目:presto    文件:QueryPlanner.java   
private PlanBuilder limit(PlanBuilder subPlan,QuerySpecification node)
{
    return limit(subPlan,node.getLimit());
}
项目:presto    文件:Analysis.java   
public void setAggregates(QuerySpecification node,List<FunctionCall> aggregates)
{
    this.aggregates.put(node,aggregates);
}
项目:presto    文件:Analysis.java   
public List<FunctionCall> getAggregates(QuerySpecification query)
{
    return aggregates.get(query);
}
项目:presto    文件:Analysis.java   
public void setGroupingSets(QuerySpecification node,List<List<FieldOrExpression>> expressions)
{
    groupByExpressions.put(node,expressions);
}
项目:presto    文件:Analysis.java   
public List<List<FieldOrExpression>> getGroupingSets(QuerySpecification node)
{
    return groupByExpressions.get(node);
}
项目:presto    文件:Analysis.java   
public Expression getWhere(QuerySpecification node)
{
    return where.get(node);
}
项目:presto    文件:Analysis.java   
public void setHaving(QuerySpecification node,Expression expression)
{
    having.put(node,expression);
}
项目:presto    文件:Analysis.java   
public void setwindowFunctions(QuerySpecification node,List<FunctionCall> functions)
{
    windowFunctions.put(node,functions);
}
项目:presto    文件:Analysis.java   
public Map<QuerySpecification,List<FunctionCall>> getwindowFunctions()
{
    return windowFunctions;
}
项目:presto    文件:Analysis.java   
public List<FunctionCall> getwindowFunctions(QuerySpecification query)
{
    return windowFunctions.get(query);
}
项目:presto    文件:Analysis.java   
public Expression getHaving(QuerySpecification query)
{
    return having.get(query);
}
项目:presto    文件:StatementAnalyzer.java   
private void analyzeWindowFunctions(QuerySpecification node,List<FieldOrExpression> orderByExpressions)
{
    WindowFunctionExtractor extractor = new WindowFunctionExtractor();

    for (FieldOrExpression fieldOrExpression : Iterables.concat(outputExpressions,orderByExpressions)) {
        if (fieldOrExpression.isExpression()) {
            extractor.process(fieldOrExpression.getExpression(),null);
            new WindowFunctionValidator().process(fieldOrExpression.getExpression(),analysis);
        }
    }

    List<FunctionCall> windowFunctions = extractor.getwindowFunctions();

    for (FunctionCall windowFunction : windowFunctions) {
        Window window = windowFunction.getwindow().get();

        WindowFunctionExtractor nestedExtractor = new WindowFunctionExtractor();
        for (Expression argument : windowFunction.getArguments()) {
            nestedExtractor.process(argument,null);
        }

        for (Expression expression : window.getPartitionBy()) {
            nestedExtractor.process(expression,null);
        }

        for (SortItem sortItem : window.getorderBy()) {
            nestedExtractor.process(sortItem.getSortKey(),null);
        }

        if (window.getFrame().isPresent()) {
            nestedExtractor.process(window.getFrame().get(),null);
        }

        if (!nestedExtractor.getwindowFunctions().isEmpty()) {
            throw new SemanticException(nesTED_WINDOW,"Cannot nest window functions inside window function '%s': %s",windowFunction,extractor.getwindowFunctions());
        }

        if (windowFunction.isdistinct()) {
            throw new SemanticException(NOT_SUPPORTED,"disTINCT in window function parameters not yet supported: %s",windowFunction);
        }

        if (window.getFrame().isPresent()) {
            analyzeWindowFrame(window.getFrame().get());
        }

        List<TypeSignature> argumentTypes = Lists.transform(windowFunction.getArguments(),expression -> analysis.getType(expression).getTypeSignature());

        FunctionKind kind = Metadata.getFunctionRegistry().resolveFunction(windowFunction.getName(),argumentTypes,false).getKind();
        if (kind != AGGREGATE && kind != APPROXIMATE_AGGREGATE && kind != WINDOW) {
            throw new SemanticException(MUST_BE_WINDOW_FUNCTION,"Not a window function: %s",windowFunction.getName());
        }
    }

    analysis.setwindowFunctions(node,windowFunctions);
}
项目:presto    文件:StatementAnalyzer.java   
private List<FieldOrExpression> analyzeSelect(QuerySpecification node,AnalysisContext context)
{
    ImmutableList.Builder<FieldOrExpression> outputExpressionBuilder = ImmutableList.builder();

    for (SelectItem item : node.getSelect().getSelectItems()) {
        if (item instanceof AllColumns) {
            // expand * and T.*
            Optional<Qualifiedname> starPrefix = ((AllColumns) item).getPrefix();

            List<Field> fields = tupleDescriptor.resolveFieldsWithPrefix(starPrefix);
            if (fields.isEmpty()) {
                if (starPrefix.isPresent()) {
                    throw new SemanticException(MISSING_TABLE,item,"Table '%s' not found",starPrefix.get());
                }
                else {
                    throw new SemanticException(WILDCARD_WITHOUT_FROM,"SELECT * not allowed in queries without FROM clause");
                }
            }

            for (Field field : fields) {
                int fieldindex = tupleDescriptor.indexOf(field);
                outputExpressionBuilder.add(new FieldOrExpression(fieldindex));

                if (node.getSelect().isdistinct() && !field.getType().isComparable()) {
                    throw new SemanticException(TYPE_MISMATCH,node.getSelect(),"disTINCT can only be applied to comparable types (actual: %s)",field.getType());
                }
            }
        }
        else if (item instanceof SingleColumn) {
            SingleColumn column = (SingleColumn) item;
            ExpressionAnalysis expressionAnalysis = analyzeExpression(column.getExpression(),expressionAnalysis);
            outputExpressionBuilder.add(new FieldOrExpression(column.getExpression()));

            Type type = expressionAnalysis.getType(column.getExpression());
            if (node.getSelect().isdistinct() && !type.isComparable()) {
                throw new SemanticException(TYPE_MISMATCH,"disTINCT can only be applied to comparable types (actual: %s): %s",type,column.getExpression());
            }
        }
        else {
            throw new IllegalArgumentException("Unsupported SelectItem type: " + item.getClass().getName());
        }
    }

    ImmutableList<FieldOrExpression> result = outputExpressionBuilder.build();
    analysis.setoutputExpressions(node,result);

    return result;
}
项目:presto    文件:TestsqlParser.java   
@Test
public void testSelectWithRowType()
        throws Exception
{
    assertStatement("SELECT col1.f1,col2,col3.f1.f2.f3 FROM table1",new Query(
                    Optional.empty(),new QuerySpecification(
                            selectList(
                                    new DereferenceExpression(new QualifiednameReference(Qualifiedname.of("col1")),"f1"),new QualifiednameReference(Qualifiedname.of("col2")),new DereferenceExpression(
                                            new DereferenceExpression(new DereferenceExpression(new QualifiednameReference(Qualifiedname.of("col3")),"f2"),"f3")),Optional.of(new Table(Qualifiedname.of("table1"))),Optional.empty()),ImmutableList.<SortItem>of(),Optional.empty()));

    assertStatement("SELECT col1.f1[0],col3[2].f2.f3,col4[4] FROM table1",new QuerySpecification(
                            selectList(
                                    new SubscriptExpression(new DereferenceExpression(new QualifiednameReference(Qualifiedname.of("col1")),new LongLiteral("0")),new DereferenceExpression(new DereferenceExpression(new SubscriptExpression(new QualifiednameReference(Qualifiedname.of("col3")),new LongLiteral("2")),"f3"),new SubscriptExpression(new QualifiednameReference(Qualifiedname.of("col4")),new LongLiteral("4"))
                            ),Optional.empty()));

    assertStatement("SELECT test_row(11,12).col0",new QuerySpecification(
                            selectList(
                                    new DereferenceExpression(new FunctionCall(Qualifiedname.of("test_row"),Lists.newArrayList(new LongLiteral("11"),new LongLiteral("12"))),"col0")
                            ),Optional.empty()));
}

HierarchyRequestError:Nodecannotbeinsertedatthespecifiedpointinthe

HierarchyRequestError:Nodecannotbeinsertedatthespecifiedpointinthe

   在使用$.get()方法时,出现了以上的错误信息:

         HierarchyRequestError: Node cannot be inserted at the specified point in the  hierarchy

        下面是我的源代码:

$(document).ready(function() {var pageNum = 1;$(''#more-photos'').click(function() {var $link = $(this);var url = $link.attr(''href'');if (url) {$.get(url, function(data) {$(''#gallery'').append(data);});pageNum++;if (pageNum < 20) {$link.attr(''href'', ''pages/'' + pageNum + ''.html'');}else {$link.remove();}}return false;});});

       其中,出现错误的就在:

$.get(url, function(data) {$(''#gallery'').append(data);});

    因为,我请求的是一个html的页面片段,将得到的html片段加载在index页面中,而jQuery.get()方法中漏写了dataType。

    在jQuery中的官网中,datatype默认为:智能匹配。即,由电脑智能猜测你的datatype是什么类型的,很显然,本次没有猜对。

    【解决方法】:很简单,将datatype写上。

$.get(url, function(data) {$(''#gallery'').append(data);},''html'');

我们今天的关于mysql No query specified的分享已经告一段落,感谢您的关注,如果您想了解更多关于+ CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId :...、C#连接MySQL时出现Unable to connect to any of the specified MySQL hosts.错误、com.facebook.presto.sql.tree.QuerySpecification的实例源码、HierarchyRequestError:Nodecannotbeinsertedatthespecifiedpointinthe的相关信息,请在本站查询。

本文标签: