Permalink
Browse files

more connection options from AR

  • Loading branch information...
1 parent dd5101d commit 9877cb1dc9e01b58a3f3a39529e92ba90c7a4d01 @tmm1 committed Sep 13, 2008
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/em/mysql.rb
View
@@ -196,8 +196,16 @@ def self._connect opts
# we handle reconnecting (and reattaching the new fd to EM)
conn.reconnect = false
- # conn.query_with_result = false
+ # By default, MySQL 'where id is null' selects the last inserted id
+ # Turn this off. http://dev.rubyonrails.org/ticket/6778
+ conn.query("set SQL_AUTO_IS_NULL=0")
+
+ # get results for queries
+ conn.query_with_result = true
+
if encoding = opts[:encoding] || opts[:charset]
+ conn.options(Mysql::SET_CHARSET_NAME, encoding) rescue nil
+ conn.query("set names '#{encoding}'")
conn.query("set character_set_connection = '#{encoding}'")
conn.query("set character_set_client = '#{encoding}'")
conn.query("set character_set_database = '#{encoding}'")

0 comments on commit 9877cb1

Please sign in to comment.