Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip, everything is broken #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion diesel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ huge-tables = ["64-column-tables"]
64-column-tables = ["32-column-tables", "diesel_derives/64-column-tables"]
128-column-tables = ["64-column-tables", "diesel_derives/128-column-tables"]
postgres = ["pq-sys", "postgres_backend"]
sqlite = ["libsqlite3-sys", "diesel_derives/sqlite", "time?/formatting", "time?/parsing"]
sqlite = ["libsqlite3-sys", "sqlite_backend"]
mysql = ["mysqlclient-sys", "url", "percent-encoding", "bitflags", "mysql_backend"]
without-deprecated = ["diesel_derives/without-deprecated"]
with-deprecated = ["diesel_derives/with-deprecated"]
Expand All @@ -65,6 +65,7 @@ ipnet-address = ["ipnet", "libc"]
numeric = ["num-bigint", "bigdecimal", "num-traits", "num-integer"]
postgres_backend = ["diesel_derives/postgres", "bitflags", "byteorder", "itoa"]
mysql_backend = ["diesel_derives/mysql", "byteorder"]
sqlite_backend = ["diesel_derives/sqlite", "time?/formatting", "time?/parsing"]
returning_clauses_for_sqlite_3_35 = []
i-implement-a-third-party-backend-and-opt-into-breaking-changes = []
nightly-error-messages = []
Expand Down
315 changes: 315 additions & 0 deletions diesel/sqlite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
# `sqlite_backend` tracker

Currently, Diesel code base contains a lot of `#[cfg(feature = "sqlite")]`, and now that
we are splitting the feature into two features, `sqlite` and `sqlite_backend`, we have
to evaluate every instance of ``#[cfg(feature = "sqlite")]` and decide if it should be
`#[cfg(feature = "sqlite")]` or `#[cfg(feature = "sqlite_backend")]`.

This file is to keep track this. The original list was generated by running
`rg '"sqlite' --no-heading --line-number`. As and when I am making progress, I am
updating this file, and adding my remark about if I am going to change it to `sqlite`
or `sqlite_backend`.

Connection vs backend: `sqlite_backend` means this is a backend feature, which means this
tells us if this operation is generally valid for sqlite itself or not, irrespective of
how are we connecting to sqlite. `sqlite` feature is about the connection to sqlite, and
deals with how to connect with sqlite.

One quick way to identify if something is connection or backend is to see there is
postgres or postgres_backend.





> src/insertable.rs:220:#[cfg(feature = "sqlite")]
> src/insertable.rs:236:#[cfg(feature = "sqlite")]

Converted to `sqlite_backend`. May have to re-visit this in future. From usage site it
is not clear if this is connection or backend, and no postgres or mysql is there.





> src/migration/mod.rs:217:#[cfg(feature = "sqlite")]

This is clearly related to connection, so this should be `sqlite`.





> src/test_helpers.rs:6: if #[cfg(feature = "sqlite")] {

Clearly connection.





> src/expression_methods/mod.rs:28:#[cfg(feature = "sqlite")]

Conversion to `sqlite_backend`.





> src/query_dsl/save_changes_dsl.rs:2:#[cfg(any(feature = "sqlite", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:5:#[cfg(any(feature = "sqlite", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:7:#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:9:#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:12:#[cfg(any(feature = "sqlite", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:14:#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:17:#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))]
> src/query_dsl/save_changes_dsl.rs:52:#[cfg(feature = "sqlite")]
> src/query_dsl/save_changes_dsl.rs:55:#[cfg(feature = "sqlite")]

Going with `sqlite` for now as `postgres` and `mysql` are also there.





> src/expression_methods/global_expression_methods.rs:17: any(feature = "sqlite", feature = "postgres"),
> src/expression_methods/global_expression_methods.rs:21: feature = "sqlite",
> src/expression_methods/global_expression_methods.rs:22: doc = "sqlite-specific [`is`](crate::SqliteExpressionMethods::is())"
> src/expression_methods/global_expression_methods.rs:24: #[cfg_attr(all(feature = "sqlite", feature = "postgres"), doc = "or the")]
> src/expression_methods/global_expression_methods.rs:29: #[cfg_attr(any(feature = "sqlite", feature = "postgres"), doc = ".")]

These all have `postgres` as well, so going with `sqlite`.





> src/query_dsl/mod.rs:1057: /// # #[cfg(feature = "sqlite")]
> src/query_dsl/mod.rs:1130: /// # #[cfg(feature = "sqlite")]
> src/query_dsl/mod.rs:1198: /// # #[cfg(feature = "sqlite")]
> src/query_dsl/mod.rs:1229: /// # #[cfg(feature = "sqlite")]

These all have `postgres` as well, so going with `sqlite`.





