sqlbackend

package
v0.1.2-alpha05 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MPL-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 DefaultExtendedQueryBackend

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

DefaultExtendedQueryBackend provides a default implementation of IExtendedQueryBackend that delegates execution to the simple query path. This is used when the backend does not natively support extended queries.

func (*DefaultExtendedQueryBackend) HandleBind

func (d *DefaultExtendedQueryBackend) HandleBind(ctx context.Context, portalName string, stmtName string, paramFormats []int16, paramValues [][]byte, resultFormats []int16) error

func (*DefaultExtendedQueryBackend) HandleClosePortal

func (d *DefaultExtendedQueryBackend) HandleClosePortal(ctx context.Context, portalName string) error

func (*DefaultExtendedQueryBackend) HandleCloseStatement

func (d *DefaultExtendedQueryBackend) HandleCloseStatement(ctx context.Context, stmtName string) error

func (*DefaultExtendedQueryBackend) HandleDescribePortal

func (d *DefaultExtendedQueryBackend) HandleDescribePortal(ctx context.Context, portalName string, stmtName string, query string, paramOIDs []uint32) ([]sqldata.ISQLColumn, error)

func (*DefaultExtendedQueryBackend) HandleDescribeStatement

func (d *DefaultExtendedQueryBackend) HandleDescribeStatement(ctx context.Context, stmtName string, query string, paramOIDs []uint32) ([]uint32, []sqldata.ISQLColumn, error)

func (*DefaultExtendedQueryBackend) HandleExecute

func (d *DefaultExtendedQueryBackend) HandleExecute(ctx context.Context, portalName string, stmtName string, query string, paramFormats []int16, paramValues [][]byte, resultFormats []int16, maxRows int32) (sqldata.ISQLResultStream, error)

func (*DefaultExtendedQueryBackend) HandleParse

func (d *DefaultExtendedQueryBackend) HandleParse(ctx context.Context, stmtName string, query string, paramOIDs []uint32) ([]uint32, error)

type IExtendedQueryBackend

type IExtendedQueryBackend interface {
	// HandleParse prepares a SQL statement for later execution.
	// paramOIDs may contain zeros for unspecified parameter types.
	HandleParse(ctx context.Context, stmtName string, query string, paramOIDs []uint32) ([]uint32, error)

	// HandleBind binds parameter values to a prepared statement, creating a portal.
	HandleBind(ctx context.Context, portalName string, stmtName string, paramFormats []int16, paramValues [][]byte, resultFormats []int16) error

	// HandleDescribeStatement returns parameter type OIDs and result column metadata
	// for a prepared statement.
	HandleDescribeStatement(ctx context.Context, stmtName string, query string, paramOIDs []uint32) ([]uint32, []sqldata.ISQLColumn, error)

	// HandleDescribePortal returns result column metadata for a bound portal.
	HandleDescribePortal(ctx context.Context, portalName string, stmtName string, query string, paramOIDs []uint32) ([]sqldata.ISQLColumn, error)

	// HandleExecute executes a bound portal and returns a result stream.
	// maxRows of 0 means unlimited.
	HandleExecute(ctx context.Context, portalName string, stmtName string, query string, paramFormats []int16, paramValues [][]byte, resultFormats []int16, maxRows int32) (sqldata.ISQLResultStream, error)

	// HandleCloseStatement closes a prepared statement.
	HandleCloseStatement(ctx context.Context, stmtName string) error

	// HandleClosePortal closes a portal.
	HandleClosePortal(ctx context.Context, portalName string) error
}

IExtendedQueryBackend provides extended query protocol support. Backends that implement this interface (in addition to ISQLBackend) can handle prepared statements, parameter binding, and describe operations.

If an ISQLBackend does not implement this interface, the wire server will use a default implementation that delegates Execute to HandleSimpleQuery.

func NewDefaultExtendedQueryBackend

func NewDefaultExtendedQueryBackend(backend ISQLBackend) IExtendedQueryBackend

type ISQLBackend

type ISQLBackend interface {
	HandleSimpleQuery(context.Context, string) (sqldata.ISQLResultStream, error)
	SplitCompoundQuery(string) ([]string, error)
	GetDebugStr() string
}

func NewSimpleSQLBackend

func NewSimpleSQLBackend(simpleCallback QueryCallback) ISQLBackend

TODO: debug message handling

type QueryCallback

type QueryCallback func(context.Context, string) (sqldata.ISQLResultStream, error)

type SQLBackendFactory

type SQLBackendFactory interface {
	NewSQLBackend() (ISQLBackend, error)
}

func NewSimpleSQLBackendFactory

func NewSimpleSQLBackendFactory(simpleCallback QueryCallback) SQLBackendFactory

type SimpleSQLBackend

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

func (*SimpleSQLBackend) GetDebugStr

func (sb *SimpleSQLBackend) GetDebugStr() string

func (*SimpleSQLBackend) HandleSimpleQuery

func (sb *SimpleSQLBackend) HandleSimpleQuery(ctx context.Context, query string) (sqldata.ISQLResultStream, error)

func (*SimpleSQLBackend) SplitCompoundQuery

func (sb *SimpleSQLBackend) SplitCompoundQuery(s string) ([]string, error)

Jump to

Keyboard shortcuts

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