(in string)
| 403 | } |
| 404 | |
| 405 | func prepareQueryForDisplay(in string) string { |
| 406 | out := make([]byte, 0, len(in)) |
| 407 | |
| 408 | offset := 0 |
| 409 | whitespace := true |
| 410 | placeholders := 1 |
| 411 | |
| 412 | for i := 0; i < len(in); i++ { |
| 413 | if in[i] == ' ' || in[i] == '\r' || in[i] == '\n' || in[i] == '\t' { |
| 414 | if whitespace { |
| 415 | offset = i |
| 416 | } else { |
| 417 | whitespace = true |
| 418 | out = append(out, in[offset:i]...) |
| 419 | offset = i |
| 420 | } |
| 421 | continue |
| 422 | } |
| 423 | if whitespace { |
| 424 | whitespace = false |
| 425 | if len(out) > 0 { |
| 426 | out = append(out, ' ') |
| 427 | } |
| 428 | offset = i |
| 429 | } |
| 430 | if in[i] == '?' { |
| 431 | out = append(out, in[offset:i]...) |
| 432 | offset = i + 1 |
| 433 | |
| 434 | out = append(out, '$') |
| 435 | out = append(out, strconv.Itoa(placeholders)...) |
| 436 | placeholders++ |
| 437 | } |
| 438 | } |
| 439 | if !whitespace { |
| 440 | out = append(out, in[offset:]...) |
| 441 | } |
| 442 | return string(out) |
| 443 | } |
| 444 | |
| 445 | func (iter *iterator) NextScan(dst ...interface{}) error { |
| 446 | if ok := iter.Next(); ok { |
no outgoing calls