From 4a996e0a05ea92e9295cc1871974b8e0a32d6367 Mon Sep 17 00:00:00 2001 From: Ming Ying <ming.ying.nyc@gmail.com> Date: Wed, 19 Jun 2024 22:28:45 -0400 Subject: [PATCH 1/4] Interrupt connection --- crates/duckdb/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/duckdb/src/lib.rs b/crates/duckdb/src/lib.rs index d18f6daf..67f9c053 100644 --- a/crates/duckdb/src/lib.rs +++ b/crates/duckdb/src/lib.rs @@ -376,6 +376,10 @@ impl Connection { self.prepare(sql).and_then(|mut stmt| stmt.execute(params)) } + pub fn interrupt(&self) { + unsafe { ffi::duckdb_interrupt(self.db.borrow_mut().con) }; + } + /// Returns the path to the database file, if one exists and is known. #[inline] pub fn path(&self) -> Option<&Path> { From 70fb0279f6ea31f142d8c792f408b55a6223b95b Mon Sep 17 00:00:00 2001 From: Ming Ying <ming.ying.nyc@gmail.com> Date: Wed, 19 Jun 2024 22:40:12 -0400 Subject: [PATCH 2/4] Dont borrow mut --- .DS_Store | Bin 0 -> 6148 bytes crates/.DS_Store | Bin 0 -> 8196 bytes crates/duckdb/src/lib.rs | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 crates/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9dd77596b222136c6fff986fef10e06743a22d37 GIT binary patch literal 6148 zcmeHK%}T>S5Z-NTn^J@v6nYGJEf}qe;w8lT0!H+pQWFz27_+5G&7l->))(?gd>&_Z zH-})rn~0r(-EVe&b~7Jje;8xjU4(m#nT#<58X`xfLD1ajYUyA^F6W3?78KbmNJP*u z(O)#-w|ChCn=_x~tp5EU!7Pch+_pb?tKHe?_Kcn}Fz&o3QFytZFEZDk-{9y{h$N_V zKe&pcVrp)ki8S})G@8qVIE*0V_Bu{OQMh7}hMCOul*8y7{i!)zE)Q*cWE~ujS0ihA zvXA=sXtnAa+dI3b7t`nDB^7UqNDiD!+0<CUJ1Di9UcGsmi1ZQcRZbO4NDL4I!~ij{ zehlcdz!<Dw=~OW>Kn(oA0PYVKG(<;ZsZeem(BbtN{T)OU(D5ySXlZmbmI}cG!c{7u zO6B^A!BslgEgk1*EETGB#^uT|k6yWYyl}ZX*ew~(xTBDIVt^Q^GtgE;6VLy1_+=U& z`SlbU5d*})KVyJ*Cf>w_qV(DNtvozyEok@9P%y4U1qAfkB>)Dvj|`<#`7P8T&e2#Z V#97cT(*fxsAPJ$482AMSz5uvyOd<dP literal 0 HcmV?d00001 diff --git a/crates/.DS_Store b/crates/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b4b69c260a420a42f3c5a8a4e4af7e2a2e9a40ff GIT binary patch literal 8196 zcmeHMU2GIp6u#fIw0EZbOiNpeo23f{gQdV)%0I~V2M{Sz``_}j>~=;vb~;mbW_N*F z(<ed%qlrq4KaXlq!-I(i6HSa7<AaHjAOTH$(FbFE)c9he=g!?Fvd|YE{0VcDx#ymH z&v$3eneWW(nPrTjBWpa!SOa5>(;=i@Mco~mSQp1_O)1QjlLX-zGgvyE_omXeo4(CD zoCqTjMj(tp7=bVXVFdmQ5ukUrXnc<MzFZCaFalu&?#T#<=R=GRArl2TD`oKLpe`r@ zNQx35Xf&oeAi%^5GEtDTQU*}kQ&tZsKv5_$AmOwg6Xqln1vx9FgfmDuL*dLQR453} zPPkZL&XABY?869z5x6}9B7G{TZqKqYHc?W)UrtZimgmRg*PxV@&#S29mAr}{=^J<R zeSXT%dL60EA))oVuAMH9Q|Up=%qR8QPS^2MmSbiDfMu9ua(Kvc3^(85W*x%|uzhlY zt6WX$4b#&b<MEbQ+m_8UEwSmXtzx`k)69&@>zdYY?@dnFlaBkebOVJ)0b5Yw*11xj zY%kX-ze$wU7k#>3^hwpKB7;NP$gnl$I(^n@GpR4~$f<p#_GHW)IWsio+Sy6ROX}5Q zDSIqyr+l;BwuP}b?3*WjF&g#UjNcg;CUrgQnY||2Svj+dtO;5pb~-raTdv~`ni-E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HcmV?d00001 diff --git a/crates/duckdb/src/lib.rs b/crates/duckdb/src/lib.rs index 67f9c053..788c8448 100644 --- a/crates/duckdb/src/lib.rs +++ b/crates/duckdb/src/lib.rs @@ -377,7 +377,7 @@ impl Connection { } pub fn interrupt(&self) { - unsafe { ffi::duckdb_interrupt(self.db.borrow_mut().con) }; + unsafe { ffi::duckdb_interrupt(self.db.borrow().con) }; } /// Returns the path to the database file, if one exists and is known. From 10c7e671a802bfe92c312d915c8febdfab97ed47 Mon Sep 17 00:00:00 2001 From: Ming Ying <ming.ying.nyc@gmail.com> Date: Thu, 20 Jun 2024 09:58:29 -0400 Subject: [PATCH 3/4] Add docs + remove DS_Store --- .DS_Store | Bin 6148 -> 0 bytes crates/.DS_Store | Bin 8196 -> 0 bytes crates/duckdb/src/lib.rs | 2 ++ 3 files changed, 2 insertions(+) delete mode 100644 .DS_Store delete mode 100644 crates/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 9dd77596b222136c6fff986fef10e06743a22d37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-NTn^J@v6nYGJEf}qe;w8lT0!H+pQWFz27_+5G&7l->))(?gd>&_Z zH-})rn~0r(-EVe&b~7Jje;8xjU4(m#nT#<58X`xfLD1ajYUyA^F6W3?78KbmNJP*u z(O)#-w|ChCn=_x~tp5EU!7Pch+_pb?tKHe?_Kcn}Fz&o3QFytZFEZDk-{9y{h$N_V zKe&pcVrp)ki8S})G@8qVIE*0V_Bu{OQMh7}hMCOul*8y7{i!)zE)Q*cWE~ujS0ihA zvXA=sXtnAa+dI3b7t`nDB^7UqNDiD!+0<CUJ1Di9UcGsmi1ZQcRZbO4NDL4I!~ij{ zehlcdz!<Dw=~OW>Kn(oA0PYVKG(<;ZsZeem(BbtN{T)OU(D5ySXlZmbmI}cG!c{7u zO6B^A!BslgEgk1*EETGB#^uT|k6yWYyl}ZX*ew~(xTBDIVt^Q^GtgE;6VLy1_+=U& z`SlbU5d*})KVyJ*Cf>w_qV(DNtvozyEok@9P%y4U1qAfkB>)Dvj|`<#`7P8T&e2#Z V#97cT(*fxsAPJ$482AMSz5uvyOd<dP diff --git a/crates/.DS_Store b/crates/.DS_Store deleted file mode 100644 index b4b69c260a420a42f3c5a8a4e4af7e2a2e9a40ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIp6u#fIw0EZbOiNpeo23f{gQdV)%0I~V2M{Sz``_}j>~=;vb~;mbW_N*F z(<ed%qlrq4KaXlq!-I(i6HSa7<AaHjAOTH$(FbFE)c9he=g!?Fvd|YE{0VcDx#ymH z&v$3eneWW(nPrTjBWpa!SOa5>(;=i@Mco~mSQp1_O)1QjlLX-zGgvyE_omXeo4(CD zoCqTjMj(tp7=bVXVFdmQ5ukUrXnc<MzFZCaFalu&?#T#<=R=GRArl2TD`oKLpe`r@ zNQx35Xf&oeAi%^5GEtDTQU*}kQ&tZsKv5_$AmOwg6Xqln1vx9FgfmDuL*dLQR453} zPPkZL&XABY?869z5x6}9B7G{TZqKqYHc?W)UrtZimgmRg*PxV@&#S29mAr}{=^J<R zeSXT%dL60EA))oVuAMH9Q|Up=%qR8QPS^2MmSbiDfMu9ua(Kvc3^(85W*x%|uzhlY zt6WX$4b#&b<MEbQ+m_8UEwSmXtzx`k)69&@>zdYY?@dnFlaBkebOVJ)0b5Yw*11xj zY%kX-ze$wU7k#>3^hwpKB7;NP$gnl$I(^n@GpR4~$f<p#_GHW)IWsio+Sy6ROX}5Q zDSIqyr+l;BwuP}b?3*WjF&g#UjNcg;CUrgQnY||2Svj+dtO;5pb~-raTdv~`ni-E| zQz9-eUA;8FF1q6WHSvwxc6B}6-E(!p!bQ4Pqty=OEYC{Y=0M&u{PB^LH)cA9<s2WS zs5!p%xMgP4YHU~goz$dxRj*&tu=Ku2q|~~&%WyVroyc1LDZPnvd5*@&a#eqiA2#SB z54eWd(Fj%|jgeKH9}@GO8IyWBt*wqUt9pv}d*rg*Vy(7b)jhR;f^MyZwrXu$H`D<; zl{RfTwOQNB_5JElPI@jUcW4jsYP6`sWA5Z6`Qypy_DCn!zu-s3xw})Ie{jllidWSh z*~|H;H=fFv2lK?OB4R)1!F{870oiR>zMBaGa-cC184+8x8-{6+-wpLk^hj@{pX*l$ zqgzhSA~w_Qkfi2KiDr3Mf}pCkCF~M!s-<iNYhycD4;!JJ$+Pq9MRtL`&MvX{*@x_N z_BFf0zG2tcckD;@Gy9eOfqAF|hl(03Mjh(WgchvDI&4EHy08a((TxENVi+ShisKl^ z6PUmWoW?X}@D$GASv-g5@d94M8+a2J@fJS7C-@Yf;VWFn4Sb7V@EiVAm;yyps+0xF zLS?zKLRq8475dUAno`V|QK=VurGrMdJOwCY3SaS*6L-p(=$^gWzJE1iZp;@sQeCsS zwr*L|>b0$#wkK}VND{BewZC&XpzSSW4`>_Q=~BMQWYVGo#B1~9Tsfsz3I_A5!n!f0 zMfG{ae5tNnMQR1HUaAi?N29tz$tKlx>!X@pMyaF**bU93qM&TvqG@_LC6!#;v6ECL z@?7fe9ki235q|e%y~y5Wm)XbcOCsy{><9J}`yC7wm`~(fh8PiaB~}qZ<7mYOv|%T9 zp&cDW*KRzD9z2F#9KsPKaSSOUtBpxG$m0|d_DQ1b8JxvAoX0b`fS2$xUcsvYb>GH2 zl6E)A_(+k4QsSdhGUoa+j_o?fX}(C{TOpx#R}m<as0LC0@1Fbn|6T1Jg2D)d5%_;Z z0OehMUE(LeTu)a~Yscs~Mu%v^ZdS?wLS0aflMKpnk~jY_q;ZT)1tw9Dvr^IwwSW9W Uz-cpl|I?4v@ckdq@1E`c0`|Wb!T<mO diff --git a/crates/duckdb/src/lib.rs b/crates/duckdb/src/lib.rs index 788c8448..f9e93d2f 100644 --- a/crates/duckdb/src/lib.rs +++ b/crates/duckdb/src/lib.rs @@ -376,6 +376,8 @@ impl Connection { self.prepare(sql).and_then(|mut stmt| stmt.execute(params)) } + /// Convenience method to interrupt the current query running on the connection. + #[inline] pub fn interrupt(&self) { unsafe { ffi::duckdb_interrupt(self.db.borrow().con) }; } From 3f611a78b28b7e0ef83f1f73d810ca8487060efc Mon Sep 17 00:00:00 2001 From: Ming Ying <ming.ying.nyc@gmail.com> Date: Thu, 20 Jun 2024 10:13:01 -0400 Subject: [PATCH 4/4] Add more docs --- crates/duckdb/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/duckdb/src/lib.rs b/crates/duckdb/src/lib.rs index f9e93d2f..656aabb8 100644 --- a/crates/duckdb/src/lib.rs +++ b/crates/duckdb/src/lib.rs @@ -377,6 +377,8 @@ impl Connection { } /// Convenience method to interrupt the current query running on the connection. + /// + /// This will cause the cancelled query to immediately return an error. #[inline] pub fn interrupt(&self) { unsafe { ffi::duckdb_interrupt(self.db.borrow().con) };