mirror of
https://github.com/isar/rusqlite.git
synced 2025-03-26 07:16:05 +08:00
Improve loadable extension docs, clippy
This commit is contained in:
parent
b842783c83
commit
57d1562bf8
@ -1,4 +1,18 @@
|
|||||||
//! Adaptation of https://sqlite.org/loadext.html#programming_loadable_extensions
|
//! Adaptation of https://sqlite.org/loadext.html#programming_loadable_extensions
|
||||||
|
//!
|
||||||
|
//! # build
|
||||||
|
//! ```sh
|
||||||
|
//! cargo build --example loadable_extension --features "loadable_extension functions trace"
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! # test
|
||||||
|
//! ```sh
|
||||||
|
//! sqlite> .log on
|
||||||
|
//! sqlite> .load target/debug/examples/libloadable_extension.so
|
||||||
|
//! (28) Rusqlite extension initialized
|
||||||
|
//! sqlite> SELECT rusqlite_test_function();
|
||||||
|
//! Rusqlite extension loaded correctly!
|
||||||
|
//! ```
|
||||||
use std::os::raw::{c_char, c_int};
|
use std::os::raw::{c_char, c_int};
|
||||||
|
|
||||||
use rusqlite::ffi;
|
use rusqlite::ffi;
|
||||||
@ -6,18 +20,10 @@ use rusqlite::functions::FunctionFlags;
|
|||||||
use rusqlite::types::{ToSqlOutput, Value};
|
use rusqlite::types::{ToSqlOutput, Value};
|
||||||
use rusqlite::{Connection, Result};
|
use rusqlite::{Connection, Result};
|
||||||
|
|
||||||
/// # build
|
/// Entry point for SQLite to load the extension.
|
||||||
/// ```sh
|
/// See <https://sqlite.org/c3ref/load_extension.html> on this function's name and usage.
|
||||||
/// cargo build --example loadable_extension --features "loadable_extension functions trace"
|
/// # Safety
|
||||||
/// ```
|
/// This function is called by SQLite and must be safe to call.
|
||||||
/// # test
|
|
||||||
/// ```sh
|
|
||||||
/// sqlite> .log on
|
|
||||||
/// sqlite> .load target/debug/examples/libloadable_extension.so
|
|
||||||
/// (28) Rusqlite extension initialized
|
|
||||||
/// sqlite> SELECT rusqlite_test_function();
|
|
||||||
/// Rusqlite extension loaded correctly!
|
|
||||||
/// ```
|
|
||||||
#[expect(clippy::not_unsafe_ptr_arg_deref)]
|
#[expect(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sqlite3_extension_init(
|
pub unsafe extern "C" fn sqlite3_extension_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user