pub struct QueryResult { /* private fields */ }Expand description
Result of a query execution. Owns the row offset metadata.
Uses flat column offset storage: all rows’ (arena_offset, length) pairs
are stored contiguously in all_col_offsets. Row N starts at index
N * num_cols. No separate row_starts Vec needed.
§Example
let result = conn.query("SELECT 1 as n", 0, &[], &mut arena).await?;
for i in 0..result.len() {
let row = result.row(i, &arena);
// Access columns by index
}Implementations§
Source§impl QueryResult
impl QueryResult
Sourcepub fn from_parts(
all_col_offsets: Vec<(usize, i32)>,
num_cols: usize,
columns: Arc<[ColumnDesc]>,
affected_rows: u64,
) -> Self
pub fn from_parts( all_col_offsets: Vec<(usize, i32)>, num_cols: usize, columns: Arc<[ColumnDesc]>, affected_rows: u64, ) -> Self
Construct a QueryResult from its constituent parts.
Used by bsql-core’s streaming layer to assemble per-chunk results.
Sourcepub fn affected_rows(&self) -> u64
pub fn affected_rows(&self) -> u64
Number of affected rows (for INSERT/UPDATE/DELETE).
Sourcepub fn columns(&self) -> &[ColumnDesc]
pub fn columns(&self) -> &[ColumnDesc]
Column descriptors.
Sourcepub fn row<'a>(&'a self, idx: usize, arena: &'a Arena) -> Row<'a>
pub fn row<'a>(&'a self, idx: usize, arena: &'a Arena) -> Row<'a>
Get a row by index. The returned Row borrows from the arena.
Sourcepub fn take_col_offsets(&mut self) -> Vec<(usize, i32)>
pub fn take_col_offsets(&mut self) -> Vec<(usize, i32)>
Take the col_offsets vec out of this result, leaving it empty.
Used by QueryStream to reclaim and reuse the allocation between chunks
instead of allocating a new Vec per chunk.
Auto Trait Implementations§
impl Freeze for QueryResult
impl RefUnwindSafe for QueryResult
impl Send for QueryResult
impl Sync for QueryResult
impl Unpin for QueryResult
impl UnsafeUnpin for QueryResult
impl UnwindSafe for QueryResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more