Skip to content

Commit 0a17480

Browse files
committed
Merge pull request #96 from go-sql-driver/clean-up
Clean up
2 parents 0693aa5 + c385eff commit 0a17480

10 files changed

+145
-177
lines changed

.gitattributes

-1
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A MySQL-Driver for Go's [database/sql](http://golang.org/pkg/database/sql) packa
4040
* Optional `time.Time` parsing
4141

4242
## Requirements
43-
* Go 1.0.3 or higher
43+
* Go 1.1 or higher (use [v1.0](https://github.com/go-sql-driver/mysql/tags) for Go 1.0.x)
4444
* MySQL (Version 4.1 or higher), MariaDB or Percona Server
4545

4646
---------------------------------------

connection.go

+11-13
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ type mysqlConn struct {
3535
}
3636

3737
type config struct {
38-
user string
39-
passwd string
40-
net string
41-
addr string
42-
dbname string
43-
params map[string]string
44-
loc *time.Location
45-
timeout time.Duration
46-
tls *tls.Config
38+
user string
39+
passwd string
40+
net string
41+
addr string
42+
dbname string
43+
params map[string]string
44+
loc *time.Location
45+
timeout time.Duration
46+
tls *tls.Config
47+
allowAllFiles bool
48+
clientFoundRows bool
4749
}
4850

4951
// Handles parameters set in DSN
@@ -64,10 +66,6 @@ func (mc *mysqlConn) handleParams() (err error) {
6466
return
6567
}
6668

67-
// handled elsewhere
68-
case "allowAllFiles", "clientFoundRows":
69-
continue
70-
7169
// time.Time parsing
7270
case "parseTime":
7371
mc.parseTime = readBool(val)

driver.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@ func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
3333
}
3434

3535
// Connect to Server
36-
if mc.cfg.timeout > 0 { // with timeout
37-
if err == nil {
38-
mc.netConn, err = net.DialTimeout(mc.cfg.net, mc.cfg.addr, mc.cfg.timeout)
39-
}
40-
} else { // no timeout
41-
mc.netConn, err = net.Dial(mc.cfg.net, mc.cfg.addr)
42-
}
36+
nd := net.Dialer{Timeout: mc.cfg.timeout}
37+
mc.netConn, err = nd.Dial(mc.cfg.net, mc.cfg.addr)
4338
if err != nil {
4439
return nil, err
4540
}

0 commit comments

Comments
 (0)