File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change
1
+
2
+ .DS_Store
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import (
12
12
"bufio"
13
13
"database/sql"
14
14
"database/sql/driver"
15
- "errors"
16
15
"net"
17
16
)
18
17
@@ -28,11 +27,6 @@ func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
28
27
mc := new (mysqlConn )
29
28
mc .cfg = parseDSN (dsn )
30
29
31
- if mc .cfg .dbname == "" {
32
- e = errors .New ("Incomplete or invalid DSN" )
33
- return nil , e
34
- }
35
-
36
30
// Connect to Server
37
31
mc .netConn , e = net .Dial (mc .cfg .net , mc .cfg .addr )
38
32
if e != nil {
Original file line number Diff line number Diff line change @@ -208,16 +208,19 @@ func (mc *mysqlConn) writeAuthPacket() (e error) {
208
208
if mc .server .flags & CLIENT_LONG_FLAG > 0 {
209
209
clientFlags |= uint32 (CLIENT_LONG_FLAG )
210
210
}
211
+
212
+ // User Password
213
+ scrambleBuff := scramblePassword (mc .server .scrambleBuff , []byte (mc .cfg .passwd ))
214
+
215
+ pktLen := 4 + 4 + 1 + 23 + len (mc .cfg .user ) + 1 + 1 + len (scrambleBuff )
216
+
211
217
// To specify a db name
212
218
if len (mc .cfg .dbname ) > 0 {
213
219
clientFlags |= uint32 (CLIENT_CONNECT_WITH_DB )
220
+ pktLen += len (mc .cfg .dbname ) + 1
214
221
}
215
222
216
- // User Password
217
- scrambleBuff := scramblePassword (mc .server .scrambleBuff , []byte (mc .cfg .passwd ))
218
-
219
223
// Calculate packet length and make buffer with that size
220
- pktLen := 4 + 4 + 1 + 23 + len (mc .cfg .user ) + 1 + 1 + len (scrambleBuff ) + len (mc .cfg .dbname ) + 1
221
224
data := make ([]byte , 0 , pktLen + 4 )
222
225
223
226
// Add the packet header
@@ -338,7 +341,7 @@ func (mc *mysqlConn) readResultOK() (e error) {
338
341
return mc .handleOkPacket (data )
339
342
// EOF, someone is using old_passwords
340
343
case 254 :
341
- e = errors .New ("It seems like you are using old_passwords, which is unsupported. See https ://github. com/Go-SQL-Driver/MySQL /wiki/old_passwords" )
344
+ e = errors .New ("It seems like you are using old_passwords, which is unsupported. See http ://code.google. com/p/go-mysql-driver /wiki/old_passwords" )
342
345
return
343
346
// ERROR
344
347
case 255 :
You can’t perform that action at this time.
0 commit comments