# File lib/dbd_mysql/Mysql.rb, line 51 def connect(dbname, user, auth, attr) # connect to database hash = Utils.parse_params(dbname) #if hash['database'].nil? # raise DBI::InterfaceError, "must specify database" #end hash['host'] ||= 'localhost' # these two connection parameters should be passed as numbers hash['port'] = hash['port'].to_i unless hash['port'].nil? hash['flag'] = hash['flag'].to_i unless hash['flag'].nil? handle = ::Mysql.connect(hash['host'], user, auth, hash['database'], hash['port'], hash['socket'], hash['flag']) #handle.select_db(hash['database']) return Database.new(handle, attr) rescue MyError => err raise DBI::DatabaseError.new(err.message, err.errno) end