engine

package
v0.40.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectDBs

func CollectDBs(ctx context.Context, mrEnv *env.MultiRepoEnv) ([]sqle.SqlDatabase, error)

CollectDBs takes a MultiRepoEnv and creates Database objects from each environment and returns a slice of these objects.

func GetCommitHooks

func GetCommitHooks(ctx context.Context, dEnv *env.DoltEnv) ([]doltdb.CommitHook, error)

GetCommitHooks creates a list of hooks to execute on database commit. If doltdb.SkipReplicationErrorsKey is set, replace misconfigured hooks with doltdb.LogHook instances that prints a warning when trying to execute.

func PrettyPrintResults

func PrettyPrintResults(ctx *sql.Context, resultFormat PrintResultFormat, sqlSch sql.Schema, rowIter sql.RowIter, hasTopLevelOrderBy bool) (rerr error)

PrettyPrintResults prints the result of a query (schema + row iter).

Types

type PrintResultFormat

type PrintResultFormat byte
const (
	FormatTabular PrintResultFormat = iota
	FormatCsv
	FormatJson
	FormatNull // used for profiling
	FormatVertical
)

type SqlEngine

type SqlEngine struct {
	// contains filtered or unexported fields
}

SqlEngine packages up the context necessary to run sql queries against dsqle.

func NewRebasedSqlEngine

func NewRebasedSqlEngine(engine *gms.Engine, dbs map[string]dsqle.SqlDatabase) *SqlEngine

NewRebasedEngine returns a smalled rebased engine primarily used in filterbranch.

func NewSqlEngine

func NewSqlEngine(
	ctx context.Context,
	mrEnv *env.MultiRepoEnv,
	format PrintResultFormat,
	initialDb string,
	isReadOnly bool,
	tempUsers []gms.TemporaryUser,
	autocommit bool) (*SqlEngine, error)

NewSqlEngine returns a SqlEngine

func (*SqlEngine) Analyze

func (se *SqlEngine) Analyze(ctx *sql.Context, n sql.Node) (sql.Node, error)

Analyze analyzes a node.

func (*SqlEngine) Close

func (se *SqlEngine) Close() error

func (*SqlEngine) Dbddl

func (se *SqlEngine) Dbddl(ctx *sql.Context, dbddl *sqlparser.DBDDL, query string) (sql.Schema, sql.RowIter, error)

TODO: All of this logic should be moved to the engine...

func (*SqlEngine) GetReturnFormat

func (se *SqlEngine) GetReturnFormat() PrintResultFormat

GetReturnFormat() returns the printing format the engine is associated with.

func (*SqlEngine) GetRoots

func (se *SqlEngine) GetRoots(sqlCtx *sql.Context) (map[string]*doltdb.RootValue, error)

GetRoots returns the underlying roots values the engine read/writes to.

func (*SqlEngine) GetUnderlyingEngine

func (se *SqlEngine) GetUnderlyingEngine() *gms.Engine

func (*SqlEngine) IterDBs

func (se *SqlEngine) IterDBs(cb func(name string, db dsqle.SqlDatabase) (stop bool, err error)) error

IterDBs iterates over the set of databases the engine wraps.

func (*SqlEngine) NewContext

func (se *SqlEngine) NewContext(ctx context.Context) (*sql.Context, error)

NewContext converts a context.Context to a sql.Context.

func (*SqlEngine) NewDoltSession

func (se *SqlEngine) NewDoltSession(ctx context.Context, mysqlSess *sql.BaseSession) (*dsess.DoltSession, error)

func (*SqlEngine) Query

func (se *SqlEngine) Query(ctx *sql.Context, query string) (sql.Schema, sql.RowIter, error)

Query execute a SQL statement and return values for printing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL