mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-29 21:52:12 +08:00
commit
9484f5c15e
@ -45,4 +45,4 @@ script:
|
||||
- cargo test --features "backup blob chrono collation csvtab functions hooks limits load_extension serde_json trace url uuid vtab"
|
||||
- cargo test --features "backup blob chrono collation csvtab functions hooks limits load_extension serde_json trace url uuid vtab buildtime_bindgen"
|
||||
- cargo test --features "backup blob chrono collation csvtab functions hooks limits load_extension serde_json trace url uuid vtab bundled"
|
||||
- cargo test --features "backup blob chrono collation csvtab functions hooks limits load_extension serde_json trace url uuid vtab bundled buildtime_bindgen"
|
||||
- cargo test --features "backup blob chrono collation csvtab functions hooks limits load_extension session serde_json trace url uuid vtab bundled buildtime_bindgen"
|
||||
|
@ -48,7 +48,7 @@ csvtab = ["csv", "vtab"]
|
||||
# pointer passing interfaces: 3.20.0
|
||||
array = ["vtab"]
|
||||
# session extension: 3.13.0
|
||||
#session = ["libsqlite3-sys/session", "hooks"]
|
||||
session = ["libsqlite3-sys/session", "hooks"]
|
||||
# window functions: 3.25.0
|
||||
window = ["functions"]
|
||||
# 3.9.0
|
||||
|
@ -305,14 +305,13 @@ pub struct ChangesetIter<'changeset> {
|
||||
|
||||
impl ChangesetIter<'_> {
|
||||
/// Create an iterator on `input`
|
||||
pub fn start_strm<'input>(input: &'input mut dyn Read) -> Result<ChangesetIter<'input>> {
|
||||
let input_ref = &input;
|
||||
pub fn start_strm<'input>(input: &&'input mut dyn Read) -> Result<ChangesetIter<'input>> {
|
||||
let mut it = MaybeUninit::uninit();
|
||||
check!(unsafe {
|
||||
ffi::sqlite3changeset_start_strm(
|
||||
it.as_mut_ptr(),
|
||||
Some(x_input),
|
||||
input_ref as *const &mut dyn Read as *mut c_void,
|
||||
input as *const &mut dyn Read as *mut c_void,
|
||||
)
|
||||
});
|
||||
let it: *mut ffi::sqlite3_changeset_iter = unsafe { it.assume_init() };
|
||||
@ -714,7 +713,7 @@ unsafe extern "C" fn x_input(p_in: *mut c_void, data: *mut c_void, len: *mut c_i
|
||||
if p_in.is_null() {
|
||||
return ffi::SQLITE_MISUSE;
|
||||
}
|
||||
let bytes: &mut [u8] = from_raw_parts_mut(data as *mut u8, len as usize);
|
||||
let bytes: &mut [u8] = from_raw_parts_mut(data as *mut u8, *len as usize);
|
||||
let input = p_in as *mut &mut dyn Read;
|
||||
match (*input).read(bytes) {
|
||||
Ok(n) => {
|
||||
@ -743,6 +742,7 @@ unsafe extern "C" fn x_output(p_out: *mut c_void, data: *const c_void, len: c_in
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use fallible_streaming_iterator::FallibleStreamingIterator;
|
||||
use std::io::Read;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use super::{Changeset, ChangesetIter, ConflictAction, ConflictType, Session};
|
||||
@ -808,8 +808,8 @@ mod test {
|
||||
assert!(!output.is_empty());
|
||||
assert_eq!(14, output.len());
|
||||
|
||||
let mut input = output.as_slice();
|
||||
let mut iter = ChangesetIter::start_strm(&mut input).unwrap();
|
||||
let input: &mut dyn Read = &mut output.as_slice();
|
||||
let mut iter = ChangesetIter::start_strm(&input).unwrap();
|
||||
let item = iter.next().unwrap();
|
||||
assert!(item.is_some());
|
||||
}
|
||||
@ -867,8 +867,9 @@ mod test {
|
||||
db.execute_batch("CREATE TABLE foo(t TEXT PRIMARY KEY NOT NULL);")
|
||||
.unwrap();
|
||||
|
||||
let mut input = output.as_slice();
|
||||
db.apply_strm(
|
||||
&mut output.as_slice(),
|
||||
&mut input,
|
||||
None::<fn(&str) -> bool>,
|
||||
|_conflict_type, _item| ConflictAction::SQLITE_CHANGESET_OMIT,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user