Ergonomic bindings to SQLite for Rust

Overview

Rusqlite

Travis Build Status AppVeyor Build Status Build Status dependency status Latest Version Gitter Docs codecov

Rusqlite is an ergonomic wrapper for using SQLite from Rust. It attempts to expose an interface similar to rust-postgres.

use rusqlite::{params, Connection, Result};

#[derive(Debug)]
struct Person {
    id: i32,
    name: String,
    data: Option<Vec<u8>>,
}

fn main() -> Result<()> {
    let conn = Connection::open_in_memory()?;

    conn.execute(
        "CREATE TABLE person (
                  id              INTEGER PRIMARY KEY,
                  name            TEXT NOT NULL,
                  data            BLOB
                  )",
        [],
    )?;
    let me = Person {
        id: 0,
        name: "Steven".to_string(),
        data: None,
    };
    conn.execute(
        "INSERT INTO person (name, data) VALUES (?1, ?2)",
        params![me.name, me.data],
    )?;

    let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
    let person_iter = stmt.query_map([], |row| {
        Ok(Person {
            id: row.get(0)?,
            name: row.get(1)?,
            data: row.get(2)?,
        })
    })?;

    for person in person_iter {
        println!("Found person {:?}", person.unwrap());
    }
    Ok(())
}

Supported SQLite Versions

The base rusqlite package supports SQLite version 3.6.8 or newer. If you need support for older versions, please file an issue. Some cargo features require a newer SQLite version; see details below.

Optional Features

Rusqlite provides several features that are behind Cargo features. They are:

  • load_extension allows loading dynamic library-based SQLite extensions.
  • backup allows use of SQLite's online backup API. Note: This feature requires SQLite 3.6.11 or later.
  • functions allows you to load Rust closures into SQLite connections for use in queries. Note: This feature requires SQLite 3.7.3 or later.
  • window for window function support (fun(...) OVER ...). (Implies functions.)
  • trace allows hooks into SQLite's tracing and profiling APIs. Note: This feature requires SQLite 3.6.23 or later.
  • blob gives std::io::{Read, Write, Seek} access to SQL BLOBs. Note: This feature requires SQLite 3.7.4 or later.
  • limits allows you to set and retrieve SQLite's per connection limits.
  • chrono implements FromSql and ToSql for various types from the chrono crate.
  • serde_json implements FromSql and ToSql for the Value type from the serde_json crate.
  • time implements FromSql and ToSql for the time::OffsetDateTime type from the time crate.
  • url implements FromSql and ToSql for the Url type from the url crate.
  • bundled uses a bundled version of SQLite. This is a good option for cases where linking to SQLite is complicated, such as Windows.
  • sqlcipher looks for the SQLCipher library to link against instead of SQLite. This feature is mutually exclusive with bundled.
  • hooks for Commit, Rollback and Data Change notification callbacks.
  • unlock_notify for Unlock notification.
  • vtab for virtual table support (allows you to write virtual table implementations in Rust). Currently, only read-only virtual tables are supported.
  • series exposes generate_series(...) Table-Valued Function. (Implies vtab.)
  • csvtab, CSV virtual table written in Rust. (Implies vtab.)
  • array, The rarray() Table-Valued Function. (Implies vtab.)
  • i128_blob allows storing values of type i128 type in SQLite databases. Internally, the data is stored as a 16 byte big-endian blob, with the most significant bit flipped, which allows ordering and comparison between different blobs storing i128s to work as expected.
  • uuid allows storing and retrieving Uuid values from the uuid crate using blobs.
  • session, Session module extension. Requires buildtime_bindgen feature. (Implies hooks.)
  • extra_check fail when a query passed to execute is readonly or has a column count > 0.
  • column_decltype provides columns() method for Statements and Rows; omit if linking to a version of SQLite/SQLCipher compiled with -DSQLITE_OMIT_DECLTYPE.
  • collation exposes sqlite3_create_collation_v2.

Notes on building rusqlite and libsqlite3-sys

libsqlite3-sys is a separate crate from rusqlite that provides the Rust declarations for SQLite's C API. By default, libsqlite3-sys attempts to find a SQLite library that already exists on your system using pkg-config, or a Vcpkg installation for MSVC ABI builds.

You can adjust this behavior in a number of ways:

  • If you use the bundled feature, libsqlite3-sys will use the cc crate to compile SQLite from source and link against that. This source is embedded in the libsqlite3-sys crate and is currently SQLite 3.34.0 (as of rusqlite 0.24.1 / libsqlite3-sys 0.21.0). This is probably the simplest solution to any build problems. You can enable this by adding the following in your Cargo.toml file:

    [dependencies.rusqlite]
    version = "0.24.2"
    features = ["bundled"]
  • When using the bundled feature, the build script will honor SQLITE_MAX_VARIABLE_NUMBER and SQLITE_MAX_EXPR_DEPTH variables. It will also honor a LIBSQLITE3_FLAGS variable, which can have a format like "-USQLITE_ALPHA -DSQLITE_BETA SQLITE_GAMMA ...". That would disable the SQLITE_ALPHA flag, and set the SQLITE_BETA and SQLITE_GAMMA flags. (The initial -D can be omitted, as on the last one.)

  • When linking against a SQLite library already on the system (so not using the bundled feature), you can set the SQLITE3_LIB_DIR environment variable to point to a directory containing the library. You can also set the SQLITE3_INCLUDE_DIR variable to point to the directory containing sqlite3.h.

  • Installing the sqlite3 development packages will usually be all that is required, but the build helpers for pkg-config and vcpkg have some additional configuration options. The default when using vcpkg is to dynamically link, which must be enabled by setting VCPKGRS_DYNAMIC=1 environment variable before build. vcpkg install sqlite3:x64-windows will install the required library.

  • When linking against a SQLite library already on the system, you can set the SQLITE3_STATIC environment variable to 1 to request that the library be statically instead of dynamically linked.

Binding generation

We use bindgen to generate the Rust declarations from SQLite's C header file. bindgen recommends running this as part of the build process of libraries that used this. We tried this briefly (rusqlite 0.10.0, specifically), but it had some annoyances:

  • The build time for libsqlite3-sys (and therefore rusqlite) increased dramatically.
  • Running bindgen requires a relatively-recent version of Clang, which many systems do not have installed by default.
  • Running bindgen also requires the SQLite header file to be present.

As of rusqlite 0.10.1, we avoid running bindgen at build-time by shipping pregenerated bindings for several versions of SQLite. When compiling rusqlite, we use your selected Cargo features to pick the bindings for the minimum SQLite version that supports your chosen features. If you are using libsqlite3-sys directly, you can use the same features to choose which pregenerated bindings are chosen:

  • min_sqlite_version_3_6_8 - SQLite 3.6.8 bindings (this is the default)
  • min_sqlite_version_3_6_23 - SQLite 3.6.23 bindings
  • min_sqlite_version_3_7_7 - SQLite 3.7.7 bindings

If you use the bundled feature, you will get pregenerated bindings for the bundled version of SQLite. If you need other specific pregenerated binding versions, please file an issue. If you want to run bindgen at buildtime to produce your own bindings, use the buildtime_bindgen Cargo feature.

If you enable the modern_sqlite feature, we'll use the bindings we would have included with the bundled build. You generally should have buildtime_bindgen enabled if you turn this on, as otherwise you'll need to keep the version of SQLite you link with in sync with what rusqlite would have bundled, (usually the most recent release of SQLite). Failing to do this will cause a runtime error.

