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 ¶
- func IsPureDataQuery(n sql.Node) bool
- func NewSessionBuilder(provider *catalog.DatabaseProvider) func(ctx context.Context, conn *mysql.Conn, addr string) (sql.Session, error)
- func RemoveAllPipes(dataDir string) error
- func WrapHandler(provider *catalog.DatabaseProvider) server.HandlerWrapper
- type DuckBuilder
- type MyHandler
- func (h *MyHandler) ComInitDB(c *mysql.Conn, schemaName string) error
- func (h *MyHandler) ComMultiQuery(ctx context.Context, c *mysql.Conn, query string, callback mysql.ResultSpoolFn) (string, error)
- func (h *MyHandler) ComQuery(ctx context.Context, c *mysql.Conn, query string, callback mysql.ResultSpoolFn) error
- func (h *MyHandler) ConnectionClosed(c *mysql.Conn)
- type RequestModifier
- type ResultModifier
- type SQLRowIter
- type Session
- func (sess *Session) CloseConn()
- func (sess *Session) CloseTxn()
- func (sess *Session) CommitTransaction(ctx *sql.Context, tx sql.Transaction) error
- func (sess *Session) CurrentSchemaOfUnderlyingConn() string
- func (sess *Session) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)
- func (sess *Session) GetCatalogConn(ctx context.Context) (*stdsql.Conn, error)
- func (sess *Session) GetCatalogTxn(ctx context.Context, options *stdsql.TxOptions) (*stdsql.Tx, error)
- func (sess *Session) GetConn(ctx context.Context) (*stdsql.Conn, error)
- func (sess *Session) GetCurrentCatalog() string
- func (sess *Session) GetCurrentSchema() string
- func (sess *Session) GetPersistedValue(k string) (interface{}, error)
- func (sess *Session) GetTxn(ctx context.Context, options *stdsql.TxOptions) (*stdsql.Tx, error)
- func (sess *Session) PersistGlobal(sysVarName string, value interface{}) error
- func (sess *Session) Provider() *catalog.DatabaseProvider
- func (sess *Session) QueryRow(ctx context.Context, query string, args ...any) *stdsql.Row
- func (sess *Session) RemoveAllPersistedGlobals() error
- func (sess *Session) RemovePersistedGlobal(sysVarName string) error
- func (sess *Session) Rollback(ctx *sql.Context, tx sql.Transaction) error
- func (sess *Session) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error)
- func (sess *Session) TryGetTxn() *stdsql.Tx
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPureDataQuery ¶
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 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) CreatePipe ¶
func (*DuckBuilder) Provider ¶
func (b *DuckBuilder) Provider() *catalog.DatabaseProvider
type MyHandler ¶
func (*MyHandler) ComMultiQuery ¶
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 ¶
type RequestModifier ¶
type RequestModifier func(string, *[]ResultModifier) string
RequestModifier is a function type that transforms a query string
type ResultModifier ¶
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 ¶
type Session ¶
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 ¶
CommitTransaction implements sql.TransactionSession.
func (*Session) CurrentSchemaOfUnderlyingConn ¶
func (*Session) ExecContext ¶
func (*Session) GetCatalogConn ¶
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) GetCurrentCatalog ¶
GetCurrentCatalog implements adapter.ConnectionHolder.
func (*Session) GetCurrentSchema ¶
GetCurrentSchema implements adapter.ConnectionHolder.
func (*Session) GetPersistedValue ¶
GetPersistedValue implements sql.PersistableSession.
func (*Session) PersistGlobal ¶
PersistGlobal implements sql.PersistableSession.
func (*Session) Provider ¶
func (sess *Session) Provider() *catalog.DatabaseProvider
Provider returns the database provider for the session.
func (*Session) RemoveAllPersistedGlobals ¶
RemoveAllPersistedGlobals implements sql.PersistableSession.
func (*Session) RemovePersistedGlobal ¶
RemovePersistedGlobal implements sql.PersistableSession.
func (*Session) StartTransaction ¶
func (sess *Session) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error)
StartTransaction implements sql.TransactionSession.
type Transaction ¶
type Transaction struct {
memory.Transaction
// contains filtered or unexported fields
}