MCPcopy
hub / github.com/jackc/pgx / SanitizeSQL

Function SanitizeSQL

internal/sanitize/sanitize.go:514–520  ·  view source on GitHub ↗

SanitizeSQL replaces placeholder values with args. It quotes and escapes args as necessary. This function is only safe when standard_conforming_strings is on.

(sql string, args ...any)

Source from the content-addressed store, hash-verified

512// as necessary. This function is only safe when standard_conforming_strings is
513// on.
514func SanitizeSQL(sql string, args ...any) (string, error) {
515 query := queryPool.get()
516 query.init(sql)
517 defer queryPool.put(query)
518
519 return query.Sanitize(args...)
520}
521
522type pool[E any] struct {
523 p sync.Pool

Callers 2

BenchmarkSanitizeSQLFunction · 0.92

Calls 4

getMethod · 0.80
initMethod · 0.80
putMethod · 0.80
SanitizeMethod · 0.45

Tested by 1

BenchmarkSanitizeSQLFunction · 0.74