As a first step towards moving to async and returning impl Stream<Row> this PR aims to introduce a Row trait and change the ResultSet.next() method to return an Option<Row>.
/// Result set from executing a query against a statement
pub trait ResultSet {
/// get meta data about this result set
fn meta_data(&self) -> Result<Box<dyn ResultSetMetaData>>;
/// Fetch the next row
fn next(&mut self) -> Result<Option<Box<dyn Row>>>;
}
/// Row
pub trait Row {
fn get_i8(&self, i: u64) -> Result<Option<i8>>;
fn get_i16(&self, i: u64) -> Result<Option<i16>>;
fn get_i32(&self, i: u64) -> Result<Option<i32>>;
fn get_i64(&self, i: u64) -> Result<Option<i64>>;
fn get_f32(&self, i: u64) -> Result<Option<f32>>;
fn get_f64(&self, i: u64) -> Result<Option<f64>>;
fn get_string(&self, i: u64) -> Result<Option<String>>;
fn get_bytes(&self, i: u64) -> Result<Option<Vec<u8>>>;
//TODO add accessors for date, time, timestamp and other ANSI SQL types
}
One concern that I have with this approach is that now each Row is boxed so that seems inefficient?
Also, I'm struggling to implement it for Postgres and SQLite due to lifetime issues.
As a first step towards moving to async and returning
impl Stream<Row>
this PR aims to introduce aRow
trait and change theResultSet.next()
method to return anOption<Row>
.One concern that I have with this approach is that now each
Row
is boxed so that seems inefficient?Also, I'm struggling to implement it for Postgres and SQLite due to lifetime issues.