Print out failed query SQL and args with --debug flag
This commit is contained in:
parent
aded63f76f
commit
474b99c6d5
@ -2,6 +2,7 @@ package client
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
neturl "net/url"
|
neturl "net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -368,9 +369,11 @@ func (client *Client) query(query string, args ...interface{}) (*Result, error)
|
|||||||
|
|
||||||
rows, err := client.db.Queryx(query, args...)
|
rows, err := client.db.Queryx(query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if command.Opts.Debug {
|
||||||
|
log.Println("Failed query:", query, "\nArgs:", args)
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
cols, err := rows.Columns()
|
cols, err := rows.Columns()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user