Documentation
¶
Index ¶
- Variables
- func AtomicWrite(path string, content []byte) error
- func ConnectDB(host string, port int, user string, password string) (*sql.DB, error)
- func EscapeIdentifier(s string) string
- func EscapePath(input string) string
- func ExtractTableNames(s ast.Node, currDB string) [][2]string
- func IsMemOrSysTable(dbTable [2]string) bool
- func IsSQLErrorUnretryable(err *mysql.MySQLError) bool
- func IsUnretryableError(err error) bool
- func ReadCreateDatabase(ctx context.Context, db *sql.DB, dbName string) (string, error)
- func ReadCreateTableViewSeq(ctx context.Context, db *sql.DB, dbName, tableViewSeqName string) (string, error)
- func ReadStrRowsByColumnName(rows *sql.Rows, columnNames []string) (fields [][]string, allFound bool, err error)
- func WrapUnretryableError(err error) error
- type ClusterInfo
Constants ¶
This section is empty.
Variables ¶
var Logger = log.L()
Functions ¶
func AtomicWrite ¶
AtomicWrite writes content to path atomically by using mv.
func EscapeIdentifier ¶
EscapeIdentifier escapes an MySQL identifier. TODO(lance6716): not all callers use it. And we can't process special characters?
func EscapePath ¶
EscapePath encodes special characters in a string to make it safe for use as a file system path.
func ExtractTableNames ¶
ExtractTableNames extracts all table names from a statement node.
func IsMemOrSysTable ¶
func IsSQLErrorUnretryable ¶
func IsSQLErrorUnretryable(err *mysql.MySQLError) bool
IsSQLErrorUnretryable checks the MySQL error to determine if it is unretryable. For errors we don't have confidence, we assume it is retryable so caller will execute the statement again in future.
func IsUnretryableError ¶
IsUnretryableError checks if an error is wrapped by WrapUnretryableError. It supports pingcap/errors package.
func ReadCreateDatabase ¶
func ReadCreateTableViewSeq ¶
func ReadCreateTableViewSeq( ctx context.Context, db *sql.DB, dbName, tableViewSeqName string, ) (string, error)
ReadCreateTableViewSeq reads the CREATE TABLE / VIEW / SEQUENCE statement from the database.
func ReadStrRowsByColumnName ¶
func ReadStrRowsByColumnName( rows *sql.Rows, columnNames []string, ) (fields [][]string, allFound bool, err error)
ReadStrRowsByColumnName reads given columns from sql.Rows. If not all columns are found, allFound will be false, given sql.Rows will not be read. Caller need to close rows after it returns.
func WrapUnretryableError ¶
WrapUnretryableError wraps an error to make it unretryable.
Types ¶
type ClusterInfo ¶
func ReadClusterInfo ¶
ReadClusterInfo reads the cluster information from the TiDB cluster.