Skip to main content

QueryResult

Struct QueryResult 

Source
pub struct QueryResult { /* private fields */ }
Expand description

Collected result of a query: all rows’ column offsets plus metadata.

Data lives in an Arena; this struct holds only the offset/length bookkeeping. Access rows via row() or rows().

§Example

for row in result.rows(&arena) {
    // Access columns by index
}

Implementations§

Source§

impl QueryResult

Source

pub fn from_parts( all_col_offsets: Vec<(usize, i32)>, num_cols: usize, columns: Arc<[ColumnDesc]>, affected_rows: u64, ) -> QueryResult

Construct a QueryResult from its constituent parts.

Used by bsql-core’s streaming layer to assemble per-chunk results.

Source

pub fn from_parts_with_buf( all_col_offsets: Vec<(usize, i32)>, num_cols: usize, columns: Arc<[ColumnDesc]>, affected_rows: u64, data_buf: Vec<u8>, ) -> QueryResult

Construct with inline data buffer (zero-copy from wire).

Source

pub fn len(&self) -> usize

Number of rows in the result.

Source

pub fn is_empty(&self) -> bool

Whether the result set is empty.

Source

pub fn affected_rows(&self) -> u64

Number of affected rows (for INSERT/UPDATE/DELETE).

Source

pub fn columns(&self) -> &[ColumnDesc]

Column descriptors.

Source

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 or the inline data buffer.

Source

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.

Source

pub fn take_data_buf(&mut self) -> Option<Vec<u8>>

Take the data buffer for recycling. Returns None if no data_buf.

Source

pub fn rows<'a>(&'a self, arena: &'a Arena) -> impl Iterator<Item = Row<'a>>

Iterate over rows.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.