mirror of
https://github.com/isar/rusqlite.git
synced 2025-03-31 19:12:58 +08:00
Fix window impl
This commit is contained in:
parent
7ed8e0ef2f
commit
13399c5808
@ -464,7 +464,7 @@ impl Connection {
|
|||||||
where
|
where
|
||||||
A: RefUnwindSafe + UnwindSafe,
|
A: RefUnwindSafe + UnwindSafe,
|
||||||
W: WindowAggregate<A, T> + 'static,
|
W: WindowAggregate<A, T> + 'static,
|
||||||
T: ToSql,
|
T: SqlFnOutput,
|
||||||
{
|
{
|
||||||
self.db
|
self.db
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
@ -585,7 +585,7 @@ impl InnerConnection {
|
|||||||
where
|
where
|
||||||
A: RefUnwindSafe + UnwindSafe,
|
A: RefUnwindSafe + UnwindSafe,
|
||||||
W: WindowAggregate<A, T> + 'static,
|
W: WindowAggregate<A, T> + 'static,
|
||||||
T: ToSql,
|
T: SqlFnOutput,
|
||||||
{
|
{
|
||||||
let boxed_aggr: *mut W = Box::into_raw(Box::new(aggr));
|
let boxed_aggr: *mut W = Box::into_raw(Box::new(aggr));
|
||||||
let c_name = str_to_cstring(fn_name)?;
|
let c_name = str_to_cstring(fn_name)?;
|
||||||
@ -688,7 +688,7 @@ unsafe extern "C" fn call_boxed_inverse<A, W, T>(
|
|||||||
) where
|
) where
|
||||||
A: RefUnwindSafe + UnwindSafe,
|
A: RefUnwindSafe + UnwindSafe,
|
||||||
W: WindowAggregate<A, T>,
|
W: WindowAggregate<A, T>,
|
||||||
T: ToSql,
|
T: SqlFnOutput,
|
||||||
{
|
{
|
||||||
let pac = if let Some(pac) = aggregate_context(ctx, std::mem::size_of::<*mut A>()) {
|
let pac = if let Some(pac) = aggregate_context(ctx, std::mem::size_of::<*mut A>()) {
|
||||||
pac
|
pac
|
||||||
@ -768,7 +768,7 @@ unsafe extern "C" fn call_boxed_value<A, W, T>(ctx: *mut sqlite3_context)
|
|||||||
where
|
where
|
||||||
A: RefUnwindSafe + UnwindSafe,
|
A: RefUnwindSafe + UnwindSafe,
|
||||||
W: WindowAggregate<A, T>,
|
W: WindowAggregate<A, T>,
|
||||||
T: ToSql,
|
T: SqlFnOutput,
|
||||||
{
|
{
|
||||||
// Within the xValue callback, it is customary to set N=0 in calls to
|
// Within the xValue callback, it is customary to set N=0 in calls to
|
||||||
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
|
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
|
||||||
@ -792,17 +792,7 @@ where
|
|||||||
}
|
}
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
};
|
};
|
||||||
let t = t.as_ref().map(|(t, sub_type)| (ToSql::to_sql(t), sub_type));
|
sql_result(ctx, t);
|
||||||
match t {
|
|
||||||
Ok((Ok(ref value), sub_type)) => {
|
|
||||||
set_result(ctx, value);
|
|
||||||
if let Some(sub_type) = sub_type {
|
|
||||||
ffi::sqlite3_result_subtype(ctx, *sub_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok((Err(err), _)) => report_error(ctx, &err),
|
|
||||||
Err(err) => report_error(ctx, err),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user