> src/expression/functions/aggregate_folding.rs:46: /// # #[cfg(all(feature = "numeric", any(feature = "postgres", not(feature = "sqlite"))))]
> src/expression/functions/aggregate_folding.rs:62: /// # #[cfg(not(all(feature = "numeric", any(feature = "postgres", not(feature = "sqlite")))))]
> src/expression/functions/date_and_time.rs:79:#[cfg(feature = "sqlite")]
> src/expression/functions/date_and_time.rs:88:#[cfg(feature = "sqlite")]

These all have `postgres` as well, so going with `sqlite`.






> src/expression/helper_types.rs:182:#[cfg(feature = "sqlite")]

There is a `postgres_backend` as well, so going with `sqlite_backend`.





> src/macros/mod.rs:582: #[cfg(feature = "sqlite")]
> src/macros/mod.rs:626: #[cfg(feature = "sqlite")]

These all have `postgres` as well, so going with `sqlite`.






> src/serialize.rs:266:/// # #[cfg(feature = "sqlite")]

This has `postgres` as well, so going with `sqlite`.





> src/doctest_setup.rs:97: } else if #[cfg(feature = "sqlite")] {
> src/doctest_setup.rs:298: #[cfg(not(feature = "sqlite"))]

This is clearly related to setting up connection, so this should be `sqlite`.





> src/sqlite/expression/expression_methods.rs:10:#[cfg(feature = "sqlite")]

Removed this feature as there is an outer `cfg`.






> src/sqlite/query_builder/query_fragment_impls.rs:13:#[cfg(feature = "sqlite")]
> src/sqlite/query_builder/query_fragment_impls.rs:25:#[cfg(feature = "sqlite")]

Removed both of them as they are inside a cfg-ed module.





> src/query_builder/select_statement/boxed.rs:606: #[cfg(feature = "sqlite")]

Leaving `sqlite` as is, as there is `postgres` and `mysql`.






> src/query_builder/combination_clause.rs:277:#[cfg(feature = "sqlite")]

Switched to `sqlite_backend` as `postgres_backend` etc are there.





> src/query_builder/insert_statement/mod.rs:23:#[cfg(feature = "sqlite")]
> src/query_builder/insert_statement/mod.rs:496: #[cfg(feature = "sqlite")]
> src/query_builder/insert_statement/mod.rs:521: #[cfg(feature = "sqlite")]

Switched to `sqlite_backend` as `mysql_backend` is there.





> src/query_builder/ast_pass.rs:93: #[cfg(feature = "sqlite")]

There is no `postgres` or `mysql`, but I feel it should be `sqlite_backend`, so switching
to that. Will re-visit this later.




> src/query_builder/functions.rs:256:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:259:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:266:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:286:/// # #[cfg(feature = "sqlite")]
> src/query_builder/functions.rs:302:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:305:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:312:/// # #[cfg(not(feature = "sqlite"))]
> src/query_builder/functions.rs:340:/// # #[cfg(feature = "sqlite")]

`postgres` is there, so going with `sqlite`.




