From ae728b1695887c6aa2c16b3a336bdfe781b80339 Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Sun, 19 Nov 2023 17:40:27 -0300 Subject: [PATCH] Add failing spec for explicitly created statements --- spec/statement_spec.cr | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/statement_spec.cr b/spec/statement_spec.cr index a8c86f4..94635c5 100644 --- a/spec/statement_spec.cr +++ b/spec/statement_spec.cr @@ -72,6 +72,20 @@ describe DB::Statement do rs.statement.closed?.should be_true end end + + it "should not close statements if false and created explicitly" do + with_dummy_connection("prepared_statements=true&prepared_statements_cache=false") do |cnn| + stmt = cnn.prepared("the query") + + rs = stmt.query + # do not close while iterating + stmt.closed?.should be_false + rs.close + + # do not close after iterating + stmt.closed?.should be_false + end + end end it "should initialize positional params in query" do