File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -586,14 +586,20 @@ def version
586586 return @version ||= begin
587587 version = [ ]
588588 java_connection = jdbc_connection ( true )
589- if java_connection . is_a? ( Java :: ComMysqlJdbc :: ConnectionImpl )
589+ if java_connection . java_class . name == 'com.mysql.jdbc. ConnectionImpl'
590590 version << jdbc_connection . serverMajorVersion
591591 version << jdbc_connection . serverMinorVersion
592592 version << jdbc_connection . serverSubMinorVersion
593593 else
594- warn "INFO: failed to resolve MySQL server version using: #{ java_connection } "
594+ result = execute 'SELECT VERSION()' , 'SCHEMA'
595+ result = result . first . values . first # [{"VERSION()"=>"5.5.37-0ubuntu..."}]
596+ if match = result . match ( /^(\d )\. (\d +)\. (\d +)/ )
597+ version << match [ 1 ] . to_i
598+ version << match [ 2 ] . to_i
599+ version << match [ 3 ] . to_i
600+ end
595601 end
596- version
602+ version . freeze
597603 end
598604 end
599605
You can’t perform that action at this time.
0 commit comments