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

Method DeallocateAll

conn.go:397–407  ·  view source on GitHub ↗

DeallocateAll releases all previously prepared statements from the server and client, where it also resets the statement and description cache.

(ctx context.Context)

Source from the content-addressed store, hash-verified

395
396// DeallocateAll releases all previously prepared statements from the server and client, where it also resets the statement and description cache.
397func (c *Conn) DeallocateAll(ctx context.Context) error {
398 c.preparedStatements = map[string]*pgconn.StatementDescription{}
399 if c.config.StatementCacheCapacity > 0 {
400 c.statementCache = stmtcache.NewLRUCache(c.config.StatementCacheCapacity)
401 }
402 if c.config.DescriptionCacheCapacity > 0 {
403 c.descriptionCache = stmtcache.NewLRUCache(c.config.DescriptionCacheCapacity)
404 }
405 _, err := c.pgConn.Exec(ctx, "deallocate all").ReadAll()
406 return err
407}
408
409func (c *Conn) bufferNotifications(_ *pgconn.PgConn, n *pgconn.Notification) {
410 c.notifications = append(c.notifications, n)

Callers 1

TestPrepareFunction · 0.80

Calls 3

NewLRUCacheFunction · 0.92
ReadAllMethod · 0.80
ExecMethod · 0.65

Tested by 1

TestPrepareFunction · 0.64