mirror of
https://github.com/isar/rusqlite.git
synced 2025-03-29 09:02:57 +08:00
Applied some spellchecker suggestions
This commit is contained in:
parent
eebbbb0086
commit
c32d7a79a2
16
Cargo.toml
16
Cargo.toml
@ -13,12 +13,12 @@ license = "MIT"
|
||||
categories = ["database"]
|
||||
|
||||
exclude = [
|
||||
"/.github/*",
|
||||
"/.gitattributes",
|
||||
"/appveyor.yml",
|
||||
"/Changelog.md",
|
||||
"/clippy.toml",
|
||||
"/codecov.yml",
|
||||
"/.github/*",
|
||||
"/.gitattributes",
|
||||
"/appveyor.yml",
|
||||
"/Changelog.md",
|
||||
"/clippy.toml",
|
||||
"/codecov.yml",
|
||||
]
|
||||
|
||||
[badges]
|
||||
@ -133,8 +133,8 @@ lazy_static = "1.4"
|
||||
regex = "1.5.5"
|
||||
uuid = { version = "1.0", features = ["v4"] }
|
||||
unicase = "2.6.0"
|
||||
# Use `bencher` over criterion because it builds much faster and we don't have
|
||||
# many benchmarks
|
||||
# Use `bencher` over criterion because it builds much faster,
|
||||
# and we don't have many benchmarks
|
||||
bencher = "0.1"
|
||||
|
||||
[dependencies.libsqlite3-sys]
|
||||
|
@ -169,7 +169,7 @@ mod build_bundled {
|
||||
Some(openssl_dir) => {
|
||||
let lib_dir = lib_dir.map(|d| vec![d]).unwrap_or_else(|| {
|
||||
let mut lib_dirs = vec![];
|
||||
// OpenSSL 3.0 now puts it's libraries in lib64/ by default,
|
||||
// OpenSSL 3.0 now puts its libraries in lib64/ by default,
|
||||
// check for both it and lib/.
|
||||
if openssl_dir.join("lib64").exists() {
|
||||
lib_dirs.push(openssl_dir.join("lib64"));
|
||||
|
@ -118,7 +118,7 @@ impl error::Error for Error {
|
||||
|
||||
// Result codes.
|
||||
// Note: These are not public because our bindgen bindings export whichever
|
||||
// constants are present in the current version of SQLite. We repeat them here
|
||||
// constants are present in the current version of SQLite. We repeat them here,
|
||||
// so we don't have to worry about which version of SQLite added which
|
||||
// constants, and we only use them to implement code_to_str below.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Automatic axtension loading
|
||||
//! Automatic extension loading
|
||||
use super::ffi;
|
||||
use crate::error::{check, to_sqlite_error};
|
||||
use crate::{Connection, Error, Result};
|
||||
|
@ -50,7 +50,7 @@
|
||||
//! Using `MaybeUninit` here can be more efficient in some cases, but is
|
||||
//! often inconvenient, so both are provided.
|
||||
//!
|
||||
//! 2. Exact/inexact refers to to whether or not the entire buffer must be
|
||||
//! 2. Exact/inexact refers to whether or not the entire buffer must be
|
||||
//! filled in order for the call to be considered a success.
|
||||
//!
|
||||
//! The "exact" functions require the provided buffer be entirely filled, or
|
||||
@ -287,7 +287,7 @@ impl Blob<'_> {
|
||||
/// Close a BLOB handle.
|
||||
///
|
||||
/// Calling `close` explicitly is not required (the BLOB will be closed
|
||||
/// when the `Blob` is dropped), but it is available so you can get any
|
||||
/// when the `Blob` is dropped), but it is available, so you can get any
|
||||
/// errors that occur.
|
||||
///
|
||||
/// # Failure
|
||||
|
@ -116,7 +116,7 @@ impl<'conn> Blob<'conn> {
|
||||
|
||||
if read_len == 0 {
|
||||
// We could return `Ok(&mut [])`, but it seems confusing that the
|
||||
// pointers don't match, so fabricate a empty slice of u8 with the
|
||||
// pointers don't match, so fabricate an empty slice of u8 with the
|
||||
// same base pointer as `buf`.
|
||||
let empty = unsafe { from_raw_parts_mut(buf.as_mut_ptr().cast::<u8>(), 0) };
|
||||
return Ok(empty);
|
||||
|
@ -101,7 +101,7 @@ pub enum Error {
|
||||
#[allow(dead_code)]
|
||||
ModuleError(String),
|
||||
|
||||
/// An unwinding panic occurs in an UDF (user-defined function).
|
||||
/// An unwinding panic occurs in a UDF (user-defined function).
|
||||
UnwindingPanic,
|
||||
|
||||
/// An error returned when
|
||||
|
@ -267,7 +267,7 @@ pub type SubType = Option<std::os::raw::c_uint>;
|
||||
|
||||
/// Result of an SQL function
|
||||
pub trait SqlFnOutput {
|
||||
/// Converts Rust value to SQLite value with an optional sub-type
|
||||
/// Converts Rust value to SQLite value with an optional subtype
|
||||
fn to_sql(&self) -> Result<(ToSqlOutput<'_>, SubType)>;
|
||||
}
|
||||
|
||||
@ -381,11 +381,11 @@ bitflags::bitflags! {
|
||||
const SQLITE_DETERMINISTIC = ffi::SQLITE_DETERMINISTIC; // 3.8.3
|
||||
/// Means that the function may only be invoked from top-level SQL.
|
||||
const SQLITE_DIRECTONLY = 0x0000_0008_0000; // 3.30.0
|
||||
/// Indicates to SQLite that a function may call `sqlite3_value_subtype()` to inspect the sub-types of its arguments.
|
||||
/// Indicates to SQLite that a function may call `sqlite3_value_subtype()` to inspect the subtypes of its arguments.
|
||||
const SQLITE_SUBTYPE = 0x0000_0010_0000; // 3.30.0
|
||||
/// Means that the function is unlikely to cause problems even if misused.
|
||||
const SQLITE_INNOCUOUS = 0x0000_0020_0000; // 3.31.0
|
||||
/// Indicates to SQLite that a function might call `sqlite3_result_subtype()` to cause a sub-type to be associated with its result.
|
||||
/// Indicates to SQLite that a function might call `sqlite3_result_subtype()` to cause a subtype to be associated with its result.
|
||||
const SQLITE_RESULT_SUBTYPE = 0x0000_0100_0000; // 3.45.0
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ pub struct InnerConnection {
|
||||
// a `sqlite3_interrupt`, and vice versa, so we take this mutex during
|
||||
// those functions. This protects a copy of the `db` pointer (which is
|
||||
// cleared on closing), however the main copy, `db`, is unprotected.
|
||||
// Otherwise, a long running query would prevent calling interrupt, as
|
||||
// Otherwise, a long-running query would prevent calling interrupt, as
|
||||
// interrupt would only acquire the lock after the query's completion.
|
||||
interrupt_lock: Arc<Mutex<*mut ffi::sqlite3>>,
|
||||
#[cfg(feature = "hooks")]
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -954,7 +954,7 @@ impl Connection {
|
||||
|
||||
/// Helper to register an SQLite extension written in Rust.
|
||||
/// For [persistent](https://sqlite.org/loadext.html#persistent_loadable_extensions) extension,
|
||||
/// `init` should returns `Ok(true)`.
|
||||
/// `init` should return `Ok(true)`.
|
||||
/// # Safety
|
||||
/// * Results are undefined if `init` does not just register features.
|
||||
#[cfg(feature = "loadable_extension")]
|
||||
@ -1000,7 +1000,7 @@ impl Connection {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get access to a handle that can be used to interrupt long running
|
||||
/// Get access to a handle that can be used to interrupt long-running
|
||||
/// queries from another thread.
|
||||
#[inline]
|
||||
pub fn get_interrupt_handle(&self) -> InterruptHandle {
|
||||
@ -1074,7 +1074,7 @@ impl Connection {
|
||||
}
|
||||
}
|
||||
|
||||
/// Determine whether or not an interrupt is currently in effect
|
||||
/// Determine whether an interrupt is currently in effect
|
||||
#[cfg(feature = "modern_sqlite")] // 3.41.0
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "modern_sqlite")))]
|
||||
pub fn is_interrupted(&self) -> bool {
|
||||
@ -1165,7 +1165,7 @@ bitflags::bitflags! {
|
||||
/// If the database does not already exist, an error is returned.
|
||||
const SQLITE_OPEN_READ_ONLY = ffi::SQLITE_OPEN_READONLY;
|
||||
/// The database is opened for reading and writing if possible,
|
||||
/// or reading only if the file is write protected by the operating system.
|
||||
/// or reading only if the file is write-protected by the operating system.
|
||||
/// In either case the database must already exist, otherwise an error is returned.
|
||||
const SQLITE_OPEN_READ_WRITE = ffi::SQLITE_OPEN_READWRITE;
|
||||
/// The database is created if it does not already exist
|
||||
@ -1870,7 +1870,7 @@ mod test {
|
||||
db.close().unwrap();
|
||||
handle.interrupt();
|
||||
|
||||
// Look at it's internals to see if we cleared it out properly.
|
||||
// Look at its internals to see if we cleared it out properly.
|
||||
let db_guard = handle.db_lock.lock().unwrap();
|
||||
assert!(db_guard.is_null());
|
||||
// It would be nice to test that we properly handle close/interrupt
|
||||
|
@ -53,7 +53,7 @@ use sealed::Sealed;
|
||||
///
|
||||
/// (Note: in this case we don't implement this for slices for coherence
|
||||
/// reasons, so it really is only for the "reference to array" types —
|
||||
/// hence why the number of parameters must be <= 32 or you need to
|
||||
/// hence why the number of parameters must be <= 32, or you need to
|
||||
/// reach for `rusqlite::params!`)
|
||||
///
|
||||
/// Unfortunately, in the current design it's not possible to allow this for
|
||||
@ -108,7 +108,7 @@ use sealed::Sealed;
|
||||
/// parameters, or lists where the number of parameters exceeds 32.
|
||||
///
|
||||
/// - As a slice of `&[(&str, &dyn ToSql)]`. This is what essentially all of
|
||||
/// these boil down to in the end, conceptually at least. In theory you can
|
||||
/// these boil down to in the end, conceptually at least. In theory, you can
|
||||
/// pass this as `stmt`.
|
||||
///
|
||||
/// - As array references, similar to the positional params. This looks like
|
||||
@ -264,7 +264,7 @@ macro_rules! single_tuple_impl {
|
||||
}
|
||||
}
|
||||
|
||||
// We use a the macro for the rest, but don't bother with trying to implement it
|
||||
// We use a macro for the rest, but don't bother with trying to implement it
|
||||
// in a single invocation (it's possible to do, but my attempts were almost the
|
||||
// same amount of code as just writing it out this way, and much more dense --
|
||||
// it is a more complicated case than the TryFrom macro we have for row->tuple).
|
||||
@ -407,7 +407,7 @@ impl_for_array_ref!(
|
||||
/// production-ready:
|
||||
///
|
||||
/// - production code should ensure `usernames` isn't so large that it will
|
||||
/// surpass [`conn.limit(Limit::SQLITE_LIMIT_VARIABLE_NUMBER)`][limits]),
|
||||
/// surpass [`conn.limit(Limit::SQLITE_LIMIT_VARIABLE_NUMBER)`][limits],
|
||||
/// chunking if too large. (Note that the limits api requires rusqlite to have
|
||||
/// the "limits" feature).
|
||||
///
|
||||
|
@ -5,7 +5,7 @@ use std::convert;
|
||||
use super::{Error, Result, Statement};
|
||||
use crate::types::{FromSql, FromSqlError, ValueRef};
|
||||
|
||||
/// An handle for the resulting rows of a query.
|
||||
/// A handle for the resulting rows of a query.
|
||||
#[must_use = "Rows is lazy and will do nothing unless consumed"]
|
||||
pub struct Rows<'stmt> {
|
||||
pub(crate) stmt: Option<&'stmt Statement<'stmt>>,
|
||||
@ -305,7 +305,7 @@ impl<'stmt> Row<'stmt> {
|
||||
/// allowing data to be read out of a row without copying.
|
||||
///
|
||||
/// This `ValueRef` is valid only as long as this Row, which is enforced by
|
||||
/// it's lifetime. This means that while this method is completely safe,
|
||||
/// its lifetime. This means that while this method is completely safe,
|
||||
/// it can be somewhat difficult to use, and most callers will be better
|
||||
/// served by [`get`](Row::get) or [`get_unwrap`](Row::get_unwrap).
|
||||
///
|
||||
@ -329,7 +329,7 @@ impl<'stmt> Row<'stmt> {
|
||||
/// allowing data to be read out of a row without copying.
|
||||
///
|
||||
/// This `ValueRef` is valid only as long as this Row, which is enforced by
|
||||
/// it's lifetime. This means that while this method is completely safe,
|
||||
/// its lifetime. This means that while this method is completely safe,
|
||||
/// it can be difficult to use, and most callers will be better served by
|
||||
/// [`get`](Row::get) or [`get_unwrap`](Row::get_unwrap).
|
||||
///
|
||||
|
@ -561,7 +561,7 @@ impl Statement<'_> {
|
||||
///
|
||||
/// Any unbound parameters will have `NULL` as their value.
|
||||
///
|
||||
/// This should not generally be used outside of special cases, and
|
||||
/// This should not generally be used outside special cases, and
|
||||
/// functions in the [`Statement::execute`] family should be preferred.
|
||||
///
|
||||
/// # Failure
|
||||
@ -580,7 +580,7 @@ impl Statement<'_> {
|
||||
///
|
||||
/// Any unbound parameters will have `NULL` as their value.
|
||||
///
|
||||
/// This should not generally be used outside of special cases, and
|
||||
/// This should not generally be used outside special cases, and
|
||||
/// functions in the [`Statement::query`] family should be preferred.
|
||||
///
|
||||
/// Note that if the SQL does not return results, [`Statement::raw_execute`]
|
||||
@ -1019,7 +1019,7 @@ mod test {
|
||||
let doubled_id: i32 = rows.next().unwrap()?;
|
||||
assert_eq!(1, doubled_id);
|
||||
|
||||
// second row should be Err
|
||||
// second row should be an `Err`
|
||||
#[allow(clippy::match_wild_err_arm)]
|
||||
match rows.next().unwrap() {
|
||||
Ok(_) => panic!("invalid Ok"),
|
||||
|
@ -100,7 +100,7 @@ impl Transaction<'_> {
|
||||
/// transactions.
|
||||
///
|
||||
/// Even though we don't mutate the connection, we take a `&mut Connection`
|
||||
/// so as to prevent nested transactions on the same connection. For cases
|
||||
/// to prevent nested transactions on the same connection. For cases
|
||||
/// where this is unacceptable, [`Transaction::new_unchecked`] is available.
|
||||
#[inline]
|
||||
pub fn new(conn: &mut Connection, behavior: TransactionBehavior) -> Result<Transaction<'_>> {
|
||||
@ -624,12 +624,12 @@ mod test {
|
||||
let mut sp1 = tx.savepoint()?;
|
||||
sp1.execute_batch("INSERT INTO foo VALUES(2)")?;
|
||||
assert_current_sum(3, &sp1)?;
|
||||
// will rollback sp1
|
||||
// will roll back sp1
|
||||
{
|
||||
let mut sp2 = sp1.savepoint()?;
|
||||
sp2.execute_batch("INSERT INTO foo VALUES(4)")?;
|
||||
assert_current_sum(7, &sp2)?;
|
||||
// will rollback sp2
|
||||
// will roll back sp2
|
||||
{
|
||||
let sp3 = sp2.savepoint()?;
|
||||
sp3.execute_batch("INSERT INTO foo VALUES(8)")?;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{Type, Value};
|
||||
use crate::types::{FromSqlError, FromSqlResult};
|
||||
|
||||
/// A non-owning [dynamic type value](http://sqlite.org/datatype3.html). Typically the
|
||||
/// A non-owning [dynamic type value](http://sqlite.org/datatype3.html). Typically, the
|
||||
/// memory backing this value is owned by SQLite.
|
||||
///
|
||||
/// See [`Value`](Value) for an owning dynamic type value.
|
||||
@ -47,7 +47,7 @@ impl<'a> ValueRef<'a> {
|
||||
|
||||
/// If `self` is case `Null` returns None.
|
||||
/// If `self` is case `Integer`, returns the integral value.
|
||||
/// Otherwise returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
/// Otherwise, returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
#[inline]
|
||||
pub fn as_i64_or_null(&self) -> FromSqlResult<Option<i64>> {
|
||||
match *self {
|
||||
@ -69,7 +69,7 @@ impl<'a> ValueRef<'a> {
|
||||
|
||||
/// If `self` is case `Null` returns None.
|
||||
/// If `self` is case `Real`, returns the floating point value.
|
||||
/// Otherwise returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
/// Otherwise, returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
#[inline]
|
||||
pub fn as_f64_or_null(&self) -> FromSqlResult<Option<f64>> {
|
||||
match *self {
|
||||
@ -93,7 +93,7 @@ impl<'a> ValueRef<'a> {
|
||||
|
||||
/// If `self` is case `Null` returns None.
|
||||
/// If `self` is case `Text`, returns the string value.
|
||||
/// Otherwise returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
/// Otherwise, returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
#[inline]
|
||||
pub fn as_str_or_null(&self) -> FromSqlResult<Option<&'a str>> {
|
||||
match *self {
|
||||
@ -117,7 +117,7 @@ impl<'a> ValueRef<'a> {
|
||||
|
||||
/// If `self` is case `Null` returns None.
|
||||
/// If `self` is case `Blob`, returns the byte slice.
|
||||
/// Otherwise returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
/// Otherwise, returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
|
||||
#[inline]
|
||||
pub fn as_blob_or_null(&self) -> FromSqlResult<Option<&'a [u8]>> {
|
||||
match *self {
|
||||
|
@ -103,7 +103,7 @@ impl SqliteMallocString {
|
||||
/// fails, we call `handle_alloc_error` which aborts the program after
|
||||
/// calling a global hook.
|
||||
///
|
||||
/// This means it's safe to use in extern "C" functions even outside of
|
||||
/// This means it's safe to use in extern "C" functions even outside
|
||||
/// `catch_unwind`.
|
||||
pub(crate) fn from_str(s: &str) -> Self {
|
||||
let s = if s.as_bytes().contains(&0) {
|
||||
|
@ -137,7 +137,7 @@ macro_rules! module {
|
||||
};
|
||||
}
|
||||
|
||||
/// Create an modifiable virtual table implementation.
|
||||
/// Create a modifiable virtual table implementation.
|
||||
///
|
||||
/// Step 2 of [Creating New Virtual Table Implementations](https://sqlite.org/vtab.html#creating_new_virtual_table_implementations).
|
||||
#[must_use]
|
||||
|
Loading…
x
Reference in New Issue
Block a user