mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:19:27 +08:00
commit
92020d54b7
@ -2,6 +2,7 @@
|
||||
name = "rusqlite"
|
||||
version = "0.15.0"
|
||||
authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
|
||||
edition = "2018"
|
||||
description = "Ergonomic wrapper for SQLite"
|
||||
repository = "https://github.com/jgallagher/rusqlite"
|
||||
documentation = "http://docs.rs/rusqlite/"
|
||||
|
@ -2,6 +2,7 @@
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.10.0"
|
||||
authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
|
||||
edition = "2018"
|
||||
repository = "https://github.com/jgallagher/rusqlite"
|
||||
description = "Native bindings to the libsqlite3 library"
|
||||
license = "MIT"
|
||||
|
@ -37,10 +37,10 @@ use std::os::raw::c_int;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use ffi;
|
||||
use crate::ffi;
|
||||
|
||||
use error::{error_from_handle, error_from_sqlite_code};
|
||||
use {Connection, DatabaseName, Result};
|
||||
use crate::error::{error_from_handle, error_from_sqlite_code};
|
||||
use crate::{Connection, DatabaseName, Result};
|
||||
|
||||
impl Connection {
|
||||
/// Back up the `name` database to the given destination path.
|
||||
@ -303,8 +303,8 @@ impl<'a, 'b> Drop for Backup<'a, 'b> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Backup;
|
||||
use crate::{Connection, DatabaseName, NO_PARAMS};
|
||||
use std::time::Duration;
|
||||
use {Connection, DatabaseName, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_backup() {
|
||||
|
@ -64,7 +64,7 @@ use std::ptr;
|
||||
|
||||
use super::ffi;
|
||||
use super::types::{ToSql, ToSqlOutput};
|
||||
use {Connection, DatabaseName, Result};
|
||||
use crate::{Connection, DatabaseName, Result};
|
||||
|
||||
/// Handle to an open BLOB.
|
||||
pub struct Blob<'conn> {
|
||||
@ -262,8 +262,8 @@ impl ToSql for ZeroBlob {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{Connection, DatabaseName, Result};
|
||||
use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
|
||||
use {Connection, DatabaseName, Result};
|
||||
|
||||
fn db_with_test_blob() -> Result<(Connection, i64)> {
|
||||
let db = Connection::open_in_memory()?;
|
||||
|
@ -4,8 +4,8 @@ use std::os::raw::{c_int, c_void};
|
||||
use std::ptr;
|
||||
use std::time::Duration;
|
||||
|
||||
use ffi;
|
||||
use {Connection, InnerConnection, Result};
|
||||
use crate::ffi;
|
||||
use crate::{Connection, InnerConnection, Result};
|
||||
|
||||
impl Connection {
|
||||
/// Set a busy handler that sleeps for a specified amount of time when a
|
||||
@ -81,7 +81,7 @@ mod test {
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use {Connection, Error, ErrorCode, TransactionBehavior, NO_PARAMS};
|
||||
use crate::{Connection, Error, ErrorCode, TransactionBehavior, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_default_busy() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Prepared statements cache for faster execution.
|
||||
|
||||
use crate::raw_statement::RawStatement;
|
||||
use crate::{Connection, Result, Statement};
|
||||
use lru_cache::LruCache;
|
||||
use raw_statement::RawStatement;
|
||||
use std::cell::RefCell;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use {Connection, Result, Statement};
|
||||
|
||||
impl Connection {
|
||||
/// Prepare a SQL statement for execution, returning a previously prepared
|
||||
@ -152,7 +152,7 @@ impl StatementCache {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::StatementCache;
|
||||
use {Connection, NO_PARAMS};
|
||||
use crate::{Connection, NO_PARAMS};
|
||||
|
||||
impl StatementCache {
|
||||
fn clear(&self) {
|
||||
|
@ -5,14 +5,14 @@ use std::os::raw::{c_char, c_int, c_void};
|
||||
#[cfg(feature = "array")]
|
||||
use std::rc::Rc;
|
||||
|
||||
use ffi;
|
||||
use ffi::sqlite3_context;
|
||||
use ffi::sqlite3_value;
|
||||
use crate::ffi;
|
||||
use crate::ffi::sqlite3_context;
|
||||
use crate::ffi::sqlite3_value;
|
||||
|
||||
use str_to_cstring;
|
||||
use types::{ToSqlOutput, ValueRef};
|
||||
use crate::str_to_cstring;
|
||||
use crate::types::{ToSqlOutput, ValueRef};
|
||||
#[cfg(feature = "array")]
|
||||
use vtab::array::{free_array, ARRAY_TYPE};
|
||||
use crate::vtab::array::{free_array, ARRAY_TYPE};
|
||||
|
||||
impl<'a> ValueRef<'a> {
|
||||
pub(crate) unsafe fn from_value(value: *mut sqlite3_value) -> ValueRef<'a> {
|
||||
|
@ -1,14 +1,14 @@
|
||||
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 types::Type;
|
||||
use {errmsg_to_string, ffi};
|
||||
|
||||
/// Enum listing possible errors from rusqlite.
|
||||
#[derive(Debug)]
|
||||
#[allow(enum_variant_names)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub enum Error {
|
||||
/// An error from an underlying SQLite call.
|
||||
SqliteFailure(ffi::Error, Option<String>),
|
||||
|
@ -58,14 +58,14 @@ use std::os::raw::{c_int, c_void};
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
use ffi;
|
||||
use ffi::sqlite3_context;
|
||||
use ffi::sqlite3_value;
|
||||
use crate::ffi;
|
||||
use crate::ffi::sqlite3_context;
|
||||
use crate::ffi::sqlite3_value;
|
||||
|
||||
use context::set_result;
|
||||
use types::{FromSql, FromSqlError, ToSql, ValueRef};
|
||||
use crate::context::set_result;
|
||||
use crate::types::{FromSql, FromSqlError, ToSql, ValueRef};
|
||||
|
||||
use {str_to_cstring, Connection, Error, InnerConnection, Result};
|
||||
use crate::{str_to_cstring, Connection, Error, InnerConnection, Result};
|
||||
|
||||
unsafe fn report_error(ctx: *mut sqlite3_context, err: &Error) {
|
||||
// Extended constraint error codes were added in SQLite 3.7.16. We don't have
|
||||
@ -198,14 +198,14 @@ where
|
||||
|
||||
/// "step" function called once for each row in an aggregate group. May be
|
||||
/// called 0 times if there are no rows.
|
||||
fn step(&self, &mut Context, &mut A) -> Result<()>;
|
||||
fn step(&self, _: &mut Context, _: &mut A) -> Result<()>;
|
||||
|
||||
/// Computes and returns the final result. Will be called exactly once for
|
||||
/// each invocation of the function. If `step()` was called at least
|
||||
/// once, will be given `Some(A)` (the same `A` as was created by
|
||||
/// `init` and given to `step`); if `step()` was not called (because
|
||||
/// the function is running against 0 rows), will be given `None`.
|
||||
fn finalize(&self, Option<A>) -> Result<T>;
|
||||
fn finalize(&self, _: Option<A>) -> Result<T>;
|
||||
}
|
||||
|
||||
impl Connection {
|
||||
@ -490,8 +490,8 @@ mod test {
|
||||
use std::f64::EPSILON;
|
||||
use std::os::raw::c_double;
|
||||
|
||||
use functions::{Aggregate, Context};
|
||||
use {Connection, Error, Result, NO_PARAMS};
|
||||
use crate::functions::{Aggregate, Context};
|
||||
use crate::{Connection, Error, Result, NO_PARAMS};
|
||||
|
||||
fn half(ctx: &Context) -> Result<c_double> {
|
||||
assert!(ctx.len() == 1, "called with unexpected number of arguments");
|
||||
|
@ -4,9 +4,9 @@
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::ptr;
|
||||
|
||||
use ffi;
|
||||
use crate::ffi;
|
||||
|
||||
use {Connection, InnerConnection};
|
||||
use crate::{Connection, InnerConnection};
|
||||
|
||||
/// Authorizer Action Codes
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -289,8 +289,8 @@ fn free_boxed_hook<F>(p: *mut c_void) {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Action;
|
||||
use crate::Connection;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use Connection;
|
||||
|
||||
#[test]
|
||||
fn test_commit_hook() {
|
||||
|
32
src/lib.rs
32
src/lib.rs
@ -88,27 +88,27 @@ use std::str;
|
||||
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
|
||||
use std::sync::{Arc, Mutex, Once, ONCE_INIT};
|
||||
|
||||
use cache::StatementCache;
|
||||
use error::{error_from_handle, error_from_sqlite_code};
|
||||
use raw_statement::RawStatement;
|
||||
use types::{ToSql, ValueRef};
|
||||
use crate::cache::StatementCache;
|
||||
use crate::error::{error_from_handle, error_from_sqlite_code};
|
||||
use crate::raw_statement::RawStatement;
|
||||
use crate::types::{ToSql, ValueRef};
|
||||
|
||||
pub use statement::Statement;
|
||||
pub use crate::statement::Statement;
|
||||
|
||||
pub use row::{AndThenRows, MappedRows, Row, RowIndex, Rows};
|
||||
pub use crate::row::{AndThenRows, MappedRows, Row, RowIndex, Rows};
|
||||
|
||||
pub use transaction::{DropBehavior, Savepoint, Transaction, TransactionBehavior};
|
||||
pub use crate::transaction::{DropBehavior, Savepoint, Transaction, TransactionBehavior};
|
||||
|
||||
pub use error::Error;
|
||||
pub use ffi::ErrorCode;
|
||||
pub use crate::error::Error;
|
||||
pub use crate::ffi::ErrorCode;
|
||||
|
||||
pub use cache::CachedStatement;
|
||||
pub use version::*;
|
||||
pub use crate::cache::CachedStatement;
|
||||
pub use crate::version::*;
|
||||
|
||||
#[cfg(feature = "hooks")]
|
||||
pub use hooks::*;
|
||||
pub use crate::hooks::*;
|
||||
#[cfg(feature = "load_extension")]
|
||||
pub use load_extension_guard::LoadExtensionGuard;
|
||||
pub use crate::load_extension_guard::LoadExtensionGuard;
|
||||
|
||||
#[cfg(feature = "backup")]
|
||||
pub mod backup;
|
||||
@ -1058,7 +1058,7 @@ mod test {
|
||||
extern crate tempdir;
|
||||
use self::tempdir::TempDir;
|
||||
pub use super::*;
|
||||
use ffi;
|
||||
use crate::ffi;
|
||||
pub use std::error::Error as StdError;
|
||||
pub use std::fmt;
|
||||
|
||||
@ -1548,9 +1548,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 &dyn ToSql, &v])
|
||||
.unwrap(),
|
||||
insert_stmt.execute(&[&i_to_insert as &ToSql, &v]).unwrap(),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
use std::os::raw::c_int;
|
||||
|
||||
use ffi;
|
||||
pub use ffi::Limit;
|
||||
use crate::ffi;
|
||||
pub use crate::ffi::Limit;
|
||||
|
||||
use Connection;
|
||||
use crate::Connection;
|
||||
|
||||
impl Connection {
|
||||
/// Returns the current value of a limit.
|
||||
@ -23,8 +23,8 @@ impl Connection {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use ffi::Limit;
|
||||
use Connection;
|
||||
use crate::ffi::Limit;
|
||||
use crate::Connection;
|
||||
|
||||
#[test]
|
||||
fn test_limit() {
|
||||
@ -57,13 +57,13 @@ mod test {
|
||||
assert_eq!(99, db.limit(Limit::SQLITE_LIMIT_VARIABLE_NUMBER));
|
||||
|
||||
// SQLITE_LIMIT_TRIGGER_DEPTH was added in SQLite 3.6.18.
|
||||
if ::version_number() >= 3006018 {
|
||||
if crate::version_number() >= 3006018 {
|
||||
db.set_limit(Limit::SQLITE_LIMIT_TRIGGER_DEPTH, 32);
|
||||
assert_eq!(32, db.limit(Limit::SQLITE_LIMIT_TRIGGER_DEPTH));
|
||||
}
|
||||
|
||||
// SQLITE_LIMIT_WORKER_THREADS was added in SQLite 3.8.7.
|
||||
if ::version_number() >= 3008007 {
|
||||
if crate::version_number() >= 3008007 {
|
||||
db.set_limit(Limit::SQLITE_LIMIT_WORKER_THREADS, 2);
|
||||
assert_eq!(2, db.limit(Limit::SQLITE_LIMIT_WORKER_THREADS));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use {Connection, Result};
|
||||
use crate::{Connection, Result};
|
||||
|
||||
/// RAII guard temporarily enabling SQLite extensions to be loaded.
|
||||
///
|
||||
|
@ -2,7 +2,7 @@ use std::marker::PhantomData;
|
||||
use std::{convert, result};
|
||||
|
||||
use super::{Error, Result, Statement};
|
||||
use types::{FromSql, FromSqlError, ValueRef};
|
||||
use crate::types::{FromSql, FromSqlError, ValueRef};
|
||||
|
||||
/// An handle for the resulting rows of a query.
|
||||
pub struct Rows<'stmt> {
|
||||
@ -27,7 +27,7 @@ impl<'stmt> Rows<'stmt> {
|
||||
/// This is a "streaming iterator". For a more natural interface,
|
||||
/// consider using `query_map` or `query_and_then` instead, which
|
||||
/// return types that implement `Iterator`.
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))] // cannot implement Iterator
|
||||
#[allow(clippy::should_implement_trait)] // cannot implement Iterator
|
||||
pub fn next<'a>(&'a mut self) -> Option<Result<Row<'a, 'stmt>>> {
|
||||
self.stmt.and_then(|stmt| match stmt.step() {
|
||||
Ok(true) => Some(Ok(Row {
|
||||
|
@ -11,9 +11,9 @@ use super::str_to_cstring;
|
||||
use super::{
|
||||
AndThenRows, Connection, Error, MappedRows, RawStatement, Result, Row, Rows, ValueRef,
|
||||
};
|
||||
use types::{ToSql, ToSqlOutput};
|
||||
use crate::types::{ToSql, ToSqlOutput};
|
||||
#[cfg(feature = "array")]
|
||||
use vtab::array::{free_array, ARRAY_TYPE};
|
||||
use crate::vtab::array::{free_array, ARRAY_TYPE};
|
||||
|
||||
/// A prepared statement.
|
||||
pub struct Statement<'conn> {
|
||||
@ -668,7 +668,7 @@ impl<'conn> Statement<'conn> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use {Connection, Error, Result, NO_PARAMS};
|
||||
use crate::{Connection, Error, Result, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_execute_named() {
|
||||
|
@ -7,8 +7,8 @@ use std::ptr;
|
||||
use std::time::Duration;
|
||||
|
||||
use super::ffi;
|
||||
use error::error_from_sqlite_code;
|
||||
use {Connection, Result};
|
||||
use crate::error::error_from_sqlite_code;
|
||||
use crate::{Connection, Result};
|
||||
|
||||
/// Set up the process-wide SQLite error logging callback.
|
||||
/// This function is marked unsafe for two reasons:
|
||||
@ -124,7 +124,7 @@ mod test {
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
|
||||
use Connection;
|
||||
use crate::Connection;
|
||||
|
||||
#[test]
|
||||
fn test_trace() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{Connection, Result};
|
||||
use std::ops::Deref;
|
||||
use {Connection, Result};
|
||||
|
||||
/// Options for transaction behavior. See [BEGIN
|
||||
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
||||
@ -410,7 +410,7 @@ impl Connection {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::DropBehavior;
|
||||
use {Connection, NO_PARAMS};
|
||||
use crate::{Connection, NO_PARAMS};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
@ -5,8 +5,8 @@ use std::borrow::Cow;
|
||||
|
||||
use self::chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc};
|
||||
|
||||
use types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use Result;
|
||||
use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use crate::Result;
|
||||
|
||||
/// ISO 8601 calendar date without timezone => "YYYY-MM-DD"
|
||||
impl ToSql for NaiveDate {
|
||||
@ -132,7 +132,7 @@ mod test {
|
||||
use super::chrono::{
|
||||
DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc,
|
||||
};
|
||||
use {Connection, Result, NO_PARAMS};
|
||||
use crate::{Connection, Result, NO_PARAMS};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
@ -47,7 +47,7 @@ impl Error for FromSqlError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "clippy", allow(match_same_arms))]
|
||||
#[allow(clippy::match_same_arms)]
|
||||
fn cause(&self) -> Option<&Error> {
|
||||
match *self {
|
||||
FromSqlError::Other(ref err) => err.cause(),
|
||||
@ -181,7 +181,7 @@ impl FromSql for Value {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::FromSql;
|
||||
use {Connection, Error};
|
||||
use crate::{Connection, Error};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
Connection::open_in_memory().unwrap()
|
||||
|
@ -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 {Connection, Error, NO_PARAMS};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
@ -3,8 +3,8 @@ extern crate serde_json;
|
||||
|
||||
use self::serde_json::Value;
|
||||
|
||||
use types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use Result;
|
||||
use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use crate::Result;
|
||||
|
||||
/// Serialize JSON `Value` to text.
|
||||
impl ToSql for Value {
|
||||
@ -28,8 +28,8 @@ impl FromSql for Value {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::serde_json;
|
||||
use types::ToSql;
|
||||
use {Connection, NO_PARAMS};
|
||||
use crate::types::ToSql;
|
||||
use crate::{Connection, NO_PARAMS};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
@ -1,7 +1,7 @@
|
||||
extern crate time;
|
||||
|
||||
use types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use Result;
|
||||
use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
|
||||
use crate::Result;
|
||||
|
||||
const CURRENT_TIMESTAMP_FMT: &str = "%Y-%m-%d %H:%M:%S";
|
||||
const SQLITE_DATETIME_FMT: &str = "%Y-%m-%dT%H:%M:%S.%fZ";
|
||||
@ -37,7 +37,7 @@ impl FromSql for time::Timespec {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::time;
|
||||
use {Connection, Result, NO_PARAMS};
|
||||
use crate::{Connection, Result, NO_PARAMS};
|
||||
|
||||
fn checked_memory_handle() -> Connection {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
|
@ -1,8 +1,8 @@
|
||||
use super::{Null, Value, ValueRef};
|
||||
use std::borrow::Cow;
|
||||
#[cfg(feature = "array")]
|
||||
use vtab::array::Array;
|
||||
use Result;
|
||||
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 crate::{Connection, NO_PARAMS};
|
||||
use std::i128;
|
||||
use {Connection, NO_PARAMS};
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
db.execute_batch("CREATE TABLE foo (i128 BLOB, desc TEXT)")
|
||||
.unwrap();
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{Type, Value};
|
||||
use types::{FromSqlError, FromSqlResult};
|
||||
use crate::types::{FromSqlError, FromSqlResult};
|
||||
|
||||
/// A non-owning [dynamic type value](http://sqlite.org/datatype3.html). Typically the
|
||||
/// memory backing this value is owned by SQLite.
|
||||
|
@ -6,7 +6,7 @@ use std::os::raw::c_void;
|
||||
#[cfg(feature = "unlock_notify")]
|
||||
use std::sync::{Condvar, Mutex};
|
||||
|
||||
use ffi;
|
||||
use crate::ffi;
|
||||
|
||||
#[cfg(feature = "unlock_notify")]
|
||||
struct UnlockNotification {
|
||||
@ -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 {Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_unlock_notify() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ffi;
|
||||
use crate::ffi;
|
||||
use std::ffi::CStr;
|
||||
|
||||
/// Returns the SQLite version as an integer; e.g., `3016002` for version
|
||||
|
@ -5,13 +5,13 @@ use std::default::Default;
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::rc::Rc;
|
||||
|
||||
use ffi;
|
||||
use types::{ToSql, ToSqlOutput, Value};
|
||||
use vtab::{
|
||||
use crate::ffi;
|
||||
use crate::types::{ToSql, ToSqlOutput, Value};
|
||||
use crate::vtab::{
|
||||
eponymous_only_module, Context, IndexConstraintOp, IndexInfo, Module, VTab, VTabConnection,
|
||||
VTabCursor, Values,
|
||||
};
|
||||
use {Connection, Result};
|
||||
use crate::{Connection, Result};
|
||||
|
||||
// http://sqlite.org/bindptr.html
|
||||
|
||||
@ -169,10 +169,10 @@ impl VTabCursor for ArrayTabCursor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::types::Value;
|
||||
use crate::vtab::array;
|
||||
use crate::Connection;
|
||||
use std::rc::Rc;
|
||||
use types::Value;
|
||||
use vtab::array;
|
||||
use Connection;
|
||||
|
||||
#[test]
|
||||
fn test_array_module() {
|
||||
|
@ -8,13 +8,13 @@ use std::path::Path;
|
||||
use std::result;
|
||||
use std::str;
|
||||
|
||||
use ffi;
|
||||
use types::Null;
|
||||
use vtab::{
|
||||
use crate::ffi;
|
||||
use crate::types::Null;
|
||||
use crate::vtab::{
|
||||
dequote, escape_double_quote, parse_boolean, read_only_module, Context, CreateVTab, IndexInfo,
|
||||
Module, VTab, VTabConnection, VTabCursor, Values,
|
||||
};
|
||||
use {Connection, Error, Result};
|
||||
use crate::{Connection, Error, Result};
|
||||
|
||||
/// Register the "csv" module.
|
||||
/// ```sql
|
||||
@ -340,8 +340,8 @@ impl From<csv::Error> for Error {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use vtab::csvtab;
|
||||
use {Connection, Result, NO_PARAMS};
|
||||
use crate::vtab::csvtab;
|
||||
use crate::{Connection, Result, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_csv_module() {
|
||||
|
@ -17,12 +17,12 @@ use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
use context::set_result;
|
||||
use error::error_from_sqlite_code;
|
||||
use ffi;
|
||||
pub use ffi::{sqlite3_vtab, sqlite3_vtab_cursor};
|
||||
use types::{FromSql, FromSqlError, ToSql, ValueRef};
|
||||
use {str_to_cstring, Connection, Error, InnerConnection, Result};
|
||||
use crate::context::set_result;
|
||||
use crate::error::error_from_sqlite_code;
|
||||
use crate::ffi;
|
||||
pub use crate::ffi::{sqlite3_vtab, sqlite3_vtab_cursor};
|
||||
use crate::types::{FromSql, FromSqlError, ToSql, ValueRef};
|
||||
use crate::{str_to_cstring, Connection, Error, InnerConnection, Result};
|
||||
|
||||
// let conn: Connection = ...;
|
||||
// let mod: Module = ...; // VTab builder
|
||||
@ -476,7 +476,7 @@ impl<'a> Values<'a> {
|
||||
// So it seems not possible to enhance `ValueRef::from_value`.
|
||||
#[cfg(feature = "array")]
|
||||
pub(crate) fn get_array(&self, idx: usize) -> Result<Option<array::Array>> {
|
||||
use types::Value;
|
||||
use crate::types::Value;
|
||||
let arg = self.args[idx];
|
||||
let ptr = unsafe { ffi::sqlite3_value_pointer(arg, array::ARRAY_TYPE) };
|
||||
if ptr.is_null() {
|
||||
|
@ -4,13 +4,13 @@
|
||||
use std::default::Default;
|
||||
use std::os::raw::c_int;
|
||||
|
||||
use ffi;
|
||||
use types::Type;
|
||||
use vtab::{
|
||||
use crate::ffi;
|
||||
use crate::types::Type;
|
||||
use crate::vtab::{
|
||||
eponymous_only_module, Context, IndexConstraintOp, IndexInfo, Module, VTab, VTabConnection,
|
||||
VTabCursor, Values,
|
||||
};
|
||||
use {Connection, Result};
|
||||
use crate::{Connection, Result};
|
||||
|
||||
/// Register the "generate_series" module.
|
||||
pub fn load_module(conn: &Connection) -> Result<()> {
|
||||
@ -263,9 +263,9 @@ impl VTabCursor for SeriesTabCursor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use ffi;
|
||||
use vtab::series;
|
||||
use {Connection, NO_PARAMS};
|
||||
use crate::ffi;
|
||||
use crate::vtab::series;
|
||||
use crate::{Connection, NO_PARAMS};
|
||||
|
||||
#[test]
|
||||
fn test_series_module() {
|
||||
|
Loading…
Reference in New Issue
Block a user