Skip to content

Commit 7682be7

Browse files
committed
Remove the QueryFragment constraints from Table
This is because `QueryFragment` is going to become generic over the backend, and I don't want to make `Table` become generic over the backend.
1 parent f5b6b7d commit 7682be7

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

diesel/src/query_builder/insert_statement.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ impl<T, U> QueryFragment for InsertStatement<T, U> where
5454

5555
impl<T, U> AsQuery for InsertStatement<T, U> where
5656
T: Table,
57-
InsertStatement<T, U>: QueryFragment,
57+
InsertQuery<T::AllColumns, InsertStatement<T, U>>: Query,
5858
{
59-
type SqlType = <T::AllColumns as Expression>::SqlType;
59+
type SqlType = <Self::Query as Query>::SqlType;
6060
type Query = InsertQuery<T::AllColumns, InsertStatement<T, U>>;
6161

6262
fn as_query(self) -> Self::Query {

diesel/src/query_builder/select_statement/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ impl<ST, S, F> SelectStatement<ST, S, F> {
7171
impl<ST, S, F, W, O, L, Of> Query for SelectStatement<ST, S, F, W, O, L, Of> where
7272
ST: NativeSqlType,
7373
S: SelectableExpression<F, ST>,
74-
SelectStatement<ST, S, F, W, O, L, Of>: QueryFragment
7574
{
7675
type SqlType = ST;
7776
}

diesel/src/query_builder/update_statement/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct UpdateQuery<T, U>(UpdateStatement<T, U>);
7474

7575
impl<T, U> QueryFragment for UpdateQuery<T, U> where
7676
T: UpdateTarget,
77+
<T::Table as Table>::AllColumns: QueryFragment,
7778
UpdateStatement<T, U>: QueryFragment,
7879
{
7980
fn to_sql(&self, out: &mut QueryBuilder) -> BuildQueryResult {
@@ -87,7 +88,6 @@ impl<T, U> QueryFragment for UpdateQuery<T, U> where
8788
}
8889

8990
impl<T, U> Query for UpdateQuery<T, U> where
90-
UpdateQuery<T, U>: QueryFragment,
9191
T: UpdateTarget,
9292
{
9393
type SqlType = <<T::Table as Table>::AllColumns as Expression>::SqlType;

diesel/src/query_source/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ pub trait Column: Expression {
4141
/// A SQL database table. Types which implement this trait should have been
4242
/// generated by the [`table!` macro](../macro.table!.html).
4343
pub trait Table: QuerySource + AsQuery + Sized {
44-
type PrimaryKey: Column<Table=Self> + Expression + NonAggregate + QueryFragment;
45-
type AllColumns: SelectableExpression<Self> + QueryFragment;
44+
type PrimaryKey: Column<Table=Self> + Expression + NonAggregate;
45+
type AllColumns: SelectableExpression<Self>;
4646

4747
fn name() -> &'static str;
4848
fn primary_key(&self) -> Self::PrimaryKey;

0 commit comments

Comments
 (0)