@@ -164,7 +164,7 @@ func (c *conn) handlePgpass(o values) {
164
164
return
165
165
}
166
166
mode := fileinfo .Mode ()
167
- if mode & (0x77 ) != 0 {
167
+ if mode & (0x77 ) != 0 {
168
168
// XXX should warn about incorrect .pgpass permissions as psql does
169
169
return
170
170
}
@@ -180,7 +180,7 @@ func (c *conn) handlePgpass(o values) {
180
180
db := o .Get ("dbname" )
181
181
username := o .Get ("user" )
182
182
// From: https://github.com/tg/pgpass/blob/master/reader.go
183
- getFields := func (s string ) []string {
183
+ getFields := func (s string ) []string {
184
184
fs := make ([]string , 0 , 5 )
185
185
f := make ([]rune , 0 , len (s ))
186
186
@@ -200,7 +200,7 @@ func (c *conn) handlePgpass(o values) {
200
200
}
201
201
}
202
202
return append (fs , string (f ))
203
- }
203
+ }
204
204
for scanner .Scan () {
205
205
line := scanner .Text ()
206
206
if len (line ) == 0 || line [0 ] == '#' {
@@ -210,7 +210,7 @@ func (c *conn) handlePgpass(o values) {
210
210
if len (split ) != 5 {
211
211
continue
212
212
}
213
- if (split [0 ] == "*" || split [0 ] == hostname || (split [0 ] == "localhost" && (hostname == "" || ntw == "unix" ))) && (split [1 ] == "*" || split [1 ] == port ) && (split [2 ] == "*" || split [2 ] == db ) && (split [3 ] == "*" || split [3 ] == username ) {
213
+ if (split [0 ] == "*" || split [0 ] == hostname || (split [0 ] == "localhost" && (hostname == "" || ntw == "unix" ))) && (split [1 ] == "*" || split [1 ] == port ) && (split [2 ] == "*" || split [2 ] == db ) && (split [3 ] == "*" || split [3 ] == username ) {
214
214
o ["password" ] = split [4 ]
215
215
return
216
216
}
@@ -614,8 +614,6 @@ func (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, err
614
614
func (cn * conn ) simpleQuery (q string ) (res * rows , err error ) {
615
615
defer cn .errRecover (& err )
616
616
617
- st := & stmt {cn : cn , name : "" }
618
-
619
617
b := cn .writeBuf ('Q' )
620
618
b .string (q )
621
619
cn .send (b )
@@ -634,10 +632,7 @@ func (cn *conn) simpleQuery(q string) (res *rows, err error) {
634
632
}
635
633
if res == nil {
636
634
res = & rows {
637
- cn : cn ,
638
- colNames : st .colNames ,
639
- colTyps : st .colTyps ,
640
- colFmts : st .colFmts ,
635
+ cn : cn ,
641
636
}
642
637
}
643
638
res .done = true
0 commit comments