# File lib/dbd/mysql/driver.rb, line 30
30:         def connect(dbname, user, auth, attr)
31:             # connect to database server
32:             hash = DBI::Utils.parse_params(dbname)
33: 
34:             hash['host'] ||= 'localhost'
35: 
36:             # these two connection parameters should be passed as numbers
37:             hash['port'] = hash['port'].to_i unless hash['port'].nil?
38:             hash['flag'] = hash['flag'].nil? ? 0 : hash['flag'] = hash['flag'].to_i
39: 
40:             handle = ::Mysql.init
41: 
42:             # Look for options in connect string to be handled
43:             # through mysql_options() before connecting
44:             !hash['mysql_read_default_file'].nil? and
45:             handle.options(::Mysql::READ_DEFAULT_FILE,
46:                            hash['mysql_read_default_file'])
47:             !hash['mysql_read_default_group'].nil? and
48:             handle.options(::Mysql::READ_DEFAULT_GROUP,
49:                            hash['mysql_read_default_group'])
50:             # The following options can be handled either using mysql_options()
51:             # or in the flag argument to connect().
52:             hash['mysql_compression'].to_i != 0 and
53:             handle.options(::Mysql::OPT_COMPRESS, nil)
54:             hash['mysql_local_infile'].to_i != 0 and
55:             handle.options(::Mysql::OPT_LOCAL_INFILE, true)
56: 
57:             # Look for options to be handled in the flags argument to connect()
58:             if !hash['mysql_client_found_rows'].nil?
59:                 if hash['mysql_client_found_rows'].to_i != 0
60:                     hash['flag'] |= ::Mysql::CLIENT_FOUND_ROWS
61:                 else
62:                     hash['flag'] &= ~::Mysql::CLIENT_FOUND_ROWS
63:                 end
64:             end
65: 
66:             handle.connect(hash['host'], user, auth, hash['database'], hash['port'], hash['socket'], hash['flag'])
67: 
68:             return Database.new(handle, attr)
69:         rescue MyError => err
70:             error(err)
71:         end