fix: isPrintable incorrect
This commit is contained in:
		
							parent
							
								
									a0aceeb33e
								
							
						
					
					
						commit
						010ea95eb5
					
				@ -19,9 +19,9 @@ const (
 | 
				
			|||||||
	nullStr     = "NULL"
 | 
						nullStr     = "NULL"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func isPrintable(s []byte) bool {
 | 
					func isPrintable(s string) bool {
 | 
				
			||||||
	for _, r := range s {
 | 
						for _, r := range s {
 | 
				
			||||||
		if !unicode.IsPrint(rune(r)) {
 | 
							if !unicode.IsPrint(r) {
 | 
				
			||||||
			return false
 | 
								return false
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -84,7 +84,7 @@ func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, a
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		case []byte:
 | 
							case []byte:
 | 
				
			||||||
			if isPrintable(v) {
 | 
								if isPrintable(string(v)) {
 | 
				
			||||||
				vars[idx] = escaper + strings.Replace(string(v), escaper, "\\"+escaper, -1) + escaper
 | 
									vars[idx] = escaper + strings.Replace(string(v), escaper, "\\"+escaper, -1) + escaper
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				vars[idx] = escaper + "<binary>" + escaper
 | 
									vars[idx] = escaper + "<binary>" + escaper
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user