Rocket

A web framework for Rust. https://rocket.rs (mirror)
git clone git://git.thc420.xyz/Rocket
Log | Files | Refs | README

commit c6c0b3a6e13c27ae3f0cecff4ea1d77e9f1ad06d
parent ba6aa2f05ec4060f340ebb5f9e09127aa435e380
Author: Leonora Tindall <nora@nora.codes>
Date:   Sun, 27 Jan 2019 09:52:03 -0600

Update 'rusqlite' dependency to 0.16.

Diffstat:
Mcontrib/lib/Cargo.toml | 4++--
Mcontrib/lib/src/databases.rs | 2+-
Mcontrib/lib/tests/databases.rs | 6++++--
Mexamples/raw_sqlite/Cargo.toml | 2+-
Mexamples/raw_sqlite/src/main.rs | 7++++---
Msite/guide/6-state.md | 2+-
6 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml @@ -65,8 +65,8 @@ r2d2 = { version = "0.8", optional = true } r2d2_postgres = { version = "0.14", optional = true } mysql = { version = "14", optional = true } r2d2_mysql = { version = "9", optional = true } -rusqlite = { version = "0.14.0", optional = true } -r2d2_sqlite = { version = "0.6", optional = true } +rusqlite = { version = "0.16.0", optional = true } +r2d2_sqlite = { version = "0.8", optional = true } rusted_cypher = { version = "1", optional = true } r2d2_cypher = { version = "0.4", optional = true } redis = { version = "0.9", optional = true } diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs @@ -361,7 +361,7 @@ //! [Diesel]: https://diesel.rs //! [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html //! [`rusted_cypher::GraphClient`]: https://docs.rs/rusted_cypher/1.1.0/rusted_cypher/graph/struct.GraphClient.html -//! [`rusqlite::Connection`]: https://docs.rs/rusqlite/0.14.0/rusqlite/struct.Connection.html +//! [`rusqlite::Connection`]: https://docs.rs/rusqlite/0.16.0/rusqlite/struct.Connection.html //! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html //! [`postgres::Connection`]: https://docs.rs/postgres/0.15.2/postgres/struct.Connection.html //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html diff --git a/contrib/lib/tests/databases.rs b/contrib/lib/tests/databases.rs @@ -20,6 +20,8 @@ mod rusqlite_integration_test { use rocket_contrib::databases::rusqlite; use rocket_contrib::database; + use self::rusqlite::types::ToSql; + #[database("test_db")] struct SqliteDb(pub rusqlite::Connection); @@ -40,7 +42,7 @@ mod rusqlite_integration_test { // Rusqlite's `transaction()` method takes `&mut self`; this tests the // presence of a `DerefMut` trait on the generated connection type. let tx = conn.transaction().unwrap(); - let _: i32 = tx.query_row("SELECT 1", &[], |row| row.get(0)).expect("get row"); + let _: i32 = tx.query_row("SELECT 1", &[] as &[&dyn ToSql], |row| row.get(0)).expect("get row"); tx.commit().expect("committed transaction"); } @@ -57,6 +59,6 @@ mod rusqlite_integration_test { let rocket = rocket::custom(config).attach(SqliteDb::fairing()); let conn = SqliteDb::get_one(&rocket).expect("unable to get connection"); - let _: i32 = conn.query_row("SELECT 1", &[], |row| row.get(0)).expect("get row"); + let _: i32 = conn.query_row("SELECT 1", &[] as &[&dyn ToSql], |row| row.get(0)).expect("get row"); } } diff --git a/examples/raw_sqlite/Cargo.toml b/examples/raw_sqlite/Cargo.toml @@ -6,4 +6,4 @@ publish = false [dependencies] rocket = { path = "../../core/lib" } -rusqlite = "0.14" +rusqlite = "0.16" diff --git a/examples/raw_sqlite/src/main.rs b/examples/raw_sqlite/src/main.rs @@ -2,6 +2,7 @@ #[macro_use] extern crate rocket; extern crate rusqlite; +use rusqlite::types::ToSql; #[cfg(test)] mod tests; @@ -15,11 +16,11 @@ fn init_database(conn: &Connection) { conn.execute("CREATE TABLE entries ( id INTEGER PRIMARY KEY, name TEXT NOT NULL - )", &[]) + )", &[] as &[&dyn ToSql]) .expect("create entries table"); conn.execute("INSERT INTO entries (id, name) VALUES ($1, $2)", - &[&0, &"Rocketeer"]) + &[&0 as &dyn ToSql, &"Rocketeer"]) .expect("insert single entry into entries table"); } @@ -28,7 +29,7 @@ fn hello(db_conn: State<DbConn>) -> Result<String, Error> { db_conn.lock() .expect("db connection lock") .query_row("SELECT name FROM entries WHERE id = 0", - &[], |row| { row.get(0) }) + &[] as &[&dyn ToSql], |row| { row.get(0) }) } fn rocket() -> Rocket { diff --git a/site/guide/6-state.md b/site/guide/6-state.md @@ -194,7 +194,7 @@ Presently, Rocket provides built-in support for the following databases: [Diesel]: https://diesel.rs [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html [`rusted_cypher::GraphClient`]: https://docs.rs/rusted_cypher/1.1.0/rusted_cypher/graph/struct.GraphClient.html -[`rusqlite::Connection`]: https://docs.rs/rusqlite/0.14.0/rusqlite/struct.Connection.html +[`rusqlite::Connection`]: https://docs.rs/rusqlite/0.16.0/rusqlite/struct.Connection.html [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html [`postgres::Connection`]: https://docs.rs/postgres/0.15.2/postgres/struct.Connection.html [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html