mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 17:24:21 +01:00
chore: fix clippy warnings
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use errors::*;
|
||||
use limbo_core::types::Text;
|
||||
use limbo_core::Value;
|
||||
use pyo3::prelude::*;
|
||||
use pyo3::types::{PyBytes, PyList, PyTuple};
|
||||
@@ -96,17 +95,15 @@ impl Cursor {
|
||||
// For DDL and DML statements,
|
||||
// we need to execute the statement immediately
|
||||
if stmt_is_ddl || stmt_is_dml {
|
||||
loop {
|
||||
match stmt.borrow_mut().step().map_err(|e| {
|
||||
PyErr::new::<OperationalError, _>(format!("Step error: {:?}", e))
|
||||
})? {
|
||||
limbo_core::StepResult::IO => {
|
||||
self.conn.io.run_once().map_err(|e| {
|
||||
PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e))
|
||||
})?;
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
while let limbo_core::StepResult::IO = stmt
|
||||
.borrow_mut()
|
||||
.step()
|
||||
.map_err(|e| PyErr::new::<OperationalError, _>(format!("Step error: {:?}", e)))?
|
||||
{
|
||||
self.conn
|
||||
.io
|
||||
.run_once()
|
||||
.map_err(|e| PyErr::new::<OperationalError, _>(format!("IO error: {:?}", e)))?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +127,7 @@ impl Cursor {
|
||||
})? {
|
||||
limbo_core::StepResult::Row => {
|
||||
let row = stmt.row().unwrap();
|
||||
let py_row = row_to_py(py, &row)?;
|
||||
let py_row = row_to_py(py, row)?;
|
||||
return Ok(Some(py_row));
|
||||
}
|
||||
limbo_core::StepResult::IO => {
|
||||
@@ -166,7 +163,7 @@ impl Cursor {
|
||||
})? {
|
||||
limbo_core::StepResult::Row => {
|
||||
let row = stmt.row().unwrap();
|
||||
let py_row = row_to_py(py, &row)?;
|
||||
let py_row = row_to_py(py, row)?;
|
||||
results.push(py_row);
|
||||
}
|
||||
limbo_core::StepResult::IO => {
|
||||
@@ -342,13 +339,13 @@ fn row_to_py(py: Python, row: &limbo_core::Row) -> Result<PyObject> {
|
||||
/// Converts a Python object to a Limbo Value
|
||||
fn py_to_owned_value(obj: &Bound<PyAny>) -> Result<limbo_core::Value> {
|
||||
if obj.is_none() {
|
||||
return Ok(Value::Null);
|
||||
Ok(Value::Null)
|
||||
} else if let Ok(integer) = obj.extract::<i64>() {
|
||||
return Ok(Value::Integer(integer));
|
||||
} else if let Ok(float) = obj.extract::<f64>() {
|
||||
return Ok(Value::Float(float));
|
||||
} else if let Ok(string) = obj.extract::<String>() {
|
||||
return Ok(Value::Text(Text::from_str(string)));
|
||||
return Ok(Value::Text(string.into()));
|
||||
} else if let Ok(bytes) = obj.downcast::<PyBytes>() {
|
||||
return Ok(Value::Blob(bytes.as_bytes().to_vec()));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user