> src/sqlite/connection/raw.rs:42: let database_url = if database_url.starts_with("sqlite://") {
> src/sqlite/connection/raw.rs:43: CString::new(database_url.replacen("sqlite://", "file:", 1))?

Not feature related, so leaving as is.



> src/sqlite/types/date_and_time/mod.rs:12:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:19:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:26:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:33:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:40:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:47:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:54:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:61:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:68:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:75:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:82:#[cfg(feature = "sqlite")]
> src/sqlite/types/date_and_time/mod.rs:89:#[cfg(feature = "sqlite")]

Deleted feature as there is an outer `cfg`.



> src/sqlite/types/date_and_time/chrono.rs:82:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:91:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:99:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:114:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:122:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:143:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:151:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:172:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:180:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:203:#[cfg(all(feature = "sqlite", feature = "chrono"))]
> src/sqlite/types/date_and_time/chrono.rs:226:#[cfg(all(feature = "sqlite", feature = "chrono"))]

Deleted feature as there is an outer `cfg`.



src/sqlite/types/numeric.rs:10:#[cfg(all(feature = "sqlite", feature = "bigdecimal"))]
src/sqlite/types/mod.rs:17:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:25:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:39:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:47:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:56:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:63:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:70:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:77:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:84:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:91:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:98:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:106:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:114:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:122:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:130:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:138:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:146:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:154:#[cfg(feature = "sqlite")]
src/sqlite/types/mod.rs:211:#[cfg(feature = "sqlite")]
src/sqlite/types/date_and_time/time.rs:137:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:146:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:154:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:169:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:182:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:203:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:216:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:237:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:250:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/types/date_and_time/time.rs:273:#[cfg(all(feature = "sqlite", feature = "time"))]
src/sqlite/connection/mod.rs:118:#[cfg(feature = "sqlite")]
src/sql_types/mod.rs:429:#[cfg(feature = "sqlite")]
src/upsert/on_conflict_extension.rs:37: /// # #[cfg(any(feature = "sqlite", feature = "mysql"))]
src/upsert/on_conflict_extension.rs:75: /// # #[cfg(any(feature = "mysql", feature = "sqlite"))]
src/upsert/on_conflict_extension.rs:135: /// # #[cfg(any(feature = "postgres", feature = "sqlite"))]
src/upsert/on_conflict_extension.rs:141: /// # #[cfg(any(feature = "sqlite", feature = "postgres"))]
src/upsert/on_conflict_extension.rs:143: /// # #[cfg(any(feature = "sqlite", feature = "postgres"))]
src/upsert/on_conflict_extension.rs:196: /// # #[cfg(any(feature = "sqlite", feature = "postgres"))]
src/upsert/on_conflict_extension.rs:386: /// # #[cfg(feature = "sqlite")]
src/upsert/on_conflict_extension.rs:399: /// # #[cfg(any(feature = "sqlite", feature = "postgres"))]
src/upsert/on_conflict_extension.rs:454: /// # #[cfg(feature = "sqlite")]
src/upsert/on_conflict_extension.rs:512: /// # #[cfg(any(feature = "sqlite", feature = "postgres"))]
src/upsert/on_conflict_extension.rs:576: /// # #[cfg(any(feature = "sqlite", feature = "mysql"))]
src/connection/statement_cache.rs:162: all(feature = "sqlite", test)
src/lib.rs:303:#[cfg(feature = "sqlite")]
src/lib.rs:731: #[cfg(feature = "sqlite")]
src/connection/instrumentation.rs:37: feature = "sqlite",
src/backend.rs:10: feature = "sqlite",
src/type_impls/primitives.rs:93: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Date))]
src/type_impls/primitives.rs:94: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Time))]
src/type_impls/primitives.rs:95: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Timestamp))]
src/type_impls/primitives.rs:101: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Date))]
src/type_impls/primitives.rs:102: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Time))]
src/type_impls/primitives.rs:103: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::Timestamp))]
src/type_impls/date_and_time.rs:43: any(feature = "postgres_backend", feature = "sqlite"),
src/type_impls/date_and_time.rs:50: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::TimestamptzSqlite))]
src/type_impls/date_and_time.rs:87: feature = "sqlite",
src/type_impls/date_and_time.rs:96: #[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::TimestamptzSqlite))]
src/connection/transaction_manager.rs:728: #[cfg(feature = "sqlite")]
src/connection/transaction_manager.rs:1029: #[cfg(feature = "sqlite")]
Cargo.toml:59:sqlite = ["libsqlite3-sys", "sqlite_backend"]
Cargo.toml:77:features = ["postgres", "mysql", "sqlite", "extras"]
src/connection/mod.rs:6: any(feature = "sqlite", feature = "postgres", feature = "mysql")
src/connection/mod.rs:43: any(feature = "sqlite", feature = "postgres", feature = "mysql")
4 changes: 2 additions & 2 deletions diesel/src/expression/functions/date_and_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl AsExpression<Nullable<Timestamptz>> for now {
}
}

#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
impl AsExpression<TimestamptzSqlite> for now {
type Expression = Coerce<now, TimestamptzSqlite>;

Expand All @@ -85,7 +85,7 @@ impl AsExpression<TimestamptzSqlite> for now {
}
}

#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
impl AsExpression<Nullable<TimestamptzSqlite>> for now {
type Expression = Coerce<now, Nullable<TimestamptzSqlite>>;

Expand Down
2 changes: 1 addition & 1 deletion diesel/src/expression/helper_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ pub use super::functions::helper_types::*;
pub use crate::pg::expression::helper_types::*;

#[doc(inline)]
#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
#[allow(unreachable_pub)]
pub use crate::sqlite::expression::helper_types::*;
2 changes: 1 addition & 1 deletion diesel/src/expression_methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ pub use self::text_expression_methods::TextExpressionMethods;
#[doc(inline)]
pub use crate::pg::expression::expression_methods::*;

#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
#[doc(inline)]
pub use crate::sqlite::expression::expression_methods::*;
4 changes: 2 additions & 2 deletions diesel/src/insertable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ where
}
}

#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
impl<Col, Expr> InsertValues<Col::Table, crate::sqlite::Sqlite>
for DefaultableColumnInsertValue<ColumnInsertValue<Col, Expr>>
where
Expand All @@ -233,7 +233,7 @@ where
}
}

#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
impl<Col, Expr>
QueryFragment<
crate::sqlite::Sqlite,
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub mod row;
pub mod mysql;
#[cfg(feature = "postgres_backend")]
pub mod pg;
#[cfg(feature = "sqlite")]
#[cfg(feature = "sqlite_backend")]
pub mod sqlite;

mod type_impls;
Expand Down
Loading