e21156a754
* Refactor AttributeCache populator code for use from pull. * Pre: add to_value_rc to Cloned. * Pre: add From<StructuredMap> for Binding. * Pre: clarify Store::open_empty. * Pre: StructuredMap cleanup. * Pre: clean up a doc test. * Split projector crate. Pass schema to projector. * CLI support for printing bindings. * Add and use ConjoiningClauses::derive_types_from_find_spec. * Define pull types. * Implement pull on top of the attribute cache layer. * Add pull support to the projector. * Parse pull expressions. * Add simple pull support to connection objects. * Tests for pull. * Compile with Rust 1.25. The only choice involved in this commit is that of replacing the anonymous lifetime '_ with a named lifetime for the cache; since we're accepting a Known, which includes the cache in question, I think it's clear that we expect the function to apply to any given cache lifetime. * Review comments. * Bail on unnamed attribute. * Make assert_parse_failure_contains safe to use. * Rework query parser to report better errors for pull. * Test for mixed wildcard and simple attribute.
79 lines
2.7 KiB
Rust
79 lines
2.7 KiB
Rust
// Copyright 2018 Mozilla
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
// this file except in compliance with the License. You may obtain a copy of the
|
|
// License at http://www.apache.org/licenses/LICENSE-2.0
|
|
// Unless required by applicable law or agreed to in writing, software distributed
|
|
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations under the License.
|
|
|
|
use rusqlite;
|
|
|
|
use mentat_core::{
|
|
ValueTypeSet,
|
|
};
|
|
|
|
use mentat_db;
|
|
|
|
use mentat_query::{
|
|
PlainSymbol,
|
|
};
|
|
|
|
use mentat_query_pull;
|
|
|
|
use aggregates::{
|
|
SimpleAggregationOp,
|
|
};
|
|
|
|
error_chain! {
|
|
types {
|
|
Error, ErrorKind, ResultExt, Result;
|
|
}
|
|
|
|
errors {
|
|
/// We're just not done yet. Message that the feature is recognized but not yet
|
|
/// implemented.
|
|
NotYetImplemented(t: String) {
|
|
description("not yet implemented")
|
|
display("not yet implemented: {}", t)
|
|
}
|
|
CannotProjectImpossibleBinding(op: SimpleAggregationOp) {
|
|
description("no possible types for variable in projection list")
|
|
display("no possible types for value provided to {:?}", op)
|
|
}
|
|
CannotApplyAggregateOperationToTypes(op: SimpleAggregationOp, types: ValueTypeSet) {
|
|
description("cannot apply projection operation to types")
|
|
display("cannot apply projection operation {:?} to types {:?}", op, types)
|
|
}
|
|
InvalidProjection(t: String) {
|
|
description("invalid projection")
|
|
display("invalid projection: {}", t)
|
|
}
|
|
UnboundVariable(var: PlainSymbol) {
|
|
description("cannot project unbound variable")
|
|
display("cannot project unbound variable {:?}", var)
|
|
}
|
|
NoTypeAvailableForVariable(var: PlainSymbol) {
|
|
description("cannot find type for variable")
|
|
display("cannot find type for variable {:?}", var)
|
|
}
|
|
UnexpectedResultsType(actual: &'static str, expected: &'static str) {
|
|
description("unexpected query results type")
|
|
display("expected {}, got {}", expected, actual)
|
|
}
|
|
AmbiguousAggregates(min_max_count: usize, corresponding_count: usize) {
|
|
description("ambiguous aggregates")
|
|
display("min/max expressions: {} (max 1), corresponding: {}", min_max_count, corresponding_count)
|
|
}
|
|
}
|
|
|
|
foreign_links {
|
|
Rusqlite(rusqlite::Error);
|
|
}
|
|
|
|
links {
|
|
DbError(mentat_db::Error, mentat_db::ErrorKind);
|
|
PullError(mentat_query_pull::errors::Error, mentat_query_pull::errors::ErrorKind);
|
|
}
|
|
}
|