debug postgre

This commit is contained in:
tiancai
2020-07-20 19:13:15 +08:00
parent 7bbc2459ba
commit d44ddae3dc
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ func (d *DriverPgsql) GetChars() (charLeft string, charRight string) {
// HandleSqlBeforeCommit deals with the sql string before commits it to underlying sql driver.
func (d *DriverPgsql) HandleSqlBeforeCommit(link Link, sql string, args []interface{}) (string, []interface{}) {
var index int
// Convert place holder char '?' to string "$vx".
// Convert place holder char '?' to string "$x".
sql, _ = gregex.ReplaceStringFunc("\\?", sql, func(s string) string {
index++
return fmt.Sprintf("$%d", index)

View File

@ -553,7 +553,7 @@ func formatError(err error, sql string, args ...interface{}) error {
func FormatSqlWithArgs(sql string, args []interface{}) string {
index := -1
newQuery, _ := gregex.ReplaceStringFunc(
`(\?|:v\d+|\$v\d+|@v\d+)`, sql, func(s string) string {
`(\?|:v\d+|\$\d+|@v\d+)`, sql, func(s string) string {
index++
if len(args) > index {
if args[index] == nil {