File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -330,8 +330,24 @@ pub struct Curs
8000
or {
330
330
// SAFETY: The libsql crate guarantees that `Connection` is thread-safe.
331
331
unsafe impl Send for Cursor { }
332
332
333
+ impl Drop for Cursor {
334
+ fn drop ( & mut self ) {
335
+ self . stmt . replace ( None ) ;
336
+ self . rows . replace ( None ) ;
337
+ }
338
+ }
339
+
333
340
#[ pymethods]
334
341
impl Cursor {
342
+ fn close ( self_ : PyRef < ' _ , Self > ) -> PyResult < ( ) > {
343
+ rt ( ) . block_on ( async {
344
+ let cursor: & Cursor = & self_;
345
+ cursor. stmt . replace ( None ) ;
346
+ cursor. rows . replace ( None ) ;
347
+ } ) ;
348
+ Ok ( ( ) )
349
+ }
350
+
335
351
fn execute < ' a > (
336
352
self_ : PyRef < ' a , Self > ,
337
353
sql : String ,
@@ -474,11 +490,6 @@ impl Cursor {
474
490
fn rowcount ( self_ : PyRef < ' _ , Self > ) -> PyResult < i64 > {
475
491
Ok ( * self_. rowcount . borrow ( ) )
476
492
}
477
-
478
- fn close ( _self : PyRef < ' _ , Self > ) -> PyResult < ( ) > {
479
- // TODO
480
- Ok ( ( ) )
481
- }
482
493
}
483
494
484
495
async fn begin_transaction ( conn : & libsql_core:: Connection ) -> PyResult < ( ) > {
You can’t perform that action at this time.
0 commit comments