lib/og/store/mysql.rb in og-0.28.0 vs lib/og/store/mysql.rb in og-0.29.0
- old
+ new
@@ -65,28 +65,10 @@
def escape(str)
return nil unless str
return Mysql.quote(str)
end
-
- def quote(val)
- case val
- when Fixnum, Integer, Float
- val ? val.to_s : 'NULL'
- when String
- val ? "'#{escape(val)}'" : 'NULL'
- when Time
- val ? "'#{timestamp(val)}'" : 'NULL'
- when Date
- val ? "'#{date(val)}'" : 'NULL'
- when TrueClass
- val ? "'1'" : 'NULL'
- else
- # gmosx: keep the '' for nil symbols.
- val ? escape(val.to_yaml) : ''
- end
- end
end
# A Store that persists objects into a MySQL database.
# To read documentation about the methods, consult
# the documentation for SqlStore and Store.
@@ -108,16 +90,18 @@
def self.create(options)
# gmosx: system is used to avoid shell expansion.
system 'mysqladmin', '-f', "--user=#{options[:user]}",
"--password=#{options[:password]}",
+ "--host=#{options[:address]}",
'create', options[:name]
super
end
def self.destroy(options)
system 'mysqladmin', '-f', "--user=#{options[:user]}",
"--password=#{options[:password]}", 'drop',
+ "--host=#{options[:address]}",
options[:name]
super
end
# Initialize the MySQL store.