TalentBox / sequel-rails

A gem for using Sequel with Rails 5.x, 6.x, 7.x, 8.x
http://talentbox.github.io/sequel-rails/
MIT License
326 stars 81 forks source link

Could not log "sql.sequel" event. when use prepare statements in sequel #183

Closed smaginant closed 11 months ago

smaginant commented 3 years ago

Hey, I just want to ask a question about prepare statements

https://github.com/jeremyevans/sequel/blob/de22fcd2248b5334ed35f18b799b86771a5b255b/doc/prepared_statements.rdoc#prepared-statements-

when I run this part of code in runtime

ds = Sequel::Model.db[:accounts].where(id: :$id).prepare(:select, :accounts_by_id)
ds.call(id: 1)

I receive Could not log "sql.sequel" event. NoMethodError: undefined method 'name' for 1:Integer ["/Users/antonsmagin/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sequel-rails-1.1.0/lib/sequel_rails/railties/log_subscriber.rb:44:inblock in sql'"`

I suppose this is because log_subscriber.rb expect another bind arguments for logging. Is this is bug? or bind can be passed in different way or in another place? Do you know, may be I can prepare statements in different way?

Thank you

JonathanTron commented 3 years ago

Hi @anton-smagin, thanks for reporting the issue. It looks like a bug.

Aryk commented 11 months ago

Any updates on this issue? I'm getting a similar issue

JonathanTron commented 11 months ago

@smaginant @Aryk Thanks for reporting the problem, I fixed the issue and will release a new version.