Ensure LIMIT BY clause does not cause query to fail

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-09 19:44:15 +01:00
parent 29e500017d
commit 90dfa9f49f
3 changed files with 27 additions and 9 deletions

View file

@ -78,7 +78,9 @@ impl Iterable {
// Loop until no more keys
loop {
// Check if the context is finished
ctx.check()?;
if ctx.is_done() {
break;
}
// Get the next 1000 key-value entries
let res = match nxt {
None => {
@ -104,7 +106,9 @@ impl Iterable {
// Loop over results
for (i, (k, v)) in res.into_iter().enumerate() {
// Check the context
ctx.check()?;
if ctx.is_done() {
break;
}
// Ready the next
if n == i + 1 {
nxt = Some(k.clone());
@ -199,7 +203,9 @@ impl Iterable {
// Loop until no more keys
loop {
// Check if the context is finished
ctx.check()?;
if ctx.is_done() {
break;
}
// Get the next 1000 key-value entries
let res = match nxt {
None => {
@ -225,7 +231,9 @@ impl Iterable {
// Loop over results
for (i, (k, _)) in res.into_iter().enumerate() {
// Check the context
ctx.check()?;
if ctx.is_done() {
break;
}
// Ready the next
if n == i + 1 {
nxt = Some(k.clone());

View file

@ -78,7 +78,9 @@ impl Iterable {
// Loop until no more keys
loop {
// Check if the context is finished
ctx.check()?;
if ctx.is_done() {
break;
}
// Get the next 1000 key-value entries
let res = match nxt {
None => {
@ -104,7 +106,9 @@ impl Iterable {
// Loop over results
for (i, (k, v)) in res.into_iter().enumerate() {
// Check the context
ctx.check()?;
if ctx.is_done() {
break;
}
// Ready the next
if n == i + 1 {
nxt = Some(k.clone());
@ -199,7 +203,9 @@ impl Iterable {
// Loop until no more keys
loop {
// Check if the context is finished
ctx.check()?;
if ctx.is_done() {
break;
}
// Get the next 1000 key-value entries
let res = match nxt {
None => {
@ -225,7 +231,9 @@ impl Iterable {
// Loop over results
for (i, (k, _)) in res.into_iter().enumerate() {
// Check the context
ctx.check()?;
if ctx.is_done() {
break;
}
// Ready the next
if n == i + 1 {
nxt = Some(k.clone());

View file

@ -12,7 +12,9 @@ pub async fn run(
doc: Option<&Value>,
) -> Result<Value, Error> {
// Check the context
let _ = ctx.check()?;
if ctx.is_done() {
return Ok(Value::None);
}
// Create a new agent
let exe = Executor::default();
// Create an JavaScript context