Permalink
Browse files

Add SET SQL_AUTO_IS_NULL=0 for mysql adapter

Signed-off-by: Piotr Usewicz <piotr@layer22.com>
  • Loading branch information...
1 parent 8c17e86 commit beef9cdd75e0663cd89f1341322ba778308c1141 Paweł Kondzior committed with Jan 12, 2009
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/rails_sequel/rails_sequel.rb
@@ -5,7 +5,11 @@ module SequelConnection
# Connects to database using constructed Database Connection URI
def self.connect
- Sequel.connect(options)
+ options = self.prepare_options
+ connection = Sequel.connect(options)
+ if options[:adapter] == 'mysql'
+ connection.execute("SET SQL_AUTO_IS_NULL=0")
+ end
end
# Returns loaded database.yml configuration for current environment
@@ -14,7 +18,7 @@ def self.config
end
# Constructs Database Connection URI
- def self.options
+ def self.prepare_options
options = {}
# Use SQLite by default

0 comments on commit beef9cd

Please sign in to comment.