(sql string, args ...any)
| 1258 | } |
| 1259 | |
| 1260 | func (c *Conn) sanitizeForSimpleQuery(sql string, args ...any) (string, error) { |
| 1261 | if c.pgConn.ParameterStatus("standard_conforming_strings") != "on" { |
| 1262 | return "", errors.New("simple protocol queries must be run with standard_conforming_strings=on") |
| 1263 | } |
| 1264 | |
| 1265 | if c.pgConn.ParameterStatus("client_encoding") != "UTF8" { |
| 1266 | return "", errors.New("simple protocol queries must be run with client_encoding=UTF8") |
| 1267 | } |
| 1268 | |
| 1269 | var err error |
| 1270 | valueArgs := make([]any, len(args)) |
| 1271 | for i, a := range args { |
| 1272 | valueArgs[i], err = convertSimpleArgument(c.typeMap, a) |
| 1273 | if err != nil { |
| 1274 | return "", err |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | return sanitize.SanitizeSQL(sql, valueArgs...) |
| 1279 | } |
| 1280 | |
| 1281 | // LoadType inspects the database for typeName and produces a [pgtype.Type] suitable for registration. typeName must be |
| 1282 | // the name of a type where the underlying type(s) is already understood by pgx. It is for derived types. In particular, |
no test coverage detected