This commit is contained in:
gwenn 2018-10-30 20:13:41 +01:00
parent f04047db01
commit 1262238229
11 changed files with 15 additions and 22 deletions

View File

@ -63,12 +63,7 @@ impl Connection {
) -> Result<()> {
use self::StepResult::{Busy, Done, Locked, More};
let mut dst = Connection::open(dst_path)?;
let backup = Backup::new_with_names(
self,
name,
&mut dst,
DatabaseName::Main
)?;
let backup = Backup::new_with_names(self, name, &mut dst, DatabaseName::Main)?;
let mut r = More;
while r == More {
@ -308,8 +303,8 @@ impl<'a, 'b> Drop for Backup<'a, 'b> {
#[cfg(test)]
mod test {
use super::Backup;
use std::time::Duration;
use crate::{Connection, DatabaseName, NO_PARAMS};
use std::time::Duration;
#[test]
fn test_backup() {

View File

@ -262,8 +262,8 @@ impl ToSql for ZeroBlob {
#[cfg(test)]
mod test {
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
use crate::{Connection, DatabaseName, Result};
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
fn db_with_test_blob() -> Result<(Connection, i64)> {
let db = Connection::open_in_memory()?;

View File

@ -1,10 +1,10 @@
//! Prepared statements cache for faster execution.
use lru_cache::LruCache;
use crate::raw_statement::RawStatement;
use crate::{Connection, Result, Statement};
use lru_cache::LruCache;
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use crate::{Connection, Result, Statement};
impl Connection {
/// Prepare a SQL statement for execution, returning a previously prepared

View File

@ -1,10 +1,10 @@
use crate::types::Type;
use crate::{errmsg_to_string, ffi};
use std::error;
use std::fmt;
use std::os::raw::c_int;
use std::path::PathBuf;
use std::str;
use crate::types::Type;
use crate::{errmsg_to_string, ffi};
/// Old name for `Error`. `SqliteError` is deprecated.
#[deprecated(since = "0.6.0", note = "Use Error instead")]

View File

@ -289,8 +289,8 @@ fn free_boxed_hook<F>(p: *mut c_void) {
#[cfg(test)]
mod test {
use super::Action;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::Connection;
use std::sync::atomic::{AtomicBool, Ordering};
#[test]
fn test_commit_hook() {

View File

@ -1577,9 +1577,7 @@ mod test {
for (i, v) in vals.iter().enumerate() {
let i_to_insert = i as i64;
assert_eq!(
insert_stmt
.execute(&[&i_to_insert as &ToSql, &v])
.unwrap(),
insert_stmt.execute(&[&i_to_insert as &ToSql, &v]).unwrap(),
1
);
}

View File

@ -1,5 +1,5 @@
use std::ops::Deref;
use crate::{Connection, Result};
use std::ops::Deref;
/// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is
/// deprecated.

View File

@ -114,9 +114,9 @@ mod test {
extern crate time;
use super::Value;
use crate::{Connection, Error, NO_PARAMS};
use std::f64::EPSILON;
use std::os::raw::{c_double, c_int};
use crate::{Connection, Error, NO_PARAMS};
fn checked_memory_handle() -> Connection {
let db = Connection::open_in_memory().unwrap();

View File

@ -1,8 +1,8 @@
use super::{Null, Value, ValueRef};
use std::borrow::Cow;
#[cfg(feature = "array")]
use crate::vtab::array::Array;
use crate::Result;
use std::borrow::Cow;
/// `ToSqlOutput` represents the possible output types for implementors of the
/// `ToSql` trait.
@ -207,8 +207,8 @@ mod test {
#[cfg(feature = "i128_blob")]
#[test]
fn test_i128() {
use std::i128;
use crate::{Connection, NO_PARAMS};
use std::i128;
let db = Connection::open_in_memory().unwrap();
db.execute_batch("CREATE TABLE foo (i128 BLOB, desc TEXT)")
.unwrap();

View File

@ -99,10 +99,10 @@ pub fn wait_for_unlock_notify(_db: *mut ffi::sqlite3) -> c_int {
#[cfg(feature = "unlock_notify")]
#[cfg(test)]
mod test {
use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS};
use std::sync::mpsc::sync_channel;
use std::thread;
use std::time;
use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS};
#[test]
fn test_unlock_notify() {

View File

@ -169,10 +169,10 @@ impl VTabCursor for ArrayTabCursor {
#[cfg(test)]
mod test {
use std::rc::Rc;
use crate::types::Value;
use crate::vtab::array;
use crate::Connection;
use std::rc::Rc;
#[test]
fn test_array_module() {