On Monday, April 22, 2019 at 6:44:36 AM UTC-7, Василий Колесников wrote:
>
> Hi! Met some strange behavior when using Sequel with mysql2 driver for 
> MariaDB server.
>
> My server says:
>
> mysql> select version()\G
> *************************** 1. row ***************************
> version(): 10.2.12-MariaDB-10.2.12+maria~jessie
> 1 row in set (0.00 sec)
>
> I can use Sequel with Mysql2 driver for the most of trivial operations 
> (connect, select, insert, transactions).
> But some Sequel features guarded with predicates that check the server 
> version. For example `#supports_cte?` returns true for `db.server_version 
> >= 100200` only in case of mariadb.
> Ok. It does matter. But when I use mysql driver on the client to connect 
> to remote MariaDB server (version 10.2.12-MariaDB-10.2.12+maria~jessie) 
> Sequel::Database#server_info returns 50505 instead of 100212
> I have found the code and it looks a bit strange: 
> https://github.com/jeremyevans/sequel/blob/40d00b287cd7a99bcf812bc414562b57cabf4436/lib/sequel/adapters/mysql2.rb#L81-L83
>
> 1) `synchronize(server){|conn| conn.server_info[:id]}` returns 50505, 
> `super()` - 100212
> 2) `super` is incorrect call since 
> Sequel::MySQL::DatabaseMethods#server_version doesn't accept arguments.
>

It sounds like changing the method to:

      def server_version(server=nil)
        @server_version ||= super()
      end

fixes things, is that correct?

Can you run `rake spec_mysql` with that change and post the output?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to