(#16333) Override function in AR MySQL connector to set sql_mode #120

Merged
merged 2 commits into from Nov 26, 2012

Conversation

Projects
None yet
5 participants
Contributor

kfjohnson commented Sep 11, 2012

Currently if there is a problematic sql_mode set globally it will end up
breaking things. This patch overrides the configure_connection function
of the MySQL connector to explicitly set the sql_mode to traditional for
the session so that if something that breaks the queries used by the
console (like ANSI_QUOTES) is set globally, it won't affect it.

(#16333) Override AR MySQL connector to set sql_mode
Currently if there is a problematic sql_mode set globally it will end up
breaking things. This patch overrides the configure_connection function
of the MySQL connector to explicitly set the sql_mode to traditional for
the session so that if something that breaks the queries used by the
console (like ANSI_QUOTES) is set globally, it won't affect it.
@@ -0,0 +1,15 @@
+module ActiveRecord::ConnectionAdapters
+ class MysqlAdapter
+ def configure_connection
@slippycheeze

slippycheeze Sep 11, 2012

Contributor

This probably isn't a good idea - better to rename the previous method, and call it, so that additional behaviour (which at least some versions do have) is also preserved.

jeffweiss pushed a commit that referenced this pull request Nov 26, 2012

Merge pull request #120 from kfjohnson/fix/master/16333-sqlmode
(#16333) Override function in AR MySQL connector to set sql_mode

@jeffweiss jeffweiss merged commit ceda4f9 into sodabrew:master Nov 26, 2012

Owner

sodabrew commented Nov 28, 2012

You inspired me to do this right: rails/rails#8346

Contributor

haus commented Nov 28, 2012

@sodabrew nice!

Contributor

kfjohnson commented Dec 6, 2012

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment