Update 'rusqlite' dependency to 0.16.

This commit is contained in:
Leonora Tindall 2019-01-27 09:52:03 -06:00 committed by Sergio Benitez
parent ba6aa2f05e
commit c6c0b3a6e1
6 changed files with 13 additions and 10 deletions

View File

@ -65,8 +65,8 @@ r2d2 = { version = "0.8", optional = true }
r2d2_postgres = { version = "0.14", optional = true } r2d2_postgres = { version = "0.14", optional = true }
mysql = { version = "14", optional = true } mysql = { version = "14", optional = true }
r2d2_mysql = { version = "9", optional = true } r2d2_mysql = { version = "9", optional = true }
rusqlite = { version = "0.14.0", optional = true } rusqlite = { version = "0.16.0", optional = true }
r2d2_sqlite = { version = "0.6", optional = true } r2d2_sqlite = { version = "0.8", optional = true }
rusted_cypher = { version = "1", optional = true } rusted_cypher = { version = "1", optional = true }
r2d2_cypher = { version = "0.4", optional = true } r2d2_cypher = { version = "0.4", optional = true }
redis = { version = "0.9", optional = true } redis = { version = "0.9", optional = true }

View File

@ -361,7 +361,7 @@
//! [Diesel]: https://diesel.rs //! [Diesel]: https://diesel.rs
//! [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html //! [`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 //! [`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 //! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
//! [`postgres::Connection`]: https://docs.rs/postgres/0.15.2/postgres/struct.Connection.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 //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html

View File

@ -20,6 +20,8 @@ mod rusqlite_integration_test {
use rocket_contrib::databases::rusqlite; use rocket_contrib::databases::rusqlite;
use rocket_contrib::database; use rocket_contrib::database;
use self::rusqlite::types::ToSql;
#[database("test_db")] #[database("test_db")]
struct SqliteDb(pub rusqlite::Connection); struct SqliteDb(pub rusqlite::Connection);
@ -40,7 +42,7 @@ mod rusqlite_integration_test {
// Rusqlite's `transaction()` method takes `&mut self`; this tests the // Rusqlite's `transaction()` method takes `&mut self`; this tests the
// presence of a `DerefMut` trait on the generated connection type. // presence of a `DerefMut` trait on the generated connection type.
let tx = conn.transaction().unwrap(); 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"); tx.commit().expect("committed transaction");
} }
@ -57,6 +59,6 @@ mod rusqlite_integration_test {
let rocket = rocket::custom(config).attach(SqliteDb::fairing()); let rocket = rocket::custom(config).attach(SqliteDb::fairing());
let conn = SqliteDb::get_one(&rocket).expect("unable to get connection"); 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");
} }
} }

View File

@ -6,4 +6,4 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
rusqlite = "0.14" rusqlite = "0.16"

View File

@ -2,6 +2,7 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
extern crate rusqlite; extern crate rusqlite;
use rusqlite::types::ToSql;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
@ -15,11 +16,11 @@ fn init_database(conn: &Connection) {
conn.execute("CREATE TABLE entries ( conn.execute("CREATE TABLE entries (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
name TEXT NOT NULL name TEXT NOT NULL
)", &[]) )", &[] as &[&dyn ToSql])
.expect("create entries table"); .expect("create entries table");
conn.execute("INSERT INTO entries (id, name) VALUES ($1, $2)", conn.execute("INSERT INTO entries (id, name) VALUES ($1, $2)",
&[&0, &"Rocketeer"]) &[&0 as &dyn ToSql, &"Rocketeer"])
.expect("insert single entry into entries table"); .expect("insert single entry into entries table");
} }
@ -28,7 +29,7 @@ fn hello(db_conn: State<DbConn>) -> Result<String, Error> {
db_conn.lock() db_conn.lock()
.expect("db connection lock") .expect("db connection lock")
.query_row("SELECT name FROM entries WHERE id = 0", .query_row("SELECT name FROM entries WHERE id = 0",
&[], |row| { row.get(0) }) &[] as &[&dyn ToSql], |row| { row.get(0) })
} }
fn rocket() -> Rocket { fn rocket() -> Rocket {

View File

@ -194,7 +194,7 @@ Presently, Rocket provides built-in support for the following databases:
[Diesel]: https://diesel.rs [Diesel]: https://diesel.rs
[`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html [`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 [`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 [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
[`postgres::Connection`]: https://docs.rs/postgres/0.15.2/postgres/struct.Connection.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 [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html