Print out failed query SQL and args with --debug flag

This commit is contained in:
Dan Sosedoff 2018-12-12 13:22:36 -06:00
parent aded63f76f
commit 474b99c6d5

View File

@ -2,6 +2,7 @@ package client
import (
"fmt"
"log"
neturl "net/url"
"reflect"
"regexp"
@ -368,9 +369,11 @@ func (client *Client) query(query string, args ...interface{}) (*Result, error)
rows, err := client.db.Queryx(query, args...)
if err != nil {
if command.Opts.Debug {
log.Println("Failed query:", query, "\nArgs:", args)
}
return nil, err
}
defer rows.Close()
cols, err := rows.Columns()