backend

package
v0.0.0-...-068cd59 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Copyright 2024-2025 ApeCloud, Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024-2025 ApeCloud, Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPureDataQuery

func IsPureDataQuery(n sql.Node) bool

IsPureDataQuery inspects if the plan is a pure data query, i.e., it operates on (>=1) data tables and does not touch any system tables. The following examples are NOT pure data queries: - `SELECT * FROM mysql.*` - `TRUNCATE mysql.user` - `SELECT DATABASE()`

func NewSessionBuilder

func NewSessionBuilder(provider *catalog.DatabaseProvider) func(ctx context.Context, conn *mysql.Conn, addr string) (sql.Session, error)

NewSessionBuilder returns a session builder for the given database provider.

func RemoveAllPipes

func RemoveAllPipes(dataDir string) error

func WrapHandler

func WrapHandler(provider *catalog.DatabaseProvider) server.HandlerWrapper

Types

type DuckBuilder

type DuckBuilder struct {
	FlushDeltaBuffer func() error
	// contains filtered or unexported fields
}

func NewDuckBuilder

func NewDuckBuilder(base sql.NodeExecBuilder, provider *catalog.DatabaseProvider) *DuckBuilder

func (*DuckBuilder) Build

func (b *DuckBuilder) Build(ctx *sql.Context, root sql.Node, r sql.Row) (sql.RowIter, error)

func (*DuckBuilder) CreatePipe

func (h *DuckBuilder) CreatePipe(ctx *sql.Context, subdir string) (string, error)

func (*DuckBuilder) Provider

func (b *DuckBuilder) Provider() *catalog.DatabaseProvider

type MyHandler

type MyHandler struct {
	*server.Handler
	// contains filtered or unexported fields
}

func (*MyHandler) ComInitDB

func (h *MyHandler) ComInitDB(c *mysql.Conn, schemaName string) error

func (*MyHandler) ComMultiQuery

func (h *MyHandler) ComMultiQuery(
	ctx context.Context,
	c *mysql.Conn,
	query string,
	callback mysql.ResultSpoolFn,
) (string, error)

func (*MyHandler) ComQuery

func (h *MyHandler) ComQuery(
	ctx context.Context,
	c *mysql.Conn,
	query string,
	callback mysql.ResultSpoolFn,
) error

Naive query rewriting. This is just a temporary solution and should be replaced with a more robust implementation.

func (*MyHandler) ConnectionClosed

func (h *MyHandler) ConnectionClosed(c *mysql.Conn)

type RequestModifier

type RequestModifier func(string, *[]ResultModifier) string

RequestModifier is a function type that transforms a query string

type ResultModifier

type ResultModifier func(*sqltypes.Result) *sqltypes.Result

ResultModifier transforms a Result.

type SQLRowIter

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

SQLRowIter wraps a standard sql.Rows as a RowIter.

func NewSQLRowIter

func NewSQLRowIter(rows *stdsql.Rows, schema sql.Schema) (*SQLRowIter, error)

func (*SQLRowIter) Close

func (iter *SQLRowIter) Close(ctx *sql.Context) error

Close closes the underlying sql.Rows.

func (*SQLRowIter) Next

func (iter *SQLRowIter) Next(ctx *sql.Context) (sql.Row, error)

Next retrieves the next row. It will return io.EOF if it's the last row.

type Session

type Session struct {
	*memory.Session
	// contains filtered or unexported fields
}

func NewSession

func NewSession(base *memory.Session, provider *catalog.DatabaseProvider) *Session

func (*Session) CloseConn

func (sess *Session) CloseConn()

CloseConn implements adapter.ConnectionHolder.

func (*Session) CloseTxn

func (sess *Session) CloseTxn()

CloseTxn implements adapter.ConnectionHolder.

func (*Session) CommitTransaction

func (sess *Session) CommitTransaction(ctx *sql.Context, tx sql.Transaction) error

CommitTransaction implements sql.TransactionSession.

func (*Session) CurrentSchemaOfUnderlyingConn

func (sess *Session) CurrentSchemaOfUnderlyingConn() string

func (*Session) ExecContext

func (sess *Session) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

func (*Session) GetCatalogConn

func (sess *Session) GetCatalogConn(ctx context.Context) (*stdsql.Conn, error)

GetCatalogConn implements adapter.ConnectionHolder.

func (*Session) GetCatalogTxn

func (sess *Session) GetCatalogTxn(ctx context.Context, options *stdsql.TxOptions) (*stdsql.Tx, error)

GetCatalogTxn implements adapter.ConnectionHolder.

func (*Session) GetConn

func (sess *Session) GetConn(ctx context.Context) (*stdsql.Conn, error)

GetConn implements adapter.ConnectionHolder.

func (*Session) GetCurrentCatalog

func (sess *Session) GetCurrentCatalog() string

GetCurrentCatalog implements adapter.ConnectionHolder.

func (*Session) GetCurrentSchema

func (sess *Session) GetCurrentSchema() string

GetCurrentSchema implements adapter.ConnectionHolder.

func (*Session) GetPersistedValue

func (sess *Session) GetPersistedValue(k string) (interface{}, error)

GetPersistedValue implements sql.PersistableSession.

func (*Session) GetTxn

func (sess *Session) GetTxn(ctx context.Context, options *stdsql.TxOptions) (*stdsql.Tx, error)

GetTxn implements adapter.ConnectionHolder.

func (*Session) PersistGlobal

func (sess *Session) PersistGlobal(sysVarName string, value interface{}) error

PersistGlobal implements sql.PersistableSession.

func (*Session) Provider

func (sess *Session) Provider() *catalog.DatabaseProvider

Provider returns the database provider for the session.

func (*Session) QueryRow

func (sess *Session) QueryRow(ctx context.Context, query string, args ...any) *stdsql.Row

func (*Session) RemoveAllPersistedGlobals

func (sess *Session) RemoveAllPersistedGlobals() error

RemoveAllPersistedGlobals implements sql.PersistableSession.

func (*Session) RemovePersistedGlobal

func (sess *Session) RemovePersistedGlobal(sysVarName string) error

RemovePersistedGlobal implements sql.PersistableSession.

func (*Session) Rollback

func (sess *Session) Rollback(ctx *sql.Context, tx sql.Transaction) error

Rollback implements sql.TransactionSession.

func (*Session) StartTransaction

func (sess *Session) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error)

StartTransaction implements sql.TransactionSession.

func (*Session) TryGetTxn

func (sess *Session) TryGetTxn() *stdsql.Tx

TryGetTxn implements adapter.ConnectionHolder.

type Transaction

type Transaction struct {
	memory.Transaction
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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