mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Merge remote-tracking branch 'jgallagher/master' into 2018
# Conflicts: # src/lib.rs # src/statement.rs
This commit is contained in:
commit
bcaa929748
@ -8,6 +8,7 @@ rust:
|
|||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ environment:
|
|||||||
- TARGET: x86_64-pc-windows-msvc
|
- TARGET: x86_64-pc-windows-msvc
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
VCPKG_DEFAULT_TRIPLET: x64-windows
|
||||||
VCPKGRS_DYNAMIC: 1
|
VCPKGRS_DYNAMIC: 1
|
||||||
- TARGET: x86_64-pc-windows-msvc
|
# - TARGET: x86_64-pc-windows-msvc
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-windows-static
|
# VCPKG_DEFAULT_TRIPLET: x64-windows-static
|
||||||
RUSTFLAGS: -Ctarget-feature=+crt-static
|
# RUSTFLAGS: -Ctarget-feature=+crt-static
|
||||||
install:
|
install:
|
||||||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||||
- rustup-init.exe -y --default-host %TARGET%
|
- rustup-init.exe -y --default-host %TARGET%
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![feature(extern_crate_item_prelude)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
|
@ -6,10 +6,6 @@ use std::os::raw::c_int;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
/// Old name for `Error`. `SqliteError` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Error instead")]
|
|
||||||
pub type SqliteError = Error;
|
|
||||||
|
|
||||||
/// Enum listing possible errors from rusqlite.
|
/// Enum listing possible errors from rusqlite.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(enum_variant_names)]
|
#[allow(enum_variant_names)]
|
||||||
|
33
src/lib.rs
33
src/lib.rs
@ -98,12 +98,8 @@ pub use crate::statement::Statement;
|
|||||||
pub use crate::row::{AndThenRows, MappedRows, Row, RowIndex, Rows};
|
pub use crate::row::{AndThenRows, MappedRows, Row, RowIndex, Rows};
|
||||||
|
|
||||||
pub use crate::transaction::{DropBehavior, Savepoint, Transaction, TransactionBehavior};
|
pub use crate::transaction::{DropBehavior, Savepoint, Transaction, TransactionBehavior};
|
||||||
#[allow(deprecated)]
|
|
||||||
pub use crate::transaction::{SqliteTransaction, SqliteTransactionBehavior};
|
|
||||||
|
|
||||||
pub use crate::error::Error;
|
pub use crate::error::Error;
|
||||||
#[allow(deprecated)]
|
|
||||||
pub use crate::error::SqliteError;
|
|
||||||
pub use crate::ffi::ErrorCode;
|
pub use crate::ffi::ErrorCode;
|
||||||
|
|
||||||
pub use crate::cache::CachedStatement;
|
pub use crate::cache::CachedStatement;
|
||||||
@ -112,8 +108,7 @@ pub use crate::version::*;
|
|||||||
#[cfg(feature = "hooks")]
|
#[cfg(feature = "hooks")]
|
||||||
pub use crate::hooks::*;
|
pub use crate::hooks::*;
|
||||||
#[cfg(feature = "load_extension")]
|
#[cfg(feature = "load_extension")]
|
||||||
#[allow(deprecated)]
|
pub use crate::load_extension_guard::LoadExtensionGuard;
|
||||||
pub use crate::load_extension_guard::{LoadExtensionGuard, SqliteLoadExtensionGuard};
|
|
||||||
|
|
||||||
#[cfg(feature = "backup")]
|
#[cfg(feature = "backup")]
|
||||||
pub mod backup;
|
pub mod backup;
|
||||||
@ -147,11 +142,7 @@ pub mod vtab;
|
|||||||
// Number of cached prepared statements we'll hold on to.
|
// Number of cached prepared statements we'll hold on to.
|
||||||
const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16;
|
const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16;
|
||||||
/// To be used when your statement has no [parameter](https://sqlite.org/lang_expr.html#varparam).
|
/// To be used when your statement has no [parameter](https://sqlite.org/lang_expr.html#varparam).
|
||||||
pub const NO_PARAMS: &'static [&'static ToSql] = &[];
|
pub const NO_PARAMS: &[&ToSql] = &[];
|
||||||
|
|
||||||
/// Old name for `Result`. `SqliteResult` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Result instead")]
|
|
||||||
pub type SqliteResult<T> = Result<T>;
|
|
||||||
|
|
||||||
/// A typedef of the result returned by many methods.
|
/// A typedef of the result returned by many methods.
|
||||||
pub type Result<T> = result::Result<T, Error>;
|
pub type Result<T> = result::Result<T, Error>;
|
||||||
@ -197,10 +188,6 @@ impl<'a> DatabaseName<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Old name for `Connection`. `SqliteConnection` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Connection instead")]
|
|
||||||
pub type SqliteConnection = Connection;
|
|
||||||
|
|
||||||
/// A connection to a SQLite database.
|
/// A connection to a SQLite database.
|
||||||
pub struct Connection {
|
pub struct Connection {
|
||||||
db: RefCell<InnerConnection>,
|
db: RefCell<InnerConnection>,
|
||||||
@ -631,10 +618,6 @@ struct InnerConnection {
|
|||||||
free_update_hook: Option<fn(*mut ::std::os::raw::c_void)>,
|
free_update_hook: Option<fn(*mut ::std::os::raw::c_void)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Old name for `OpenFlags`. `SqliteOpenFlags` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use OpenFlags instead")]
|
|
||||||
pub type SqliteOpenFlags = OpenFlags;
|
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[doc = "Flags for opening SQLite database connections."]
|
#[doc = "Flags for opening SQLite database connections."]
|
||||||
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
|
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
|
||||||
@ -1070,18 +1053,6 @@ impl Drop for InnerConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Old name for `Statement`. `SqliteStatement` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Statement instead")]
|
|
||||||
pub type SqliteStatement<'conn> = Statement<'conn>;
|
|
||||||
|
|
||||||
/// Old name for `Rows`. `SqliteRows` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Rows instead")]
|
|
||||||
pub type SqliteRows<'stmt> = Rows<'stmt>;
|
|
||||||
|
|
||||||
/// Old name for `Row`. `SqliteRow` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Row instead")]
|
|
||||||
pub type SqliteRow<'a, 'stmt> = Row<'a, 'stmt>;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
extern crate tempdir;
|
extern crate tempdir;
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
use crate::{Connection, Result};
|
use crate::{Connection, Result};
|
||||||
|
|
||||||
/// Old name for `LoadExtensionGuard`. `SqliteLoadExtensionGuard` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use LoadExtensionGuard instead")]
|
|
||||||
pub type SqliteLoadExtensionGuard<'conn> = LoadExtensionGuard<'conn>;
|
|
||||||
|
|
||||||
/// RAII guard temporarily enabling SQLite extensions to be loaded.
|
/// RAII guard temporarily enabling SQLite extensions to be loaded.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
|
@ -367,12 +367,7 @@ impl<'conn> Statement<'conn> {
|
|||||||
P::Item: ToSql,
|
P::Item: ToSql,
|
||||||
{
|
{
|
||||||
let mut rows = self.query(params)?;
|
let mut rows = self.query(params)?;
|
||||||
let exists = {
|
let exists = rows.next().is_some();
|
||||||
match rows.next() {
|
|
||||||
Some(_) => true,
|
|
||||||
None => false,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(exists)
|
Ok(exists)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
use crate::{Connection, Result};
|
use crate::{Connection, Result};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
/// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is
|
|
||||||
/// deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use TransactionBehavior instead")]
|
|
||||||
pub type SqliteTransactionBehavior = TransactionBehavior;
|
|
||||||
|
|
||||||
/// Options for transaction behavior. See [BEGIN
|
/// Options for transaction behavior. See [BEGIN
|
||||||
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@ -32,10 +27,6 @@ pub enum DropBehavior {
|
|||||||
Panic,
|
Panic,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Old name for `Transaction`. `SqliteTransaction` is deprecated.
|
|
||||||
#[deprecated(since = "0.6.0", note = "Use Transaction instead")]
|
|
||||||
pub type SqliteTransaction<'conn> = Transaction<'conn>;
|
|
||||||
|
|
||||||
/// Represents a transaction on a database connection.
|
/// Represents a transaction on a database connection.
|
||||||
///
|
///
|
||||||
/// ## Note
|
/// ## Note
|
||||||
|
@ -467,6 +467,8 @@ impl<'a> Values<'a> {
|
|||||||
Error::FromSqlConversionFailure(idx, value.data_type(), err)
|
Error::FromSqlConversionFailure(idx, value.data_type(), err)
|
||||||
}
|
}
|
||||||
FromSqlError::OutOfRange(i) => Error::IntegralValueOutOfRange(idx, i),
|
FromSqlError::OutOfRange(i) => Error::IntegralValueOutOfRange(idx, i),
|
||||||
|
#[cfg(feature = "i128_blob")]
|
||||||
|
FromSqlError::InvalidI128Size(_) => Error::InvalidColumnType(idx, value.data_type()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user