cockroach: github.com/cockroachdb/cockroach/pkg/sql/sqlutil Index | Files

package sqlutil

import "github.com/cockroachdb/cockroach/pkg/sql/sqlutil"

Index

Package Files

internal_executor.go

type InternalExecutor Uses

type InternalExecutor interface {
    // Exec executes the supplied SQL statement. Statements are currently executed
    // as the root user with the system database as current database.
    //
    // If txn is not nil, the statement will be executed in the respective txn.
    //
    // Returns the number of rows affected.
    Exec(
        ctx context.Context, opName string, txn *client.Txn, statement string, params ...interface{},
    ) (int, error)

    // Query executes the supplied SQL statement and returns the resulting rows.
    // The statement is executed as the root user.
    //
    // If txn is not nil, the statement will be executed in the respective txn.
    Query(
        ctx context.Context, opName string, txn *client.Txn, statement string, qargs ...interface{},
    ) ([]tree.Datums, error)

    // QueryWithCols executes the supplied SQL statement and returns the resulting
    // rows and their column types.
    // The statement is executed as the root user.
    //
    // If txn is not nil, the statement will be executed in the respective txn.
    QueryWithCols(
        ctx context.Context, opName string, txn *client.Txn, statement string, qargs ...interface{},
    ) ([]tree.Datums, sqlbase.ResultColumns, error)

    // QueryRow is like Query, except it returns a single row, or nil if not row is
    // found, or an error if more that one row is returned.
    QueryRow(
        ctx context.Context, opName string, txn *client.Txn, statement string, qargs ...interface{},
    ) (tree.Datums, error)
}

InternalExecutor is meant to be used by layers below SQL in the system that nevertheless want to execute SQL queries (presumably against system tables). It is extracted in this "sql/util" package to avoid circular references and is implemented by *sql.InternalExecutor.

Note that implementations might be "session bound" - meaning they inherit session variables from a parent session - or not.

type SessionBoundInternalExecutorFactory Uses

type SessionBoundInternalExecutorFactory func(
    context.Context, *sessiondata.SessionData,
) InternalExecutor

SessionBoundInternalExecutorFactory is a function that produces a "session bound" internal executor.

Package sqlutil imports 5 packages (graph) and is imported by 19 packages. Updated 2019-07-23. Refresh now. Tools for package owners.