Skip to content

Commit

Permalink
Merge pull request #320 from penberg/fix-hrana-row-order
Browse files Browse the repository at this point in the history
libsql/core: Fix row ordering with Hrana
  • Loading branch information
LucioFranco authored Aug 25, 2023
2 parents 9493502 + 8cbd684 commit 5ad6bc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/core/src/v2/hrana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};

// use crate::client::Config;
use crate::{Column, Params, Result};
use std::collections::HashMap;
use std::collections::{HashMap, VecDeque};
use std::sync::atomic::{AtomicI64, Ordering};
use std::sync::{Arc, RwLock};

Expand Down Expand Up @@ -357,12 +357,12 @@ impl super::statement::Stmt for Statement {

pub struct Rows {
cols: Arc<Vec<Col>>,
rows: Vec<Vec<proto::Value>>,
rows: VecDeque<Vec<proto::Value>>,
}

impl RowsInner for Rows {
fn next(&mut self) -> Result<Option<super::Row>> {
let row = match self.rows.pop() {
let row = match self.rows.pop_front() {
Some(row) => Row {
cols: self.cols.clone(),
inner: row,
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/v2/hrana/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![allow(dead_code)]

use std::fmt;
use std::collections::VecDeque;

use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -107,7 +108,7 @@ pub struct NamedArg {
#[derive(Deserialize, Clone, Debug)]
pub struct StmtResult {
pub cols: Vec<Col>,
pub rows: Vec<Vec<Value>>,
pub rows: VecDeque<Vec<Value>>,
pub affected_row_count: u64,
#[serde(with = "option_i64_as_str")]
pub last_insert_rowid: Option<i64>,
Expand Down

0 comments on commit 5ad6bc3

Please sign in to comment.