mirror of
https://github.com/isar/rusqlite.git
synced 2025-04-16 05:47:46 +08:00
clippy::doc_markdown
This commit is contained in:
parent
9189b54fc7
commit
67d2027162
@ -1,4 +1,4 @@
|
|||||||
//! Ensure loadable_extension.rs works.
|
//! Ensure `loadable_extension.rs` works.
|
||||||
|
|
||||||
use rusqlite::{Connection, Result};
|
use rusqlite::{Connection, Result};
|
||||||
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
|
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
|
||||||
|
@ -6,7 +6,7 @@ use std::path::Path;
|
|||||||
///
|
///
|
||||||
/// Note that there is no way to know at compile-time which system we'll be
|
/// Note that there is no way to know at compile-time which system we'll be
|
||||||
/// targeting, and this test must be made at run-time (of the build script) See
|
/// targeting, and this test must be made at run-time (of the build script) See
|
||||||
/// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
|
/// <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts>
|
||||||
fn win_target() -> bool {
|
fn win_target() -> bool {
|
||||||
env::var("CARGO_CFG_WINDOWS").is_ok()
|
env::var("CARGO_CFG_WINDOWS").is_ok()
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,17 @@ pub enum ErrorCode {
|
|||||||
DatabaseBusy,
|
DatabaseBusy,
|
||||||
/// A table in the database is locked
|
/// A table in the database is locked
|
||||||
DatabaseLocked,
|
DatabaseLocked,
|
||||||
/// A malloc() failed
|
/// A `malloc()` failed
|
||||||
OutOfMemory,
|
OutOfMemory,
|
||||||
/// Attempt to write a readonly database
|
/// Attempt to write a readonly database
|
||||||
ReadOnly,
|
ReadOnly,
|
||||||
/// Operation terminated by sqlite3_interrupt()
|
/// Operation terminated by `sqlite3_interrupt()`
|
||||||
OperationInterrupted,
|
OperationInterrupted,
|
||||||
/// Some kind of disk I/O error occurred
|
/// Some kind of disk I/O error occurred
|
||||||
SystemIoFailure,
|
SystemIoFailure,
|
||||||
/// The database disk image is malformed
|
/// The database disk image is malformed
|
||||||
DatabaseCorrupt,
|
DatabaseCorrupt,
|
||||||
/// Unknown opcode in sqlite3_file_control()
|
/// Unknown opcode in `sqlite3_file_control()`
|
||||||
NotFound,
|
NotFound,
|
||||||
/// Insertion failed because database is full
|
/// Insertion failed because database is full
|
||||||
DiskFull,
|
DiskFull,
|
||||||
@ -48,7 +48,7 @@ pub enum ErrorCode {
|
|||||||
NoLargeFileSupport,
|
NoLargeFileSupport,
|
||||||
/// Authorization denied
|
/// Authorization denied
|
||||||
AuthorizationForStatementDenied,
|
AuthorizationForStatementDenied,
|
||||||
/// 2nd parameter to sqlite3_bind out of range
|
/// 2nd parameter to `sqlite3_bind` out of range
|
||||||
ParameterOutOfRange,
|
ParameterOutOfRange,
|
||||||
/// File opened that is not a database file
|
/// File opened that is not a database file
|
||||||
NotADatabase,
|
NotADatabase,
|
||||||
@ -281,7 +281,7 @@ pub fn code_to_str(code: c_int) -> &'static str {
|
|||||||
pub enum InitError {
|
pub enum InitError {
|
||||||
/// Version mismatch between the extension and the SQLite3 library
|
/// Version mismatch between the extension and the SQLite3 library
|
||||||
VersionMismatch { compile_time: i32, runtime: i32 },
|
VersionMismatch { compile_time: i32, runtime: i32 },
|
||||||
/// Invalid function pointer in one of sqlite3_api_routines fields
|
/// Invalid function pointer in one of `sqlite3_api_routines` fields
|
||||||
NullFunctionPointer,
|
NullFunctionPointer,
|
||||||
}
|
}
|
||||||
#[cfg(feature = "loadable_extension")]
|
#[cfg(feature = "loadable_extension")]
|
||||||
|
@ -57,7 +57,7 @@ impl Statement<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check that column name reference lifetime is limited:
|
/// Check that column name reference lifetime is limited:
|
||||||
/// https://www.sqlite.org/c3ref/column_name.html
|
/// <https://www.sqlite.org/c3ref/column_name.html>
|
||||||
/// > The returned string pointer is valid...
|
/// > The returned string pointer is valid...
|
||||||
///
|
///
|
||||||
/// `column_name` reference can become invalid if `stmt` is reprepared
|
/// `column_name` reference can become invalid if `stmt` is reprepared
|
||||||
@ -231,7 +231,7 @@ mod test {
|
|||||||
/// `column_name` reference should stay valid until `stmt` is reprepared (or
|
/// `column_name` reference should stay valid until `stmt` is reprepared (or
|
||||||
/// reset) even if DB schema is altered (SQLite documentation is
|
/// reset) even if DB schema is altered (SQLite documentation is
|
||||||
/// ambiguous here because it says reference "is valid until (...) the next
|
/// ambiguous here because it says reference "is valid until (...) the next
|
||||||
/// call to sqlite3_column_name() or sqlite3_column_name16() on the same
|
/// call to `sqlite3_column_name()` or `sqlite3_column_name16()` on the same
|
||||||
/// column.". We assume that reference is valid if only
|
/// column.". We assume that reference is valid if only
|
||||||
/// `sqlite3_column_name()` is used):
|
/// `sqlite3_column_name()` is used):
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -20,7 +20,7 @@ pub enum DbConfig {
|
|||||||
SQLITE_DBCONFIG_ENABLE_FKEY = ffi::SQLITE_DBCONFIG_ENABLE_FKEY,
|
SQLITE_DBCONFIG_ENABLE_FKEY = ffi::SQLITE_DBCONFIG_ENABLE_FKEY,
|
||||||
/// Enable or disable triggers.
|
/// Enable or disable triggers.
|
||||||
SQLITE_DBCONFIG_ENABLE_TRIGGER = ffi::SQLITE_DBCONFIG_ENABLE_TRIGGER,
|
SQLITE_DBCONFIG_ENABLE_TRIGGER = ffi::SQLITE_DBCONFIG_ENABLE_TRIGGER,
|
||||||
/// Enable or disable the fts3_tokenizer() function which is part of the
|
/// Enable or disable the `fts3_tokenizer()` function which is part of the
|
||||||
/// FTS3 full-text search engine extension.
|
/// FTS3 full-text search engine extension.
|
||||||
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = ffi::SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, // 3.12.0
|
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = ffi::SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, // 3.12.0
|
||||||
//SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005,
|
//SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005,
|
||||||
@ -37,7 +37,7 @@ pub enum DbConfig {
|
|||||||
SQLITE_DBCONFIG_RESET_DATABASE = 1009, // 3.24.0
|
SQLITE_DBCONFIG_RESET_DATABASE = 1009, // 3.24.0
|
||||||
/// Activates or deactivates the "defensive" flag for a database connection.
|
/// Activates or deactivates the "defensive" flag for a database connection.
|
||||||
SQLITE_DBCONFIG_DEFENSIVE = 1010, // 3.26.0
|
SQLITE_DBCONFIG_DEFENSIVE = 1010, // 3.26.0
|
||||||
/// Activates or deactivates the "writable_schema" flag.
|
/// Activates or deactivates the `writable_schema` flag.
|
||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011, // 3.28.0
|
SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011, // 3.28.0
|
||||||
/// Activates or deactivates the legacy behavior of the ALTER TABLE RENAME
|
/// Activates or deactivates the legacy behavior of the ALTER TABLE RENAME
|
||||||
@ -59,11 +59,11 @@ pub enum DbConfig {
|
|||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016, // 3.31.0
|
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016, // 3.31.0
|
||||||
/// Tells SQLite to assume that database schemas (the contents of the
|
/// Tells SQLite to assume that database schemas (the contents of the
|
||||||
/// sqlite_master tables) are untainted by malicious content.
|
/// `sqlite_master` tables) are untainted by malicious content.
|
||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017, // 3.31.0
|
SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017, // 3.31.0
|
||||||
/// Sets or clears a flag that enables collection of the
|
/// Sets or clears a flag that enables collection of the
|
||||||
/// sqlite3_stmt_scanstatus_v2() statistics
|
/// `sqlite3_stmt_scanstatus_v2()` statistics
|
||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
SQLITE_DBCONFIG_STMT_SCANSTATUS = 1018, // 3.42.0
|
SQLITE_DBCONFIG_STMT_SCANSTATUS = 1018, // 3.42.0
|
||||||
/// Changes the default order in which tables and indexes are scanned
|
/// Changes the default order in which tables and indexes are scanned
|
||||||
|
@ -876,23 +876,23 @@ impl Statement<'_> {
|
|||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum StatementStatus {
|
pub enum StatementStatus {
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_FULLSCAN_STEP
|
/// Equivalent to `SQLITE_STMTSTATUS_FULLSCAN_STEP`
|
||||||
FullscanStep = 1,
|
FullscanStep = 1,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_SORT
|
/// Equivalent to `SQLITE_STMTSTATUS_SORT`
|
||||||
Sort = 2,
|
Sort = 2,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_AUTOINDEX
|
/// Equivalent to `SQLITE_STMTSTATUS_AUTOINDEX`
|
||||||
AutoIndex = 3,
|
AutoIndex = 3,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_VM_STEP
|
/// Equivalent to `SQLITE_STMTSTATUS_VM_STEP`
|
||||||
VmStep = 4,
|
VmStep = 4,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_REPREPARE (3.20.0)
|
/// Equivalent to `SQLITE_STMTSTATUS_REPREPARE` (3.20.0)
|
||||||
RePrepare = 5,
|
RePrepare = 5,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_RUN (3.20.0)
|
/// Equivalent to `SQLITE_STMTSTATUS_RUN` (3.20.0)
|
||||||
Run = 6,
|
Run = 6,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_FILTER_MISS
|
/// Equivalent to `SQLITE_STMTSTATUS_FILTER_MISS`
|
||||||
FilterMiss = 7,
|
FilterMiss = 7,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_FILTER_HIT
|
/// Equivalent to `SQLITE_STMTSTATUS_FILTER_HIT`
|
||||||
FilterHit = 8,
|
FilterHit = 8,
|
||||||
/// Equivalent to SQLITE_STMTSTATUS_MEMUSED (3.20.0)
|
/// Equivalent to `SQLITE_STMTSTATUS_MEMUSED` (3.20.0)
|
||||||
MemUsed = 99,
|
MemUsed = 99,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,11 +377,11 @@ impl Drop for Savepoint<'_> {
|
|||||||
#[cfg(feature = "modern_sqlite")] // 3.37.0
|
#[cfg(feature = "modern_sqlite")] // 3.37.0
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "modern_sqlite")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "modern_sqlite")))]
|
||||||
pub enum TransactionState {
|
pub enum TransactionState {
|
||||||
/// Equivalent to SQLITE_TXN_NONE
|
/// Equivalent to `SQLITE_TXN_NONE`
|
||||||
None,
|
None,
|
||||||
/// Equivalent to SQLITE_TXN_READ
|
/// Equivalent to `SQLITE_TXN_READ`
|
||||||
Read,
|
Read,
|
||||||
/// Equivalent to SQLITE_TXN_WRITE
|
/// Equivalent to `SQLITE_TXN_WRITE`
|
||||||
Write,
|
Write,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ const LEGACY_DATE_TIME_FORMAT: &[FormatItem<'_>] = format_description!(
|
|||||||
"[year]-[month]-[day] [hour]:[minute]:[second]:[subsecond] [offset_hour sign:mandatory]:[offset_minute]"
|
"[year]-[month]-[day] [hour]:[minute]:[second]:[subsecond] [offset_hour sign:mandatory]:[offset_minute]"
|
||||||
);
|
);
|
||||||
|
|
||||||
/// OffsetDatetime => RFC3339 format ("YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM")
|
/// `OffsetDatetime` => RFC3339 format ("YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM")
|
||||||
impl ToSql for OffsetDateTime {
|
impl ToSql for OffsetDateTime {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
|
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
|
||||||
|
@ -189,13 +189,13 @@ pub fn eponymous_only_module<'vtab, T: VTab<'vtab>>() -> &'static Module<'vtab,
|
|||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||||
pub enum VTabConfig {
|
pub enum VTabConfig {
|
||||||
/// Equivalent to SQLITE_VTAB_CONSTRAINT_SUPPORT
|
/// Equivalent to `SQLITE_VTAB_CONSTRAINT_SUPPORT`
|
||||||
ConstraintSupport = 1,
|
ConstraintSupport = 1,
|
||||||
/// Equivalent to SQLITE_VTAB_INNOCUOUS
|
/// Equivalent to `SQLITE_VTAB_INNOCUOUS`
|
||||||
Innocuous = 2,
|
Innocuous = 2,
|
||||||
/// Equivalent to SQLITE_VTAB_DIRECTONLY
|
/// Equivalent to `SQLITE_VTAB_DIRECTONLY`
|
||||||
DirectOnly = 3,
|
DirectOnly = 3,
|
||||||
/// Equivalent to SQLITE_VTAB_USES_ALL_SCHEMAS
|
/// Equivalent to `SQLITE_VTAB_USES_ALL_SCHEMAS`
|
||||||
UsesAllSchemas = 4,
|
UsesAllSchemas = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ impl IndexInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mask of SQLITE_INDEX_SCAN_* flags.
|
/// Mask of `SQLITE_INDEX_SCAN_*` flags.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_idx_flags(&mut self, flags: IndexFlags) {
|
pub fn set_idx_flags(&mut self, flags: IndexFlags) {
|
||||||
unsafe { (*self.0).idxFlags = flags.bits() };
|
unsafe { (*self.0).idxFlags = flags.bits() };
|
||||||
|
@ -14,7 +14,7 @@ use crate::vtab::{
|
|||||||
};
|
};
|
||||||
use crate::{Connection, Error, Result};
|
use crate::{Connection, Error, Result};
|
||||||
|
|
||||||
/// Register the "generate_series" module.
|
/// Register the `generate_series` module.
|
||||||
pub fn load_module(conn: &Connection) -> Result<()> {
|
pub fn load_module(conn: &Connection) -> Result<()> {
|
||||||
let aux: Option<()> = None;
|
let aux: Option<()> = None;
|
||||||
conn.create_module("generate_series", eponymous_only_module::<SeriesTab>(), aux)
|
conn.create_module("generate_series", eponymous_only_module::<SeriesTab>(), aux)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user