Contributing

Rusqlite has many features, and many of them impact the build configuration in incompatible ways. This is unfortunate, and makes testing changes hard.

To help here: you generally should ensure that you run tests/lint for --features bundled, and --features "bundled-full session buildtime_bindgen".

If running bindgen is problematic for you, --features bundled-full enables bundled and all features which don't require binding generation, and can be used instead.

Checklist

  • Run cargo fmt to ensure your Rust code is correctly formatted.
  • Ensure cargo clippy --all-targets --workspace --features bundled passes without warnings.
  • Ensure cargo clippy --all-targets --workspace --features "bundled-full session buildtime_bindgen" passes without warnings.
  • Ensure cargo test --all-targets --workspace --features bundled reports no failures.
  • Ensure cargo test --all-targets --workspace --features "bundled-full session buildtime_bindgen" reports no failures.

Author

Rusqlite is the product of hard work by a number of people. A list is available here: https://github.com/rusqlite/rusqlite/graphs/contributors

Community

Currently there's a gitter channel set up for rusqlite here.

License

Rusqlite is available under the MIT license. See the LICENSE file for more info.

Comments
  • Omit unnecessary code from bundled SQLite build

    Omit unnecessary code from bundled SQLite build

    Following the explanations from SQLite's recommended compile-time options, this adds a Cargo feature to libsqlite-sys so that the bundled SQLite can be better tailored to the specific needs of rusqlite. The feature is enabled by default and rusqlite does explicitly not request it, so that if any other crate pulls libsqlite-sys into the dependency, no features are removed.

    As a first step, this commit

    • adds SQLITE_OMIT_PROGRESS_CALLBACK as rusqlite does not use sqlite3_progress_handler
    • and sets SQLITE_DEFAULT_MEMSTATUS to 0 as rusqlite does not use sqlite3_status.
    invalid 
    opened by adamreichold 21
  • Bundled sqlcipher?

    Bundled sqlcipher?

    I've been experimenting with a fork of this repository where I enable building a bundled version of sqlcipher, optionally also bundling in an openssl/libressl libcrypto. Would you be interested in, or in principle open to a PR with this functionality?

    Some related issues: #219, #558.

    opened by dubiousjim 18
  • Transactions don't work with async/await

    Transactions don't work with async/await

    I'm migrating a pretty big codebase to use async/await and ran into problem with making rusqlite work. I understand why Connection is not Sync and normally i would use a Mutex to hold a connection in a multi threaded environment, but in this case i'm holding a reference to a Connection and &T: Send is not Send.

    playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c25f81c48a319e5fbaf88b79ac1989eb

    use rusqlite;
    use tokio; // 0.2.13
    
    fn main() {
        let rt = tokio::runtime::Runtime::new().unwrap();
    
        let handle = rt.spawn(async {
            let conn = rusqlite::Connection::open_in_memory().unwrap();
            let tx = conn.transaction().unwrap();
            async {
                // do something async
            }
            .await;
            tx.execute_batch("SELECT 1").unwrap();
            tx.commit();
        });
    
        rt.block_on(handle).unwrap();
    }
    
    opened by aaronabramov 18
  • Add support for dot commands like `.mode` and `.import`

    Add support for dot commands like `.mode` and `.import`

    Currently executing with either commands leads to a panic syntax error. It would be useful to have these, as an example, for importing CSV files with .mode csv and .import <file> <table> which makes loading the database file a lot faster than doing an INSERT transaction for each row of information. I have to use a helper bash script in my project in order for my app to loader faster when starting up for the first time because of generating a new database file. It would be nice to do this in Rust instead.

    enhancement 
    opened by ghost 18
  • Added feature

    Added feature "bundled" to provide a fully self-contained cross-platform build.

    Howdy!

    In reference to #46 and #89 I'm submitting this PR which adds a feature "bundled" that will build and link with a static libsqlite3 from the included amalgamation.

    If you don't want the amalgamation bundled then I'm happy to toss that and come up with another solution too.

    opened by photex 17
  • Compile error in Rust 1.36.0

    Compile error in Rust 1.36.0

    rusqlite fails to compile on Rust 1.36.0:

       Compiling rusqlite v0.19.0
    error[E0277]: `*const libsqlite3_sys::sqlite3_module` cannot be sent between threads safely
      --> /home/tehdog/.cargo/registry/src/github.com-1ecc6299db9ec823/rusqlite-0.19.0/src/vtab/series.rs:21:1
       |
    21 | / lazy_static! {
    22 | |     static ref SERIES_MODULE: Module<SeriesTab> = eponymous_only_module::<SeriesTab>(1);
    23 | | }
       | |_^ `*const libsqlite3_sys::sqlite3_module` cannot be sent between threads safely
       |
       = help: within `vtab::Module<vtab::series::SeriesTab>`, the trait `std::marker::Send` is not implemented for `*const libsqlite3_sys::sqlite3_module`
       = note: required because it appears within the type `libsqlite3_sys::sqlite3_vtab`
       = note: required because it appears within the type `vtab::series::SeriesTab`
       = note: required because it appears within the type `std::marker::PhantomData<vtab::series::SeriesTab>`
       = note: required because it appears within the type `vtab::Module<vtab::series::SeriesTab>`
       = note: required because of the requirements on the impl of `std::marker::Sync` for `spin::once::Once<vtab::Module<vtab::series::SeriesTab>>`
       = note: required because it appears within the type `lazy_static::lazy::Lazy<vtab::Module<vtab::series::SeriesTab>>`
       = note: shared static variables must have a type that implements `Sync`
       = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
    
    error[E0277]: `*mut i8` cannot be sent between threads safely
      --> /home/tehdog/.cargo/registry/src/github.com-1ecc6299db9ec823/rusqlite-0.19.0/src/vtab/series.rs:21:1
       |
    21 | / lazy_static! {
    22 | |     static ref SERIES_MODULE: Module<SeriesTab> = eponymous_only_module::<SeriesTab>(1);
    23 | | }
       | |_^ `*mut i8` cannot be sent between threads safely
       |
       = help: within `vtab::Module<vtab::series::SeriesTab>`, the trait `std::marker::Send` is not implemented for `*mut i8`
       = note: required because it appears within the type `libsqlite3_sys::sqlite3_vtab`
       = note: required because it appears within the type `vtab::series::SeriesTab`
       = note: required because it appears within the type `std::marker::PhantomData<vtab::series::SeriesTab>`
       = note: required because it appears within the type `vtab::Module<vtab::series::SeriesTab>`
       = note: required because of the requirements on the impl of `std::marker::Sync` for `spin::once::Once<vtab::Module<vtab::series::SeriesTab>>`
       = note: required because it appears within the type `lazy_static::lazy::Lazy<vtab::Module<vtab::series::SeriesTab>>`
       = note: shared static variables must have a type that implements `Sync`
       = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
    
    error: aborting due to 2 previous errors
    
    For more information about this error, try `rustc --explain E0277`.
    error: Could not compile `rusqlite`.
    
    To learn more, run the command again with --verbose.
    

    Seems to happen for both 0.19.0 and 0.18.0 Via this error report: https://github.com/phiresky/ripgrep-all/issues/22

    bug 
    opened by phiresky 15
  • Certain requests with empty strings produce

    Certain requests with empty strings produce "Illegal Instruction" errors in release mode

    The following program will produce a "Illegal Instruction" when run with cargo run --release under Linux (x64) (bug does not trigger in debug mode):

    extern crate rusqlite;
    
    fn main() {
        let conn = rusqlite::Connection::open_in_memory().unwrap();
        conn.execute("CREATE TABLE my_table (name TEXT)", &[]).unwrap();
    
        let query = "INSERT INTO my_table (name) VALUES ($1)";
        conn.execute(query, &[&"".to_string()]).unwrap();
    }
    

    Output:

    $ cargo run --release
       Compiling undef v0.1.0 (/home/user/undef)
        Finished release [optimized] target(s) in 0.54s
         Running `target/release/undef`
    Illegal instruction (core dumped)
    

    GDB backtrace:

    (gdb) run
    Starting program: /home/user/undef/target/release/undef 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    
    Program received signal SIGILL, Illegal instruction.
    0x00005555555601a0 in libsqlite3_sys::SQLITE_STATIC ()
    (gdb) bt
    #0  0x00005555555601a0 in libsqlite3_sys::SQLITE_STATIC ()
    #1  0x000055555555f25b in rusqlite::statement::Statement::bind_parameter ()
    #2  0x000055555555eeb6 in rusqlite::statement::Statement::bind_parameters::h7188e5d4b82166d7 ()
    #3  0x000055555555e248 in rusqlite::Connection::execute ()
    #4  0x000055555555dc2a in undef::main ()
    #5  0x000055555555d833 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
    #6  0x000055555555d809 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hb1d0b344861e9740 ()
    #7  0x00005555555713fa in core::ops::function::impls::{impl#2}::call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + std::panic::RefUnwindSafe)> ()
        at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259
    #8  std::panicking::try::do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + std::panic::RefUnwindSafe), i32> () at library/std/src/panicking.rs:401
    #9  std::panicking::try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + std::panic::RefUnwindSafe)> () at library/std/src/panicking.rs:365
    #10 std::panic::catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + std::panic::RefUnwindSafe), i32> () at library/std/src/panic.rs:434
    #11 std::rt::lang_start_internal::{closure#2} () at library/std/src/rt.rs:45
    #12 std::panicking::try::do_call<std::rt::lang_start_internal::{closure#2}, isize> () at library/std/src/panicking.rs:401
    #13 std::panicking::try<isize, std::rt::lang_start_internal::{closure#2}> () at library/std/src/panicking.rs:365
    #14 std::panic::catch_unwind<std::rt::lang_start_internal::{closure#2}, isize> () at library/std/src/panic.rs:434
    #15 std::rt::lang_start_internal () at library/std/src/rt.rs:45
    #16 0x000055555555ddc2 in main ()
    
    bug help wanted 
    opened by zgtm 13
  • Make `ToSqlOutput<'a>` implement `ToSql`

    Make `ToSqlOutput<'a>` implement `ToSql`

    I'd like to understand why ToSqlOutput<'a> does not implement ToSql.

    Over in https://github.com/mozilla/mentat, we're using rusqlite to implement a knowledge store on top of an embedded SQLite store. Part of what we're doing is implementing our own value encoding: our values are strictly richer than the set of SQLite values, and therefore we encode them as a pair (value_type_tag, sqlite_value) to write them to the database. (The type tag is a TINYINT.) I've worked out how to use rusqlite::Value to read a value with a dynamic type from the SQLite store, but I'm having trouble writing a SQL value with a dynamic type to SQLite store.

    I think my issue is specifically around minimizing copies, because I'm pretty sure I can make

    to_sql(value: &mentat::Value, value_type: mentat::ValueType) -> (rusqlite::Value, i32)
    

    work. What I want, however is to make

    to_sql<'a>(value: &'a mentat::Value, value_type: mentat::ValueType) -> (rusqlite::ToSqlOutput<'a>, i32)
    

    work, since that should let me avoid copying potentially large strings, blobs, etc. (By not work, I mean that I can't bind &'a rusqlite::ToSqlOutput<'a> as a parameter.) That is, I might sometimes produce a ValueRef::Borrowed(...) borrowing something internal to my mentat::Value, potentially avoiding copying. The obvious thing doesn't work, since ToSqlOutput<'a> doesn't implement ToSql. It's not trivial to implement either, since there needs to be some copying, but I might be able to figure out what is appropriate in my case.

    Is the missing implementation an oversight? Is there something I am fundamentally misunderstanding about this situation? Does it not make sense to do this in general, so that implementing a newtype sibling to ToSqlOutput<'a> but specialized to my situation is the way to proceed? Thanks!

    opened by ncalexan 13
  • Savepoints with same name

    Savepoints with same name

    Currently, all the created savepoints have the same name sp. See the following test case: https://github.com/gwenn/rusqlite/commit/7c5f74447a2a24e322ed0ab41989086ef5229a6e#diff-d0e9b1d1df1c5795eac22a324e40477eR265 for an example that unexpectedly fails: https://ci.appveyor.com/project/gwenn/rusqlite/build/1.0.64 It seems to me that savepoints must have distinct names. Regards.

    opened by gwenn 13
  • Add support for online backup API

    Add support for online backup API

    I'm new to this code so this may actually be a question in the form of an issue, but I'm interested in using sqlite in-memory, and then backing up to disk, presumably using the backup API. Would you consider supporting this API, if not already supported? (API search for "backup" didn't show anything.)

    opened by agrover 13
  • Unclear usage of

    Unclear usage of "time" in README example

    Minor thing - I copypasted the code from the README to begin playing with the library, and got an error

    error[E0432]: unresolved import `time`
     --> src/db.rs:2:5
      |
    2 | use time::Timespec;
      |     ^^^^ help: a similar path exists: `std::time`
    

    It took a tiny bit of poking around to work out it was a thirdparty requirement (mostly as searching for "rust time" is a bit messy)

    Not sure if the std::time could be used without cluttering up the example - but possibly just a comment on that line or similar would handy?

    use time::Timespec; # https://crates.io/crates/time
    
    opened by dbr 12
  • feature request: make possible to use chrono without Local

    feature request: make possible to use chrono without Local

    I only want to save and load from sqlite database DateTime<Utc> type, so I don't need this https://github.com/rusqlite/rusqlite/blob/5ea4c3b7d6343e98656cac578230f60e5983905f/src/types/chrono.rs#L98

    These 7 lines of code (without comments) cause one extra dependency iana-time-zone.

    So what about introduction one more feature, for example chorno-local to enable/disable usage of local time zones in chrono?

    enhancement 
    opened by Dushistov 4
  • rusqlite: without modern_sqlite, some tests fail

    rusqlite: without modern_sqlite, some tests fail

    I'm trying to automate the build process for a non-bundled version of the rusqlite crate (and its libsqlite3-sys dependency) for debian. Debian ships an independent copy of libsqlite, so bundling isn't necessary. Part of the debian packaging process encourages me to run tests with individual features selectively enabled or disabled.

    This shows that some of the tests seem to implicitly assume that they are being run with the modern_sqlite despite not being marked as such.

    For example, when i run the tests with just --features vtab, i see the following error:

    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/vtablog.rs:118:14
        |
    118 |         info.set_estimated_rows(500);
        |              ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    

    According to the comments in src/vtab/mod.rs, set_estimated_rows was introduced in 3.8.2, which was from December 2013, 8.5 years ago.

    Another similar mechanism that is hidden behind modern_sqlite is VTabConfig, introduced in sqlite 3.7.7, June 2011, over a decade ago.

    I see two distinct possible ways of fixing this kind of problem:

    • annotate each test that uses a part of the crate that depends on the modern_sqlite feature explicitly as such, so that the tests don't fail.
    • bring some of the older features (like VTabConfig and set_estimated_rows) out of the modern_sqlite feature and into the default, featureless crate. It seems very unlikely that anyone will build rusqlite in 2022 and beyond against a really ancient version of libsqlite3.

    Here is a full listing of all the errors that i've seen that are tickled by minimal featuresets without the modern_sqlite feature:

    error[E0432]: unresolved import `crate::vtab::VTabConfig`
      --> src/vtab/csvtab.rs:34:5
       |
    34 |     VTabConfig, VTabConnection, VTabCursor, VTabKind, Values,
       |     ^^^^^^^^^^ no `VTabConfig` in `vtab`
    
    error[E0432]: unresolved import `crate::vtab::VTabConfig`
      --> src/vtab/series.rs:13:73
       |
    13 |     eponymous_only_module, Context, IndexConstraintOp, IndexInfo, VTab, VTabConfig, VTabConnection,
       |                                                                         ^^^^^^^^^^ no `VTabConfig` in `vtab`
    
        --> src/context.rs:31:25
         |
    31   |             return ffi::sqlite3_result_pointer(
         |                         ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_result_int`
         |
        ::: /home/dkg/tmp/tmp.XdFIONcPD6/target/x86_64-unknown-linux-gnu/debug/build/libsqlite3-sys-8ccc2a5a3d8e41de/out/bindgen.rs:2407:5
         |
    2407 |     pub fn sqlite3_result_int(arg1: *mut sqlite3_context, arg2: ::std::os::raw::c_int);
         |     ----------------------------------------------------------------------------------- similarly named function `sqlite3_result_int` defined here
    
    error[E0425]: cannot find function `sqlite3_create_window_function` in crate `ffi`
        --> src/functions.rs:588:18
         |
    588  |               ffi::sqlite3_create_window_function(
         |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_create_function`
         |
        ::: /home/dkg/tmp/tmp.XdFIONcPD6/target/x86_64-unknown-linux-gnu/debug/build/libsqlite3-sys-8ccc2a5a3d8e41de/out/bindgen.rs:2188:5
         |
    2188 | /     pub fn sqlite3_create_function(
    2189 | |         db: *mut sqlite3,
    2190 | |         zFunctionName: *const ::std::os::raw::c_char,
    2191 | |         nArg: ::std::os::raw::c_int,
    ...    |
    2208 | |         xFinal: ::std::option::Option<unsafe extern "C" fn(arg1: *mut sqlite3_context)>,
    2209 | |     ) -> ::std::os::raw::c_int;
         | |_______________________________- similarly named function `sqlite3_create_function` defined here
    
    error[E0425]: cannot find function `sqlite3_bind_pointer` in crate `ffi`
        --> src/statement.rs:743:26
         |
    743  |                       ffi::sqlite3_bind_pointer(
         |                            ^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_bind_int`
         |
        ::: /home/dkg/tmp/tmp.XdFIONcPD6/target/x86_64-unknown-linux-gnu/debug/build/libsqlite3-sys-8ccc2a5a3d8e41de/out/bindgen.rs:1969:5
         |
    1969 | /     pub fn sqlite3_bind_int(
    1970 | |         arg1: *mut sqlite3_stmt,
    1971 | |         arg2: ::std::os::raw::c_int,
    1972 | |         arg3: ::std::os::raw::c_int,
    1973 | |     ) -> ::std::os::raw::c_int;
         | |_______________________________- similarly named function `sqlite3_bind_int` defined here
    
    error[E0425]: cannot find function `sqlite3_value_pointer` in crate `ffi`
        --> src/vtab/mod.rs:764:33
         |
    764  |         let ptr = unsafe { ffi::sqlite3_value_pointer(arg, array::ARRAY_TYPE) };
         |                                 ^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_value_int`
         |
        ::: /home/dkg/tmp/tmp.XdFIONcPD6/target/x86_64-unknown-linux-gnu/debug/build/libsqlite3-sys-8ccc2a5a3d8e41de/out/bindgen.rs:2304:5
         |
    2304 |     pub fn sqlite3_value_int(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int;
         |     ---------------------------------------------------------------------------- similarly named function `sqlite3_value_int` defined here
    
    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/array.rs:110:18
        |
    110 |             info.set_estimated_rows(100);
        |                  ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    
    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/array.rs:114:18
        |
    114 |             info.set_estimated_rows(2_147_483_647);
        |                  ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    
    error[E0599]: no method named `config` found for mutable reference `&mut VTabConnection` in the current scope
       --> src/vtab/csvtab.rs:239:12
        |
    239 |         db.config(VTabConfig::DirectOnly)?;
        |            ^^^^^^ method not found in `&mut VTabConnection`
    
    error[E0599]: no method named `config` found for mutable reference `&mut VTabConnection` in the current scope
      --> src/vtab/series.rs:67:12
       |
    67 |         db.config(VTabConfig::Innocuous)?;
       |            ^^^^^^ method not found in `&mut VTabConnection`
    
    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/series.rs:125:18
        |
    125 |             info.set_estimated_rows(1000);
        |                  ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    
    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/series.rs:150:18
        |
    150 |             info.set_estimated_rows(2_147_483_647);
        |                  ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    error[E0599]: no method named `set_estimated_rows` found for mutable reference `&mut IndexInfo` in the current scope
       --> src/vtab/vtablog.rs:118:14
        |
    118 |         info.set_estimated_rows(500);
        |              ^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `set_estimated_cost`
    

    I could offer a patch to move at least set_estimated_rows and VTabConfig outside of modern_sqlite, and annotate the other tests appropriately (with #[cfg(feature = "modern_sqlite")]) as needed, if that seems like a reasonable approach.

    opened by dkg 2
  • Revert part of

    Revert part of "Drop bindgen layout tests"

    This reverts parts of commit 53b1b598cb5ca63befa043a05905b681e8890dc7.

    @thomcc observed that more was cut out from the shipped bindgen_bundled_version.rs than should have been.

    I've reverted the change to re-generated code (which it looks like i did not regenerate as expected), and instead manually trimmed out all the test_layout functions marked as #![test].

    Note that {sqlite3,sqlcipher}/bindgen_bundled_version.rs both have comments claiming automated generation, but now they are in fact a mixture of automatic generation and manual tuning.

    opened by dkg 2
  • Drop test_layout bindgen tests from stored versions

    Drop test_layout bindgen tests from stored versions

    Note that this was done manually by cutting out all #[test] functions named test_layout, rather than the automated re-generation step that produced 53b1b598cb5ca63befa043a05905b681e8890dc7.

    Closes: #722

    opened by dkg 2
  • Feature request: libsqlite-sys built-in sqlite math functions

    Feature request: libsqlite-sys built-in sqlite math functions

    The latest versions of SQLite come with basic math functions included by default. For instance, if you compile a sqlite3 binary manually, on Linux you have access to functions like exp and ln, which provide the only built-in mechanism for calculating a cumulative product.

    Here are steps for how to currently include math functions when building a rusqlite project:

    wget https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
    tar -xvf sqlite-autoconf-3390200.tar.gz
    cd sqlite-autoconf-3390200
    mkdir build && cd build
    ../configure # If you want static SQLite only, add --enable-shared=no
    make -j6 && su -c "make install"
    
    # necessary for rusqlite to detect your compiled libraries
    export LD_LIBRARY_PATH="/path/to/sqlite/shared/libs:$LD_LIBRARY_PATH"
    

    Then set the documented env var in cargo.toml:

    [env] SQLITE3_LIB_DIR = "/path/to/sqlite/shared/libs"

    It would be great if the above steps were automatically performed with a bundled build of rusqlite, since by default these math functions should be included in 3.39.2 version of SQLite. Unless they are intentionally removed (for smaller disk footprint?)?

    Thanks for considering this enhancement!

    opened by evbo 6
Releases(sys0.25.1)
  • sys0.25.1(Jul 22, 2022)

  • v0.28.0(Jul 14, 2022)

    What's Changed

    • Update bundled SQLcipher to v4.5.1 (equivalent to SQLite 3.37.2) #1131
    • Implement Params for tuples, improve documentation some. #1133
    • Force use of buildtime_bindgen under winsqlite3 for now #1135
    • Add some missing wrappers #1139
    • Upgrade SQLite bundled version to 3.39.0 #1200
    • Disable winsqlite3 on 32 bit targets #1151
    • Fix non-bundled tests against macOS system SQLite #1153
    • Expose sqlite3_changes (or sqlite3_changes64 if available) #1152
    • Improve the docs for opening the connection a bit #1155
    • Small doc grammar fix #1156
    • Add support to updatable virtual tables #1141
    • Add Error methods to get SQLite error values by #1158
    • Add Connection::release_memory method #1164
    • derive Eq for Type #1165
    • Upgrade uuid dependency #1167
    • Params for 28-length arrays #1169
    • Introduce SqlInputError with offset #1137
    • Derive Debug for Savepoint #1179
    • document winsqlite3 #1109
    • Fix typo in libsqlite flags variable #1115
    • Upgrade bindgen to version 0.60 #1196

    Full Changelog: https://github.com/rusqlite/rusqlite/compare/v0.27.0...v0.28.0

    Source code(tar.gz)
    Source code(zip)
  • sys0.24.1(Mar 5, 2022)

    This release contains an update to the bundled version of SQLcipher, and no other changes. The update moves it to SQLcipher v4.5.1, which is equivalent to SQLite 3.37.2. (The version of SQLcipher bundled previously was v4.5.0, equivalent to SQLite 3.36.0)

    Note that this is still a version behind the copy of "plain" SQLite we pull in under features = ["bundled"], which is SQLite 3.38.0.

    There is no corresponding rusqlite release, as this will trickle out out over time, and Rusqlite itself does not care about the version change. That said, if you use rusqlite, and absolutely must ensure you have this change, it should be sufficient to run cargo update in the rusqlite-using workspace, which will update the version in your Cargo.lock file. You may instead add a direct dependency on libsqlite3-sys = "0.24.1" to your Cargo.toml, in case relying on Cargo.lock for this is undesirable.

    Source code(tar.gz)
    Source code(zip)
  • v0.27.0(Feb 27, 2022)

    What's Changed

    • Fix documentation typo for rollback_hook #1051
    • Remove lazy_static dependency for vtab #1063
    • Sync series with official source by #1064
    • Enable modern-full feature for docs.rs #1066
    • Fix markdown rendering of Connection::transaction doc #1067
    • Add ToSql/FromSql for [u8; N] #1069
    • Upgrade bundled SQLCipher to 4.5.0 #1073
    • Clean up unlock_notify code a bit #1077
    • Use caching in our CI #1078
    • Enable buildtime_bindgen tests on windows CI #1090
    • Replace Gitter with Discord #1079, #1091
    • Use stable rust for doc checking in CI #1092
    • Exclude some configuration files from package #1093
    • Remove the SQLite version check #1094
    • Move Limits enum from libsqlite3-sys into rusqlite #1096
    • Uncomment config::DbConfig::SQLITE_DBCONFIG_RESET_DATABASE #1113
    • Upgrade SQLite bundled version to 3.38.0 #1124, #1127

    Full Changelog: https://github.com/rusqlite/rusqlite/compare/v0.26.3...v0.27.0

    Source code(tar.gz)
    Source code(zip)
  • sys0.9.4(Jan 4, 2022)

  • v0.26.0(Oct 4, 2021)

    Nice to have: make possible to remove authorizer hook

    • Add bundle-sqlcipher and bundle-ssl #860
    • Breaking changes: Add support for authorizer hook #946 / #975 Action is not visible from root anymore
    • Add a function to return the path of a Connection #963 / #962
    • Add a helper function for getting the byte data from a ValueRef, regardless of if its Text or Blob #983
    • Make the empty placeholder params be Send + Sync #1005
    • Use a generic ToSql param in pragma functions #1009
    • Breaking changes: Implement AsRef<Statement> for Row(s) #887 Rows::column* and Row::column* removed now that you have access to underlying statement.
    • Fix FromSql impl for OffsetDateTime #970
      • Upgrade time crate to version 0.3.0
    • Bump bundled sqlite3 version to 3.36.0 #979
    • Allow static linking against the VC runtime #1021
    • Breaking changes: Make load_extension unsafe #1016
    • Add as_type_or_null to ValueRef #1012
    • Correct pkg-config version #960
    • Improve VTab API: Iterate on both index constraint and usage #1001 / #1006
    • Access to sqlite3_db_cacheflush via Connection #984 / #985
    • Retrieve error message from database connection handle #988
    • Include the session FFI in the bundled bindings #982
    • Use #[doc(cfg)] instead of manually indicating feature = "blah" in the comments #835 / #973
    • Use env::var instead of cfg in some cases in build.rs #961
    • Add time back to modern-full feature #969
    • Fix InnerConnection decode_result / changes #974 / #931
    • Upgrage bindgen to version 0.59 #994
    Source code(tar.gz)
    Source code(zip)
  • v0.25.3(May 9, 2021)

  • v0.25.2(May 9, 2021)

    Note: rusqlite v0.25.2 has been yanked because it accidentally enabled bundled-full as a default feature. v0.25.3 has been cut that is equivalent but without that change. The libsqlite3-sys release that happened at the same time is still fine.

    This release is a patch release that enables builds on some older versions of Rust. Rusqlite does not commit to a particular MSRV, but this release is known to work at least back to Rust 1.41.0.

    It is likely that the next release will require a newer version of Rust, whether or not it is mentioned in the release notes.

    Source code(tar.gz)
    Source code(zip)
  • v0.25.1(Apr 19, 2021)

  • v0.25.0(Apr 3, 2021)

    • BREAKING CHANGE: Overhaul parameter API #830 / #609
    • Add ToSql implementations for u64 and usize #826 / #821
    • Implement FromSql for u64, usize and f32, and ToSql for f32 #823 / #822 / #821
    • Reduce required lifetime in create_scalar_function #825
    • Expose query progress information and introduce Batch iterator #824 / #803
    • Add #[inline] and #[cold] in far more places #834
    • Fix create_collation #839
    • Remove #[non_exhaustive] attribute on IndexConstraintOp #840 / #783
    • Document that optional() requires import of trait rusqlite::OptionalExtension #842
    • Update time to appease deps.rs #849
    • Upgrade to bindgen 0.57
    • Improve busy handler documentation #854
    • Upgrade SQLite bundled version to 3.35.4
    • Expands/cleans up documentation. Also renames (and documents) the so-far-undocumented LIBSQLITE3_FLAGS. #861
    • Add get_connection method to function context #867
    • Fix smallvec version #896
    • BREAKING CHANGE: Pass context to aggregate init and finalize #866
    • BREAKING CHANGE: Rename get_raw to get_ref_unwrap and get_raw_checked to get_ref #838
    • BREAKING CHANGE: Fix DateTime format #886 / #885 + Leniently parse rfc3339 timezones #928
    Source code(tar.gz)
    Source code(zip)
  • v0.24.2(Dec 5, 2020)

    v0.24.2 is identical to v0.24.1 except it allows building with an older version of smallvec, as the newer one caused meaningful performance issues in Firefox.

    See https://github.com/rusqlite/rusqlite/pull/855 for more info.

    Source code(tar.gz)
    Source code(zip)
  • v0.24.1(Oct 7, 2020)

    • The lru-cache crate has been replaced with hashlink, which may fix panics on Rust nightly caused by unsoundness in some versions of the lru-cache crate (#811).

    • A positional BLOB I/O API has been added, which more closely mirrors SQLites actual BLOB I/O api, and is similar to unix-style pwrite/pread. (#780).

    • A winsqlite3 feature as been added to both rusqlite and libsqlite3-sys which allows linking against the SQLite present in newer versions of Windows 10 (#796).

    • Rusqlite's iterator types are now #[must_use] (#799).

    • Several dependencies have been updated.

    Source code(tar.gz)
    Source code(zip)
  • 0.24.0(Aug 22, 2020)

    • BREAKING CHANGE: Upgrade to time v0.2 and put it behind a feature flag (#653)
    • impl TryFrom<&Row<'_>> for (...) This change implements TryFrom<&Row> for tuples up to 16 fields. This is a convenience function that can be used to map rows more easily.
    • adding ability to work with sqlite compiled with SQLITE_OMIT_DECLTYPE (feature column_decltype)
    • LIBSQLITE3_FLAGS hook Enables compiling bundled sources with different flags.
    • Add cross-compilation with mingw (#774)
    • Support wasm32-wasi target (#785)
    • Implement our own sqlite3_execwhich supports unlock notify (#767)
    • Fix order of parameters in InvalidParameterCount message (#779)
    • Don't implement Into for Statement (#763)
    • Publically expose Map
    • little speedup for bundled sqlite3.c on unix (HAVE_LOCALTIME_R)
    • BREAKING CHANGE: VTabCursor lifetime should be bound to VTab lifetime (#753)
    • preupdate_hook feature requires buildtime_bindgen
    • Upgrade SQLite bundled sources to 3.33.0
    • Upgrade to bindgen 0.54
    • Fix missing docs
    • Add link to gitter channel (#738)
    • Include LICENSE into the libsqlite3-sys crate (#736)
    Source code(tar.gz)
    Source code(zip)
  • 0.23.1(Apr 23, 2020)

  • 0.23.0(Apr 23, 2020)

    The release primarily contains a number of security/memory safety fixes, which were mostly found due to an audit of the unsafe code in the crate. An advisory will be published for these shortly.

    They mostly impact APIs exposed through features, so while there are a lot of them, if you're using rusqlite under default features, you're fine. None of them impact libsqlite3-sys.

    It's a major release as these APIs were fundamentally unsound and could not be fixed without breaking changes.

    • Make VTab / VTabCursor unsafe trait as implementing them on the wrong type is unsound https://github.com/rusqlite/rusqlite/commit/c9ef5bd63cad5c0c123344c072b490a1a9bcbe1f. (Note that a safe VTab API is planned in the future).
    • Make create_module take a &'static Module as that's what the reference was treated as. https://github.com/rusqlite/rusqlite/commit/3c6b57fe1b2cc87e7ebecde43dd836ffb1c4ea5c
    • Make UnlockNotification hold the Mutex while notifying the CondVar. Also, ensure &mut is not used to reference a value shared across another thread. https://github.com/rusqlite/rusqlite/commit/45fd77ee43c38eea4d6f4e2e56c1667a55ec654f
    • Fix potential format string vuln in rusqlite::trace::log https://github.com/rusqlite/rusqlite/commit/2327d3b774927fdf48903c0bdc1ca7ec93c7c8d0
    • Auxdata API has been changed and has new bounds.
      • Fix potential use-after-free and data race in auxdata api https://github.com/rusqlite/rusqlite/commit/2ef3628dac35aeba0a97d5fb3a57746b4e1d62b3
      • Fix repr(Rust) type being used as if it were repr(C) https://github.com/rusqlite/rusqlite/commit/71b2f5187b0cbace3f8b6ff53432ff2ca0defcf0
    • Fix use-after-free in sessions.rs in https://github.com/rusqlite/rusqlite/commit/ac30e169ae51b262bc8cf7026469851ce39b23c6

    Non-safety changes in this release:

    • Bundled SQLite has been updated to 3.31.1 https://github.com/rusqlite/rusqlite/commit/22564d3099f7fab835347edf8b5d3eda1364014b
    • Non-unicode paths are now handled properly, at least on unix https://github.com/rusqlite/rusqlite/pull/692
    • Functions using va_list are excluded from the bundled bindings, as these are platform specific. You can still use them if you enable the buildtime_bindgen feature. https://github.com/rusqlite/rusqlite/commit/288aa961a75ac29f704bfe2f9794148e0a197e10
    • An unchecked_transaction function has been added which allows opting-out of compile time transaction checking. Despite it's name, it's still checked, it just downgrades a compilation error to a runtime one: https://github.com/rusqlite/rusqlite/pull/693
    • std::error::Error::source is implemented in favor of std::error::Error::cause for all error types.
    Source code(tar.gz)
    Source code(zip)
  • 0.22.0(Apr 8, 2020)

    • Add ability to open sqlite connection with specified vfs (#630)
    • Fix i32 overflow in Connection::busy_timeout (#604)
    • Separate the modern_sqlite and bundled features. (#613)
    • Add FromSql for Box<str>, Rc<str> and Arc<str>
    • Fix params macro (#614)
    • Fix error while executing ALTER statement (#645)
    • Ignore PATH change (#435)
    • Add playground metadata for rusqlite, hopefully fixing it (#647)
    • Don't perform threading mode checks on wasm32 (#640)
    • Upgraded the bundled SQLite version to 3.31.0. (#619)
    • Add support to function flags (#622)
    • Add missing IndexConstraintOp entries (#623)
    • Add missing error codes (#624)
    • Add missing constants (#629)
    • Introduce alloc to generate C string allocated by sqlite3 (#644)
    • rusqlite now exposes the bundled-windows feature, forwarding to libsqlite3-sys. (#682)
    • rusqlite::Result<T> is now defined as type Result<T, E = rusqlite::Error>. This avoids needing to access std::result::Result explicitly when rusqlite::Result is brought into scope. (#678)
    • Rows now support mapped and and_then functions which return Iterators. This is useful if you cannot use query_map or query_and_then for some reason. (#676)
    • A new error variant was added for using the wrong number of bound parameters. Previously this caused a panic (#675).
    • Many rusqlite enums have been made #[non_exhaustive] for better extensibility. (#673)
    • Various low-level Statement apis have been added to allow separating parameter binding and statement execution. (#668)
    • ToSql is implemented for various smart pointers (Box, Cow, Rc, Arc) in more cases. (#660)
    • bundled-full feature now exists to enable both bundled and other features which do not conflict. It is mainly intended to improve developer ergonomics for working on rusqlite (#687)
    • The features vtab_v3 and unstable are removed. The former is no longer necessary and the latter was only used for #[bench]. (#687)
    • rusqlite::Error now implements std::error::Error::source instead of only std::error::Error::cause. Use of cause will still work, as it goes through source by default. (#683)
    Source code(tar.gz)
    Source code(zip)
  • 0.21.0(Dec 13, 2019)

    • Fix memory leak when using Statement.expanded_sql (#552)
    • Fix segfault on prepare_cached with an empty query (#583)
    • Handle old versions of visual studio (#554)
    • Conversion from FromSqlError to Error (#556)
    • Parse Option<T> into Value/ValueRef where applicable (#571)
    • Make column_name() public and forward all column methods in Row and Rows (#568)
    • Check SQL query passed to execute (#565)
    • Check that only one statement is provided when extra_check feature is activated (#397)
    • Improve error message when we can't open a database (#578)
    • Upgrade bundled SQLite version to 3.30.1 (#579)
    • Replace deprecated tempdir with tempfile (#594)
    • Download sqlite source via HTTPS (#599)
    • Fix session extension (#588)
    • Upgrade to uuid 0.8 (#576)
    • Disable vcpkg in appveyor build (#580)
    Source code(tar.gz)
    Source code(zip)
  • 0.20.0(Jul 27, 2019)

    • BREAKING CHANGE: Do not assume sqlite3_column_text is valid UTF-8. (#548)
    • Make Module impl Send (#543)
    • Upgrade bundled SQLite version to 3.29
    • Upgrade bindgen to 0.51
    Source code(tar.gz)
    Source code(zip)
  • 0.19.0(Jun 26, 2019)

    • Increase bundled SQLite variables and depth (#522)
    • Fix error when building with uuid and functions features. (#515)
    • Upgrade bundled SQLite sources to 3.28.0 (#513)
    • Fix nightly build (#514)
    • Add query_row_named for prepared statement (#528)
    • Add binding to sqlite3_create_collation_v2 (#534)
    • Add bundled-windows feature (#537)
    • Add binding to sqlite3_create_window_function (#539)
    • Include the name of the column in InvalidColumnType errors (#541)
    Source code(tar.gz)
    Source code(zip)
  • 0.18.0(Apr 24, 2019)

    • Add support for Uuid (#506)
    • impl ToSql for Box<dyn ToSql> (#500)
    • Allow specifying both sqlcipher and bundled (#511)
    • Introduce Statement::columns (#494)
    • Rebuild when VCPKGRS_DYNAMIC changes (#483)
    • Upgrade to fallible-iterator 0.2
    Source code(tar.gz)
    Source code(zip)
  • 0.17.0(Mar 10, 2019)

    • BREAKING CHANGE: Cannot insert heterogeneous elements with .execute #462 Add params/named_params macro, and expose ToSql from top level #471
    • BREAKING CHANGE: Do not panic by default #485 Replace Row::get by Row::get_checked, And rename original Row::get to Row::get_unwrap. Stmt::query_map, Stmt::query_map_named, Stmt::query_row, Conn::query_row and Conn::query_row_named callback parameter must return a Result.
    • BREAKING CHANGE: Make Rows implement FallibleStreamingIterator #478 Rows::next returns Result<Option<&Row<'_>>> instead of Option<Result<Row<...>>>.
    • Avoid unnecessary copies/allocations when passing strings to sqlite #487
    • Ease PRAGMA usage (#273 and #265) #476
    • Add optional support for rust-url #491
    • Impl PartialEq for Error #416
    • Make get_aux safe by storing the TypeId with the data.
    • Introduce Connection::from_handle #453
    • Support for sqlite3_db_config #468
    • Make the libsqlite3_sys as ffi export pub #469
    • Derive Debug for Transaction #470
    • Upgrade bundled version to SQLite 3.27.2
    • BREAKING CHANGE: Session extension
    • Restore old bindgen for Diesel
    • Upgrade to bindgen 0.48
    Source code(tar.gz)
    Source code(zip)
  • 0.16.0(Dec 16, 2018)

    • Update README example.
    • Allow build time bindgen of bundled SQLite
    • Fix Timespec FromSql implementations (#431)
    • Add support for forcing cargo:rustc-link-lib to link as native
    • BREAKING CHANGE: Callbacks must not be able to unwind into sqlite code
    • Introduce OptionalExtension
    • Upgrade bundled version to SQLite 3.26.0
    • BREAKING CHANGE: remove deprecated stuff
    • Fix compilation error with functions and i128 features
    • Fix test_interrupt #415
    • Rust 2018
    • Upgrade to bindgen 0.45
    Source code(tar.gz)
    Source code(zip)
  • 0.15.0(Oct 21, 2018)

    • Allow getting a ValueRef out of Row and Context, fixes #259
    • Remove version check when bundled
    • Add a feature for storing i128 as blobs.
    • Add a method of interrupting a query executing on a separate thread, fixes #407
    • BREAKING CHANGE: Take IntoIterator rather than &[&ToSql] (#312)
    • Impossible to execute a pragma in 0.14.0 #400
    • BREAKING CHANGE: Remove old bindgens
    • array feature should not require bundled #384
    • Upgrade SQLite bundled sources to 3.25.2
    • Upgrade to bindgen 0.42
    Source code(tar.gz)
    Source code(zip)
  • 0.14.0(Aug 17, 2018)

    • BREAKING CHANGE: ToSql implementation for time::Timespec uses RFC 3339 (%Y-%m-%dT%H:%M:%S.%fZ). Previous format was %Y-%m-%d %H:%M:%S:%f %Z.
    • BREAKING CHANGE: Remove potentially conflicting impl of ToSqlOutput (#313).
    • BREAKING CHANGE: Replace column index/count type (i32) with usize.
    • BREAKING CHANGE: Replace parameter index/count type (i32) with usize.
    • BREAKING CHANGE: Replace row changes/count type (i32) with usize.
    • BREAKING CHANGE: Scalar functions must be Sendable and 'static.
    • Bugfix: Commit failure unhandled, database left in unusable state (#366).
    • Bugfix: free_boxed_hook does not work for fn.
    • Update the bundled SQLite version to 3.24.0 (#326).
    • Add DropBehavior::Panic to enforce intentional commit or rollback.
    • Implement sqlite3_update_hook (#260, #328), sqlite3_commit_hook and sqlite3_rollback_hook.
    • Add support to unlock notification behind unlock_notify feature (#294, #331).
    • Make Statement::column_index case insensitive (#330).
    • Add comment to justify &mut Connection in Transaction.
    • Fix tyvar_behind_raw_pointer warnings.
    • Fix handful of clippy warnings.
    • Fix Connection::open documentation (#332)
    • Add binding to sqlite3_get_autocommit and sqlite3_stmt_busy.
    • Add binding to sqlite3_busy_timeout and sqlite3_busy_handler.
    • Add binding to sqlite3_expanded_sql.
    • Use rerun-if-env-changed in libsqlite3-sys (#329).
    • Return an InvalidQuery error when SQL is not read only.
    Source code(tar.gz)
    Source code(zip)
  • 0.13.0(Nov 13, 2017)

    • Added ToSqlConversionFailure case to Error enum.
    • Now depends on chrono 0.4, bitflats 1.0, and (optionally) cc 1.0 / bindgen 0.31.
    • The ToSql/FromSql implementations for time::Timespec now include and expect fractional seconds and timezone in the serialized string.
    • The RowIndex type used in Row::get is now publicly exported.
    • New sqlcipher feature allows linking against SQLCipher instead of SQLite.
    • Doc link in README now point to docs.rs.
    Source code(tar.gz)
    Source code(zip)
  • 0.12.0(May 29, 2017)

    • Defines HAVE_USLEEP when building with a bundled SQLite (#263).
    • Updates dependencies to their latest versions, particularly serde to 1.0.
    • Adds support for vcpkg on Windows.
    • Adds ToSql impls for str and [u8].
    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(May 29, 2017)

    • Avoid publicly exporting SQLite constants multiple times from libsqlite3-sys.
    • Adds FromSql and ToSql impls for isize. Documents why usize and u64 are not included.
    Source code(tar.gz)
    Source code(zip)
  • 0.10.2(Apr 5, 2017)

    • Avoid publicly exporting SQLite constants multiple times from libsqlite3-sys.
    • Adds FromSql and ToSql impls for isize. Documents why usize and u64 are not included.
    Source code(tar.gz)
    Source code(zip)
  • 0.10.1(Mar 3, 2017)

    • Updates the bundled SQLite version to 3.17.0.
    • Changes the build process to no longer require bindgen. This should improve build times and no longer require a new-ish Clang. See the README for more details.
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Feb 28, 2017)

    Changes:

    • Re-export the ErrorCode enum from libsqlite3-sys.
    • Adds version() and version_number() functions for querying the version of SQLite in use.
    • Adds the limits feature, exposing limit() and set_limit() methods on Connection.
    • Updates to libsqlite3-sys 0.7.0, which runs rust-bindgen at build-time instead of assuming the precense of all expected SQLite constants and functions.
    • Clarifies supported SQLite versions. Running with SQLite older than 3.6.8 now panics, and some features will not compile unless a sufficiently-recent SQLite version is used. See the README for requirements of particular features.
    • When running with SQLite 3.6.x, rusqlite attempts to perform SQLite initialization. If it fails, rusqlite will panic since it cannot ensure the threading mode for SQLite. This check can by skipped by calling the unsafe function rusqlite::bypass_sqlite_initialization(). This is technically a breaking change but is unlikely to affect anyone in practice, since prior to this version the check that rusqlite was using would cause a segfault if linked against a SQLite older than 3.7.0.
    • rusqlite now performs a one-time check (prior to the first connection attempt) that the runtime SQLite version is at least as new as the SQLite version found at buildtime. This check can by skipped by calling the unsafe function rusqlite::bypass_sqlite_version_check().
    • Removes the libc dependency in favor of using std::os::raw
    Source code(tar.gz)
    Source code(zip)
Owner
Rusqlite
Ergonomic Rust wrapper for SQLite
Rusqlite
duckdb-rs is an ergonomic wrapper for using duckdb from Rust.

duckdb-rs duckdb-rs is an ergonomic wrapper for using duckdb from Rust. It attempts to expose an interface similar to rusqlite. Acctually the initial

Wang Fenjin 93 Sep 27, 2022
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 6.9k Sep 30, 2022
SQLite clone from scratch in Rust

Rust-SQLite (SQLRite) Rust-SQLite, aka SQLRite , is a simple embedded database modeled off SQLite, but developed with Rust. The goal is get a better u

João Henrique Machado Silva 909 Sep 21, 2022
Provides a Rust-based SQLite extension for using Hypercore as the VFS for your databases.

SQLite and Hypercore A Rust library providing SQLite with an virtual file system to enable Hypercore as a means of storage. Contributing The primary r

Jacky Alciné 15 Jul 4, 2022
ChiselStore is an embeddable, distributed SQLite for Rust, powered by Little Raft.

ChiselStore ChiselStore is an embeddable, distributed SQLite for Rust, powered by Little Raft. SQLite is a fast and compact relational database manage

null 476 Sep 13, 2022
cogo rust coroutine database driver (Mysql,Postgres,Sqlite)

cdbc Coroutine Database driver Connectivity.based on cogo High concurrency,based on coroutine No Future<'q,Output=*>,No async fn, No .await , no Poll*

co-rs 9 Jun 21, 2022
Build SQLite virtual file systems (VFS) by implementing a simple Rust trait.

sqlite-vfs Build SQLite virtual file systems (VFS) by implementing a simple Rust trait. Documentation | Example This library is build for my own use-c

Markus Ast 52 Sep 6, 2022
Simple and handy btrfs snapshoting tool. Supports unattended snapshots, tracking, restoring, automatic cleanup and more. Backed with SQLite.

Description Simple and handy btrfs snapshoting tool. Supports unattended snapshots, tracking, restoring, automatic cleanup and more. Backed with SQLit

Eduard Tolosa 27 Jul 12, 2022
Some bunch of test scripts to generate a SQLite DB with 1B rows in fastest possible way

To find out the fastest way to create an SQLite DB with 1B random rows.

null 294 Sep 17, 2022
🐸Slippi DB ingests Slippi replays and puts the data into a SQLite database for easier parsing.

The primary goal of this project is to make it easier to analyze large amounts of Slippi data. Its end goal is to create something similar to Ballchasing.com but for Melee.

Max Timkovich 18 Jun 12, 2022
A tool for automated migrations for PostgreSQL, SQLite and MySQL.

Models Models is an implementation for a SQL migration management tool. It supports PostgreSQL, MySQL, and SQLite. Quick Start install the CLI by runn

null 44 Aug 26, 2022
Interface to SQLite

SQLite The package provides an interface to SQLite. Example Open a connection, create a table, and insert some rows: let connection = sqlite::open(":m

Stainless Steel 115 Sep 17, 2022
SQLite compiled to WASM with pluggable data storage

wasm-sqlite SQLite compiled to WASM with pluggable data storage. Useful to save SQLite in e.g. Cloudflare Durable Objects (example: https://github.com

Markus Ast 30 Aug 28, 2022
Persist EWW histories into SQLite

EWW History Extension Persist EWW histories into SQLite. Besides EWW, packages below are also supported: elfeed Welcome to open an issue if you have a

null 4 Sep 5, 2022
webmention-receiver - a simple program that receives webmentions, records them to a SQLite database

webmention-receiver is a simple program that receives webmentions, records them to a SQLite database, and allows viewing them via a webpage or RSS feed. It has no conception of an "account", and by default will accept webmentions for any domain. It is possible to configure it to only accept webmentions for a specific set of domains, if you'd prefer.

Wesley Aptekar-Cassels 11 Sep 3, 2022
Grsql is a great tool to allow you set up your remote sqlite database as service and CRUD(create/read/update/delete) it using gRPC.

Grsql is a great tool to allow you set up your remote sqlite database as service and CRUD (create/ read/ update/ delete) it using gRPC. Why Create Thi

Bruce Yuan 32 Jul 20, 2022
XLite - query Excel (.xlsx, .xls) and Open Document spreadsheets (.ods) as SQLite virtual tables

XLite - query Excel (.xlsx, .xls) and Open Document spreadsheets (.ods) as SQLite virtual tables XLite is a SQLite extension written in Rust. The main

Sergey Khabibullin 1.1k Sep 21, 2022
Rust bindings for LMDB

lmdb-rs Rust bindings for LMDB Documentation (master branch) Building LMDB is bundled as submodule so update submodules first: git submodule update --

Valerii Hiora 103 Jun 27, 2022
SQLite3 Bindings for Rust

SQLite3 Bindings for Rust To compile use rustc src/sqlite3.rs or if you have Cargo installed cargo build. The interface is currently evolving both alo

null 74 Aug 6, 2022