Skip to content

Commit

Permalink
Use :found_rows option for trilogy to get accurate rows matched
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed May 4, 2023
1 parent 6042514 commit 41e621f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions lib/sequel/adapters/trilogy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Database < Sequel::Database
def connect(server)
opts = server_opts(server)
opts[:username] ||= opts.delete(:user)
opts[:found_rows] = true
conn = ::Trilogy.new(opts)
mysql_connection_setting_sqls.each{|sql| log_connection_yield(sql, conn){conn.query(sql)}}
conn
Expand Down Expand Up @@ -98,10 +99,6 @@ def fetch_rows(sql)
self
end

def provides_accurate_rows_matched?
false
end

private

def execute(sql, opts=OPTS)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/dataset_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
@ds.all.must_equal [{:id=>1, :number=>11}]
end

cspecify "should have update return the number of matched rows", [:trilogy] do
it "should have update return the number of matched rows" do
@ds.update(:number=>:number).must_equal 1
@ds.filter(:id=>1).update(:number=>:number).must_equal 1
@ds.filter(:id=>2).update(:number=>:number).must_equal 0
Expand Down

0 comments on commit 41e621f

Please sign in to comment.