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

Bump rusqlite version #159

Merged
merged 1 commit into from
Apr 24, 2021
Merged
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
22 changes: 10 additions & 12 deletions refinery/tests/rusqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod rusqlite {
error::Kind,
Migrate, Migration, Runner, Target,
};
use refinery_core::rusqlite::{Connection, OptionalExtension, NO_PARAMS};
use refinery_core::rusqlite::{Connection, OptionalExtension};
use std::fs::{self, File};
use std::process::Command;

Expand Down Expand Up @@ -112,7 +112,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
"SELECT name FROM sqlite_master WHERE type='table' AND name='refinery_schema_history'",
NO_PARAMS,
[],
|row| row.get(0),
)
.unwrap();
Expand All @@ -129,7 +129,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
"SELECT name FROM sqlite_master WHERE type='table' AND name='refinery_schema_history'",
NO_PARAMS,
[],
|row| row.get(0),
)
.unwrap();
Expand All @@ -148,7 +148,7 @@ mod rusqlite {
)
.unwrap();
let (name, city): (String, String) = conn
.query_row("SELECT name, city FROM persons", NO_PARAMS, |row| {
.query_row("SELECT name, city FROM persons", [], |row| {
Ok((row.get(0).unwrap(), row.get(1).unwrap()))
})
.unwrap();
Expand All @@ -171,7 +171,7 @@ mod rusqlite {
)
.unwrap();
let (name, city): (String, String) = conn
.query_row("SELECT name, city FROM persons", NO_PARAMS, |row| {
.query_row("SELECT name, city FROM persons", [], |row| {
Ok((row.get(0).unwrap(), row.get(1).unwrap()))
})
.unwrap();
Expand Down Expand Up @@ -245,11 +245,9 @@ mod rusqlite {

assert!(result.is_err());
let query: Option<u32> = conn
.query_row(
"SELECT version FROM refinery_schema_history",
NO_PARAMS,
|row| row.get(0),
)
.query_row("SELECT version FROM refinery_schema_history", [], |row| {
row.get(0)
})
.optional()
.unwrap();
assert!(query.is_none());
Expand All @@ -262,7 +260,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
"SELECT name FROM sqlite_master WHERE type='table' AND name='refinery_schema_history'",
NO_PARAMS,
[],
|row| row.get(0),
)
.unwrap();
Expand All @@ -281,7 +279,7 @@ mod rusqlite {
)
.unwrap();
let (name, city): (String, String) = conn
.query_row("SELECT name, city FROM persons", NO_PARAMS, |row| {
.query_row("SELECT name, city FROM persons", [], |row| {
Ok((row.get(0).unwrap(), row.get(1).unwrap()))
})
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion refinery_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ toml = "0.5"
url = "2.0"
walkdir = "2.3.1"

rusqlite = {version = ">= 0.23, < 0.25", optional = true}
rusqlite = {version = ">= 0.23, < 0.26", optional = true}
postgres = {version = "0.19", optional = true}
mysql = {version = "20", optional = true}
tokio-postgres = { version = "0.7", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/drivers/rusqlite.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::traits::sync::{Migrate, Query, Transaction};
use crate::Migration;
use chrono::{DateTime, Local};
use rusqlite::{Connection as RqlConnection, Error as RqlError, NO_PARAMS};
use rusqlite::{Connection as RqlConnection, Error as RqlError};

fn query_applied_migrations(
transaction: &RqlConnection,
query: &str,
) -> Result<Vec<Migration>, RqlError> {
let mut stmt = transaction.prepare(query)?;
let mut rows = stmt.query(NO_PARAMS)?;
let mut rows = stmt.query([])?;
let mut applied = Vec::new();
while let Some(row) = rows.next()? {
let version = row.get(0)?;
Expand Down