Cleanup before merging.
This commit is contained in:
parent
179c8c7908
commit
c46a13f9e1
2 changed files with 22 additions and 21 deletions
|
@ -293,7 +293,7 @@ pub enum SQLTypeAffinity {
|
|||
|
||||
// Put this here rather than in `db` simply because it's widely needed.
|
||||
pub trait SQLValueType {
|
||||
fn value_type_tag(&self) -> i32;
|
||||
fn value_type_tag(&self) -> ValueTypeTag;
|
||||
fn accommodates_integer(&self, int: i64) -> bool;
|
||||
|
||||
/// Return a pair of the ValueTypeTag for this value type, and the SQLTypeAffinity required
|
||||
|
@ -306,7 +306,23 @@ pub trait SQLValueType {
|
|||
}
|
||||
|
||||
impl SQLValueType for ValueType {
|
||||
fn value_type_tag(&self) -> i32 {
|
||||
fn sql_representation(&self) -> (ValueTypeTag, Option<SQLTypeAffinity>) {
|
||||
match *self {
|
||||
ValueType::Ref => (0, None),
|
||||
ValueType::Boolean => (1, None),
|
||||
ValueType::Instant => (4, None),
|
||||
|
||||
// SQLite distinguishes integral from decimal types, allowing long and double to share a tag.
|
||||
ValueType::Long => (5, Some(SQLTypeAffinity::Integer)),
|
||||
ValueType::Double => (5, Some(SQLTypeAffinity::Real)),
|
||||
ValueType::String => (10, None),
|
||||
ValueType::Uuid => (11, None),
|
||||
ValueType::Keyword => (13, None),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn value_type_tag(&self) -> ValueTypeTag {
|
||||
self.sql_representation().0
|
||||
}
|
||||
|
||||
|
@ -334,20 +350,6 @@ impl SQLValueType for ValueType {
|
|||
Uuid => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn sql_representation(&self) -> (ValueTypeTag, Option<SQLTypeAffinity>) {
|
||||
match *self {
|
||||
ValueType::Ref => (0, None),
|
||||
ValueType::Boolean => (1, None),
|
||||
ValueType::Instant => (4, None),
|
||||
// SQLite distinguishes integral from decimal types, allowing long and double to share a tag.
|
||||
ValueType::Long => (5, Some(SQLTypeAffinity::Integer)),
|
||||
ValueType::Double => (5, Some(SQLTypeAffinity::Real)),
|
||||
ValueType::String => (10, None),
|
||||
ValueType::Uuid => (11, None),
|
||||
ValueType::Keyword => (13, None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait EnumSetExtensions<T: enum_set::CLike + Clone> {
|
||||
|
|
|
@ -15,7 +15,6 @@ extern crate mentat;
|
|||
extern crate mentat_core;
|
||||
extern crate mentat_db;
|
||||
extern crate mentat_query_algebrizer; // For errors.
|
||||
extern crate rusqlite;
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue