mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-01 15:34:19 +01:00
Merge 'Improve error reporting in Python bindings' from amuldotexe
Solving issue #494 , changes made at 5 places where todo macros were replaced with relevant errors to avoid the crashes _for now_ Reviewed-by: Avinash Sajjanshetty <opensource@avi.im> Closes #526
This commit is contained in:
@@ -104,7 +104,10 @@ impl Cursor {
|
||||
|
||||
// TODO: use stmt_is_dml to set rowcount
|
||||
if stmt_is_dml {
|
||||
todo!()
|
||||
return Err(PyErr::new::<NotSupportedError, _>(
|
||||
"DML statements (INSERT/UPDATE/DELETE) are not fully supported in this version",
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
Ok(Cursor {
|
||||
@@ -181,18 +184,24 @@ impl Cursor {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close(&self) -> Result<()> {
|
||||
todo!()
|
||||
pub fn close(&self) -> PyResult<()> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"close() is not supported in this version",
|
||||
))
|
||||
}
|
||||
|
||||
#[pyo3(signature = (sql, parameters=None))]
|
||||
pub fn executemany(&self, sql: &str, parameters: Option<Py<PyList>>) {
|
||||
todo!()
|
||||
pub fn executemany(&self, sql: &str, parameters: Option<Py<PyList>>) -> PyResult<()> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"executemany() is not supported in this version",
|
||||
))
|
||||
}
|
||||
|
||||
#[pyo3(signature = (size=None))]
|
||||
pub fn fetchmany(&self, size: Option<i64>) {
|
||||
todo!()
|
||||
pub fn fetchmany(&self, size: Option<i64>) -> PyResult<Option<Vec<PyObject>>> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"fetchmany() is not supported in this version",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,12 +237,16 @@ impl Connection {
|
||||
drop(self.conn.clone());
|
||||
}
|
||||
|
||||
pub fn commit(&self) {
|
||||
todo!()
|
||||
pub fn commit(&self) -> PyResult<()> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"Transactions are not supported in this version",
|
||||
))
|
||||
}
|
||||
|
||||
pub fn rollback(&self) {
|
||||
todo!()
|
||||
pub fn rollback(&self) -> PyResult<()> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"Transactions are not supported in this version",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user