Skip to content

Commit e833524

Browse files
committed
Merge pull request #161 from franckverrot/bugfix/aggregate
Align #create_aggregate with #create_aggregate_handler
2 parents 6e78c91 + ebcfd62 commit e833524

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/sqlite3/database.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ def step( *args )
395395

396396
def finalize
397397
super(@ctx)
398+
result = @ctx.result
399+
@ctx = FunctionProxy.new
400+
result
398401
end
399402
})
400403
proxy.ctx = FunctionProxy.new

test/test_integration.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ def test_create_aggregate_without_block
499499

500500
value = @db.get_first_value( "select accumulate(a) from foo" )
501501
assert_equal 6, value
502+
503+
# calling #get_first_value twice don't add up to the latest result
504+
value = @db.get_first_value( "select accumulate(a) from foo" )
505+
assert_equal 6, value
502506
end
503507

504508
def test_create_aggregate_with_block

0 commit comments

Comments
 (0)