def connect(dbname, user, auth, attr)
hash = DBI::Utils.parse_params(dbname)
hash['host'] ||= 'localhost'
hash['port'] = hash['port'].to_i unless hash['port'].nil?
hash['flag'] = hash['flag'].nil? ? 0 : hash['flag'] = hash['flag'].to_i
handle = ::Mysql.init
!hash['mysql_read_default_file'].nil? and
handle.options(::Mysql::READ_DEFAULT_FILE,
hash['mysql_read_default_file'])
!hash['mysql_read_default_group'].nil? and
handle.options(::Mysql::READ_DEFAULT_GROUP,
hash['mysql_read_default_group'])
hash['mysql_compression'].to_i != 0 and
handle.options(::Mysql::OPT_COMPRESS, nil)
hash['mysql_local_infile'].to_i != 0 and
handle.options(::Mysql::OPT_LOCAL_INFILE, true)
if !hash['mysql_client_found_rows'].nil?
if hash['mysql_client_found_rows'].to_i != 0
hash['flag'] |= ::Mysql::CLIENT_FOUND_ROWS
else
hash['flag'] &= ~::Mysql::CLIENT_FOUND_ROWS
end
end
handle.connect(hash['host'], user, auth, hash['database'], hash['port'], hash['socket'], hash['flag'])
return Database.new(handle, attr)
rescue MyError => err
error(err)
end