MCPcopy
hub / github.com/pingcap/tidb / LockTables

Function LockTables

dumpling/export/sql.go:734–738  ·  view source on GitHub ↗

LockTables locks table with read lock

(ctx context.Context, db *sql.Conn, database, table string)

Source from the content-addressed store, hash-verified

732
733// LockTables locks table with read lock
734func LockTables(ctx context.Context, db *sql.Conn, database, table string) error {
735 lockTableQuery := fmt.Sprintf("LOCK TABLES `%s`.`%s` READ", escapeString(database), escapeString(table))
736 _, err := db.ExecContext(ctx, lockTableQuery)
737 return errors.Annotatef(err, "sql: %s", lockTableQuery)
738}
739
740// UnlockTables unlocks all tables' lock
741func UnlockTables(ctx context.Context, db *sql.Conn) error {

Callers

nothing calls this directly

Calls 2

escapeStringFunction · 0.70
ExecContextMethod · 0.65

Tested by

no test coverage detected