Title: [870] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mysql.rb: Add these parameters to url for MySQL, no matter what
Revision
870
Author
olabini
Date
2008-01-06 16:52:25 -0500 (Sun, 06 Jan 2008)

Log Message

Add these parameters to url for MySQL, no matter what

Modified Paths


Diff

Modified: trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mysql.rb (869 => 870)


--- trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mysql.rb	2008-01-06 06:33:49 UTC (rev 869)
+++ trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mysql.rb	2008-01-06 21:52:25 UTC (rev 870)
@@ -7,7 +7,11 @@
         warn "AR-JDBC MySQL on JRuby does not support sockets"
       end
       config[:port] ||= 3306
-      config[:url] ||= "jdbc:mysql://#{config[:host]}:#{config[:port]}/#{config[:database]}?#{MySQL::URL_OPTIONS}"
+      if config[:url]
+        config[:url] = config[:url]['?'] ? "#{config[:url]}&#{MySQL::URL_OPTIONS}" : "#{config[:url]}?#{MySQL::URL_OPTIONS}"
+      else
+        config[:url] = "jdbc:mysql://#{config[:host]}:#{config[:port]}/#{config[:database]}?#{MySQL::URL_OPTIONS}"
+      end
       config[:driver] = "com.mysql.jdbc.Driver"
       jdbc_connection(config)
     end
@@ -207,4 +211,4 @@
       false
     end
   end
-end
\ No newline at end of file
+end
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to