sqlexec

package
v0.0.0-...-2bc18d8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: BSD-2-Clause, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestrictedSQLExecutor

type RestrictedSQLExecutor interface {
	// ExecRestrictedSQL run sql statement in ctx with some restriction.
	ExecRestrictedSQL(ctx context.Context, sql string) (ast.RecordSet, error)
}

RestrictedSQLExecutor is an interface provides executing restricted sql statement. Why we need this interface? When we execute some management statements, we need to operate system tables. For example when executing create user statement, we need to check if the user already exists in the mysql.User table and insert a new row if not exists. In this case, we need a convenience way to manipulate system tables. The most simple way is executing sql statement. In order to execute sql statement in stmts package, we add this interface to solve dependence problem. And in the same time, we do not want this interface becomes a general way to run sql statement. We hope this could be used with some restrictions such as only allowing system tables as target, do not allowing recursion call. For more information please refer to the comments in session.ExecRestrictedSQL(). This is implemented in session.go.

Jump to

Keyboard shortcuts

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