Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more connection options from AR

  • Loading branch information...
commit 9877cb1dc9e01b58a3f3a39529e92ba90c7a4d01 1 parent dd5101d
@tmm1 authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/em/mysql.rb
View
10 lib/em/mysql.rb
@@ -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}'")
Please sign in to comment.
Something went wrong with that request. Please try again.