rusqlite icon indicating copy to clipboard operation
rusqlite copied to clipboard

Adding feature `array` seems to cause a compile failure

Open dhuseby opened this issue 1 year ago • 1 comments

I just added the array feature by running cargo add rusqlite --features array and my next compile gave me the following errors:

error[E0425]: cannot find function `sqlite3_result_pointer` in crate `ffi`
    --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rusqlite-0.31.0/src/context.rs:40:25
     |
40   |             return ffi::sqlite3_result_pointer(
     |                         ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_result_int`
     |
    ::: /home/user/Projects/gh/target/debug/build/libsqlite3-sys-563cd67ee158db71/out/bindgen.rs:1509:5
     |
1509 |     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_bind_pointer` in crate `ffi`
    --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rusqlite-0.31.0/src/statement.rs:619:26
     |
619  |                       ffi::sqlite3_bind_pointer(
     |                            ^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_bind_int`
     |
    ::: /home/user/Projects/gh/target/debug/build/libsqlite3-sys-563cd67ee158db71/out/bindgen.rs:1071:5
     |
1071 | /     pub fn sqlite3_bind_int(
1072 | |         arg1: *mut sqlite3_stmt,
1073 | |         arg2: ::std::os::raw::c_int,
1074 | |         arg3: ::std::os::raw::c_int,
1075 | |     ) -> ::std::os::raw::c_int;
     | |______________________________- similarly named function `sqlite3_bind_int` defined here

error[E0425]: cannot find function `sqlite3_value_pointer` in crate `ffi`
    --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rusqlite-0.31.0/src/vtab/mod.rs:758:33
     |
758  |         let ptr = unsafe { ffi::sqlite3_value_pointer(arg, array::ARRAY_TYPE) };
     |                                 ^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `sqlite3_value_int`
     |
    ::: /home/user/Projects/gh/target/debug/build/libsqlite3-sys-563cd67ee158db71/out/bindgen.rs:1406:5
     |
1406 |     pub fn sqlite3_value_int(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int;
     |     --------------------------------------------------------------------------- similarly named function `sqlite3_value_int` defined here

my current Cargo.toml contains the following dependency line:

rusqlite = { version = "0.31.0", features = ["array"] }

Cheers! 🍻

dhuseby avatar May 22 '24 16:05 dhuseby

By default, rusqlite uses SQLite 3.14 API. But sqlite3_result_pointer is only defined after 3.20 (https://sqlite.org/bindptr.html):

Three new "_pointer()" interfaces were added to SQLite 3.20.0 (2017-08-01)

So you need to add either bundled or buildtime_bindgen feature.

gwenn avatar May 22 '24 16:05 gwenn