Documentation ¶
Index ¶
- Constants
- Variables
- func Compile(ctx context.Context, rawStmt ast.StmtNode) (ast.Statement, error)
- func GetRows(rs ast.RecordSet) ([][]types.Datum, error)
- func GetTPS() int64
- func IsQuery(sql string) bool
- func NewStore(path string) (kv.Storage, error)
- func Parse(ctx context.Context, src string) ([]ast.StmtNode, error)
- func RegisterDriver()
- func RegisterLocalStore(name string, driver engine.Driver) error
- func RegisterStore(name string, driver kv.Driver) error
- func SetSchemaLease(lease time.Duration)
- type Session
Constants ¶
const ( // CreateUserTable is the SQL statement creates User table in system db. CreateUserTable = `` /* 753-byte string literal not displayed */ // CreateDBPrivTable is the SQL statement creates DB scope privilege table in system db. CreateDBPrivTable = `` /* 628-byte string literal not displayed */ // CreateTablePrivTable is the SQL statement creates table scope privilege table in system db. CreateTablePrivTable = `` /* 379-byte string literal not displayed */ // CreateColumnPrivTable is the SQL statement creates column scope privilege table in system db. CreateColumnPrivTable = `` /* 299-byte string literal not displayed */ // CreateGloablVariablesTable is the SQL statement creates global variable table in system db. // TODO: MySQL puts GLOBAL_VARIABLES table in INFORMATION_SCHEMA db. // INFORMATION_SCHEMA is a virtual db in TiDB. So we put this table in system db. // Maybe we will put it back to INFORMATION_SCHEMA. CreateGloablVariablesTable = `` /* 147-byte string literal not displayed */ // CreateTiDBTable is the SQL statement creates a table in system db. // This table is a key-value struct contains some information used by TiDB. // Currently we only put bootstrapped in it which indicates if the system is already bootstrapped. CreateTiDBTable = `` /* 160-byte string literal not displayed */ )
const (
// DriverName is name of TiDB driver.
DriverName = "tidb"
)
const (
EngineGoLevelDBMemory = "memory://"
)
Engine prefix name
Variables ¶
var ( // EnablePprof indicates whether to enable HTTP Pprof or not. EnablePprof = os.Getenv("TIDB_PPROF") != "0" // PprofAddr is the pprof url. PprofAddr = "localhost:8888" )
Functions ¶
func NewStore ¶
NewStore creates a kv Storage with path.
The path must be a URL format 'engine://path?params' like the one for tidb.Open() but with the dbname cut off. Examples:
goleveldb://relative/path boltdb:///absolute/path hbase://zk1,zk2,zk3/hbasetbl?tso=127.0.0.1:1234
The engine should be registered before creating storage.
func RegisterDriver ¶
func RegisterDriver()
RegisterDriver registers TiDB driver. The name argument can be optionally prefixed by "engine://". In that case the prefix is recognized as a storage engine name.
The name argument can be optionally prefixed by "memory://". In that case the prefix is stripped before interpreting it as a name of a memory-only, volatile DB.
[0]: http://golang.org/pkg/database/sql/driver/
func RegisterLocalStore ¶
RegisterLocalStore registers a local kv storage with unique name and its associated engine Driver.
func RegisterStore ¶
RegisterStore registers a kv storage with unique name and its associated Driver.
func SetSchemaLease ¶
SetSchemaLease changes the default schema lease time for DDL. This function is very dangerous, don't use it if you really know what you do. SetSchemaLease only affects not local storage after bootstrapped.
Types ¶
type Session ¶
type Session interface { Status() uint16 // Flag of current status, such as autocommit LastInsertID() uint64 // Last inserted auto_increment id AffectedRows() uint64 // Affected rows by latest executed stmt Execute(sql string) ([]ast.RecordSet, error) // Execute a sql statement String() string // For debug FinishTxn(rollback bool) error // For execute prepare statement in binary protocol PrepareStmt(sql string) (stmtID uint32, paramCount int, fields []*ast.ResultField, err error) // Execute a prepared statement ExecutePreparedStmt(stmtID uint32, param ...interface{}) (ast.RecordSet, error) DropPreparedStmt(stmtID uint32) error SetClientCapability(uint32) // Set client capability flags SetConnectionID(uint64) Close() error Retry() error Auth(user string, auth []byte, salt []byte) bool }
Session context
Directories ¶
Path | Synopsis |
---|---|
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
|
Package ast is the abstract syntax tree parsed from a SQL statement by parser. |
forupdate
Package forupdate record information for "select ...
|
Package forupdate record information for "select ... |
store
|
|
tikv
Package tikv provides tcp connection to kvserver.
|
Package tikv provides tcp connection to kvserver. |
mock
Package mock is just for test only.
|
Package mock is just for test only. |