Documentation ¶
Index ¶
- Constants
- Variables
- func NewMysqlBoundValue(data []byte, format base.BoundValueFormat, paramType base_mysql.Type) (base.BoundValue, int, error)
- func NewMysqlCopyTextBoundValue(data []byte, format base.BoundValueFormat, paramType base_mysql.Type) base.BoundValue
- func NewProxyFactory(proxySetting base.ProxySetting, store keystore.DecryptionKeyStore, ...) (base.ProxyFactory, error)
- func NewQueryInterruptedError(isProtocol41 bool, msg string) []byte
- type BaseMySQLDataProcessor
- type ByteArrayDump
- type Capabilities
- func (c *Capabilities) IsClientDeprecateEOF() bool
- func (c *Capabilities) IsClientSetProtocol41() bool
- func (c *Capabilities) IsSSLRequest() bool
- func (c *Capabilities) IsSetMariaDBCacheMetadata() bool
- func (c *Capabilities) IsSetMariaDBClientExtendedTypeInfo() bool
- func (c *Capabilities) IsSetProtocol41() bool
- func (c *Capabilities) SetClientCapabilities(cap, extendedCap uint32)
- func (c *Capabilities) SetServerCapabilities(cap, extendedCap uint32)
- type ColumnDescription
- type DataDecoderProcessor
- type DataEncoderProcessor
- type DataTypeFormat
- func (p *DataTypeFormat) GetColumnName() string
- func (p *DataTypeFormat) GetDBDataTypeID() uint32
- func (p *DataTypeFormat) GetDefaultDataValue() *string
- func (p *DataTypeFormat) GetResponseOnFail() common.ResponseOnFail
- func (p *DataTypeFormat) IsBinaryDataOperation() bool
- func (p *DataTypeFormat) IsBinaryFormat() bool
- type Dumper
- type Flags
- type Handler
- func (handler *Handler) AddClientIDObserver(observer base.ClientIDObserver)
- func (handler *Handler) AddQueryObserver(obs mysql.QueryObserver)
- func (handler *Handler) PreparedStatementResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
- func (handler *Handler) ProxyClientConnection(ctx context.Context, errCh chan<- base.ProxyError)
- func (handler *Handler) ProxyDatabaseConnection(ctx context.Context, errCh chan<- base.ProxyError)
- func (handler *Handler) QueryResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
- func (handler *Handler) RegisteredObserversCount() int
- func (handler *Handler) ResetStatementResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
- func (handler *Handler) SubscribeOnAllColumnsDecryption(subscriber base.DecryptionSubscriber)
- func (handler *Handler) Unsubscribe(subscriber base.DecryptionSubscriber)
- type MySQLPreparedStatement
- type Packet
- func (packet *Packet) Dump() []byte
- func (packet *Packet) GetBindParameters(paramNum int) ([]base.BoundValue, error)
- func (packet *Packet) GetData() []byte
- func (packet *Packet) GetPacketPayloadLength() int
- func (packet *Packet) GetSequenceNumber() byte
- func (packet *Packet) IsEOF() bool
- func (packet *Packet) IsErr() bool
- func (packet *Packet) IsOK() bool
- func (packet *Packet) ReadPacket(connection net.Conn) error
- func (packet *Packet) SetData(newData []byte)
- func (packet *Packet) SetParameters(values []base.BoundValue) (err error)
- type PrepareStatementResponse
- type PreparedStatement
- type PreparedStatementFieldTracker
- type PreparedStatementItem
- type PreparedStatementRegistry
- type PreparedStatementsQuery
- func (e *PreparedStatementsQuery) ID() string
- func (e *PreparedStatementsQuery) OnBind(ctx context.Context, statement sqlparser.Statement, values []base.BoundValue) ([]base.BoundValue, bool, error)
- func (e *PreparedStatementsQuery) OnColumn(ctx context.Context, data []byte) (context.Context, []byte, error)
- func (e *PreparedStatementsQuery) OnQuery(ctx context.Context, query mysql.OnQueryObject) (mysql.OnQueryObject, bool, error)
- func (e *PreparedStatementsQuery) SetDataEncryptor(dataEncryptor encryptor.DataEncryptor)
- type ProtocolState
- type ResponseHandler
- type SQLError
- type TypeConfiguration
Constants ¶
const ( BlobFlag = 1 << 4 NoDefaultValueFlag = 1 << 12 )
const ( // https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html#error_er_query_interrupted ErQueryInterruptedCode = 1317 ErQueryInterruptedState = "70100" )
Interrupted code constants.
const ( // ClientProtocol41 - https://dev.mysql.com/doc/internals/en/capability-flags.html#flag-CLIENT_PROTOCOL_41 ClientProtocol41 = 0x00000200 // SslRequest - https://dev.mysql.com/doc/internals/en/capability-flags.html#flag-CLIENT_SSL SslRequest = 0x00000800 // ClientDeprecateEOF - https://dev.mysql.com/doc/dev/mysql-server/latest/group__group__cs__capabilities__flags.html#gaad8e6e886899e90e820d6c2e0248469d- 0x1000000 ClientDeprecateEOF = 0x01000000 // MARIADB_CLIENT_EXTENDED_TYPE_INFO - https://mariadb.com/kb/en/connection/#capabilities- MariaDBClientExtendedTypeInfo = 0x8 // MARIADB_CLIENT_CACHE_METADATA - https://mariadb.com/kb/en/connection/#capabilities- MariaDBClientCacheMetadata = 0x10 )
MySQL protocol capability flags https://dev.mysql.com/doc/internals/en/capability-flags.html
const ( // OkPacket - https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html OkPacket = 0x00 // EOFPacket - https://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html EOFPacket = 0xfe ErrPacket = 0xff )
MySQL packets significant bytes.
const ( // PacketHeaderSize https://dev.mysql.com/doc/internals/en/mysql-packet.html#idm140406396409840 PacketHeaderSize = 4 // SequenceIDIndex last byte of header https://dev.mysql.com/doc/internals/en/mysql-packet.html#idm140406396409840 SequenceIDIndex = 3 )
const ( // MaxPayloadLen https://dev.mysql.com/doc/internals/en/mysql-packet.html // each packet splits into packets of this size MaxPayloadLen int = 1<<24 - 1 // ClientWaitDbTLSHandshake shows max time to wait for database TLS handshake ClientWaitDbTLSHandshake = 5 // MariaDBDirectStatementID - https://mariadb.com/kb/en/com_stmt_execute/#specific-1-statement-id-value MariaDBDirectStatementID = 0xFFFFFFFF )
const ( CommandQuit byte CommandQuery CommandStatementPrepare CommandStatementExecute CommandStatementSendLongData CommandStatementClose CommandStatementReset )
Possible commands comment unused to avoid linter's warnings abous unused constant but leave correct order to re-use it in a future
const PreparedStatementResponseLength = 12
PreparedStatementResponseLength MySQL prepared statement response packet length
const QueryExecutionWasInterrupted = "Query execution was interrupted"
QueryExecutionWasInterrupted is a default message of the mysql's Query interrupted error
Variables ¶
var ( ErrPreparedStatementNotSupported = errors.New("prepared statements are not used by DB server") ErrInvalidResponseLength = errors.New("invalid prepared statement response format") )
MySQL prepared statement response errors
var ErrStatementNotFound = errors.New("no prepared statement with given statement-id")
ErrStatementNotFound Err returned by prepared statement registry.
var ErrStatementNotPresentInRegistry = errors.New("prepared statement not present in registry")
ErrStatementNotPresentInRegistry represent an error that prepared statement already exist in session registry
var TypeConfigurations = map[base_mysql.Type]TypeConfiguration{ base_mysql.TypeString: { Charset: 8, ColumnLength: 255, }, base_mysql.TypeLong: { Charset: 63, ColumnLength: 9, }, base_mysql.TypeLongLong: { Charset: 63, ColumnLength: 20, }, base_mysql.TypeBlob: { Charset: 63, ColumnLength: 65535, }, }
TypeConfigurations contains specific info for used in TA types supported charset - https://mariadb.com/kb/en/supported-character-sets-and-collations/ SELECT id, collation_name FROM information_schema.collations ORDER BY id;
Functions ¶
func NewMysqlBoundValue ¶
func NewMysqlBoundValue(data []byte, format base.BoundValueFormat, paramType base_mysql.Type) (base.BoundValue, int, error)
NewMysqlBoundValue create base.BoundValue implementation object based on provided data and paramType
func NewMysqlCopyTextBoundValue ¶
func NewMysqlCopyTextBoundValue(data []byte, format base.BoundValueFormat, paramType base_mysql.Type) base.BoundValue
NewMysqlCopyTextBoundValue create base.BoundValue with copied input data
func NewProxyFactory ¶
func NewProxyFactory(proxySetting base.ProxySetting, store keystore.DecryptionKeyStore, tokenizer common.Pseudoanonymizer) (base.ProxyFactory, error)
NewProxyFactory return new proxyFactory
func NewQueryInterruptedError ¶
NewQueryInterruptedError return packed QueryInterrupted error https://dev.mysql.com/doc/internals/en/packet-ERR_Packet.html
Types ¶
type BaseMySQLDataProcessor ¶
type BaseMySQLDataProcessor struct{}
BaseMySQLDataProcessor implements processor and encode/decode binary intX values to text format which acceptable by Tokenizer
type Capabilities ¶
Capabilities represent list of capabilities between client and server
func (*Capabilities) IsClientDeprecateEOF ¶
func (c *Capabilities) IsClientDeprecateEOF() bool
IsClientDeprecateEOF return true if flag set https://dev.mysql.com/doc/internals/en/capability-flags.html#flag-CLIENT_DEPRECATE_EOF
func (*Capabilities) IsClientSetProtocol41 ¶
func (c *Capabilities) IsClientSetProtocol41() bool
IsClientSetProtocol41 return true if flag set
func (*Capabilities) IsSSLRequest ¶
func (c *Capabilities) IsSSLRequest() bool
IsSSLRequest return true if SslRequest flag up
func (*Capabilities) IsSetMariaDBCacheMetadata ¶
func (c *Capabilities) IsSetMariaDBCacheMetadata() bool
IsSetMariaDBCacheMetadata return true if MariaDBCacheMetadata capability set
func (*Capabilities) IsSetMariaDBClientExtendedTypeInfo ¶
func (c *Capabilities) IsSetMariaDBClientExtendedTypeInfo() bool
IsSetMariaDBClientExtendedTypeInfo return true if MariaDBClientExtendedTypeInfo capability set
func (*Capabilities) IsSetProtocol41 ¶
func (c *Capabilities) IsSetProtocol41() bool
IsSetProtocol41 return true if Protocol41 capability set
func (*Capabilities) SetClientCapabilities ¶
func (c *Capabilities) SetClientCapabilities(cap, extendedCap uint32)
SetClientCapabilities set client default and extended capabilities
func (*Capabilities) SetServerCapabilities ¶
func (c *Capabilities) SetServerCapabilities(cap, extendedCap uint32)
SetServerCapabilities set server default and extended capabilities
type ColumnDescription ¶
type ColumnDescription struct { Schema []byte Table []byte OrgTable []byte Name []byte OrgName []byte ExtendedTypeInfo []byte Charset uint16 ColumnLength uint32 Type base.Type Flag Flags Decimal uint8 DefaultValueLength uint64 DefaultValue []byte // contains filtered or unexported fields }
ColumnDescription https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41
func ParseResultField ¶
func ParseResultField(packet *Packet, mariaDBExtendedTypeInfo bool) (*ColumnDescription, error)
ParseResultField parses binary field and returns ColumnDescription
func (*ColumnDescription) Dump ¶
func (field *ColumnDescription) Dump() []byte
Dump https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41
type DataDecoderProcessor ¶
type DataDecoderProcessor struct {
BaseMySQLDataProcessor
}
DataDecoderProcessor implements processor and encode/decode binary intX values to text format which acceptable by Tokenizer
func NewDataDecoderProcessor ¶
func NewDataDecoderProcessor() *DataDecoderProcessor
NewDataDecoderProcessor return new data encoder from/to binary format for tokenization
func (*DataDecoderProcessor) ID ¶
func (p *DataDecoderProcessor) ID() string
ID return name of processor
type DataEncoderProcessor ¶
type DataEncoderProcessor struct {
BaseMySQLDataProcessor
}
DataEncoderProcessor implements processor and encode/decode binary intX values to text format which acceptable by Tokenizer
func NewDataEncoderProcessor ¶
func NewDataEncoderProcessor() *DataEncoderProcessor
NewDataEncoderProcessor return new data encoder from/to binary format for tokenization
func (*DataEncoderProcessor) ID ¶
func (p *DataEncoderProcessor) ID() string
ID return name of processor
type DataTypeFormat ¶
type DataTypeFormat struct {
// contains filtered or unexported fields
}
DataTypeFormat implementation of type_awareness.DataTypeFormat for PostgreSQL
func NewDataTypeFormat ¶
func NewDataTypeFormat(columnInfo base.ColumnInfo, columnSetting config.ColumnEncryptionSetting) *DataTypeFormat
NewDataTypeFormat create new DataTypeFormat from ColumnInfo and ColumnEncryptionSetting
func (*DataTypeFormat) GetColumnName ¶
func (p *DataTypeFormat) GetColumnName() string
GetColumnName return ColumnName
func (*DataTypeFormat) GetDBDataTypeID ¶
func (p *DataTypeFormat) GetDBDataTypeID() uint32
GetDBDataTypeID return DBDataTypeID
func (*DataTypeFormat) GetDefaultDataValue ¶
func (p *DataTypeFormat) GetDefaultDataValue() *string
GetDefaultDataValue return DefaultDataValue
func (*DataTypeFormat) GetResponseOnFail ¶
func (p *DataTypeFormat) GetResponseOnFail() common.ResponseOnFail
GetResponseOnFail return ResponseOnFail
func (*DataTypeFormat) IsBinaryDataOperation ¶
func (p *DataTypeFormat) IsBinaryDataOperation() bool
IsBinaryDataOperation check from columnSetting if binaryOperation
func (*DataTypeFormat) IsBinaryFormat ¶
func (p *DataTypeFormat) IsBinaryFormat() bool
IsBinaryFormat check if columnInfo is binary
type Flags ¶
type Flags uint16
Flags represent protocol ColumnDefinitionFlags https://dev.mysql.com/doc/dev/mysql-server/latest/group__group__cs__column__definition__flags.html
func (*Flags) ContainsFlag ¶
ContainsFlag check if specific flag contains in flagset
func (*Flags) RemoveFlag ¶
RemoveFlag remove flag from flag set
type Handler ¶
type Handler struct { Capabilities Capabilities // contains filtered or unexported fields }
Handler handles connection between client and MySQL db
func NewMysqlProxy ¶
func NewMysqlProxy(session base.ClientSession, parser *sqlparser.Parser, setting base.ProxySetting) (*Handler, error)
NewMysqlProxy returns new Handler
func (*Handler) AddClientIDObserver ¶
func (handler *Handler) AddClientIDObserver(observer base.ClientIDObserver)
AddClientIDObserver subscribe new observer for clientID changes
func (*Handler) AddQueryObserver ¶
func (handler *Handler) AddQueryObserver(obs mysql.QueryObserver)
AddQueryObserver implement QueryObservable interface and proxy call to ObserverManager
func (*Handler) PreparedStatementResponseHandler ¶
func (handler *Handler) PreparedStatementResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
PreparedStatementResponseHandler handles PreparedStatements response from DB
func (*Handler) ProxyClientConnection ¶
func (handler *Handler) ProxyClientConnection(ctx context.Context, errCh chan<- base.ProxyError)
ProxyClientConnection connects to database, writes data and executes DB commands
func (*Handler) ProxyDatabaseConnection ¶
func (handler *Handler) ProxyDatabaseConnection(ctx context.Context, errCh chan<- base.ProxyError)
ProxyDatabaseConnection handles connection from database, returns data to client
func (*Handler) QueryResponseHandler ¶
func (handler *Handler) QueryResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
QueryResponseHandler parses data from database response
func (*Handler) RegisteredObserversCount ¶
RegisteredObserversCount return count of registered observers
func (*Handler) ResetStatementResponseHandler ¶
func (handler *Handler) ResetStatementResponseHandler(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) (err error)
ResetStatementResponseHandler handle response for Reset Request Statement
func (*Handler) SubscribeOnAllColumnsDecryption ¶
func (handler *Handler) SubscribeOnAllColumnsDecryption(subscriber base.DecryptionSubscriber)
SubscribeOnAllColumnsDecryption subscribes for OnColumn notifications on each column.
func (*Handler) Unsubscribe ¶
func (handler *Handler) Unsubscribe(subscriber base.DecryptionSubscriber)
Unsubscribe a subscriber from all OnColumn notifications.
type MySQLPreparedStatement ¶
type MySQLPreparedStatement struct {
// contains filtered or unexported fields
}
MySQLPreparedStatement is a MySQL PreparedStatement.
func NewPreparedStatement ¶
func NewPreparedStatement(statementID uint32, paramsNum uint16, sqlString string, sqlStatement sqlparser.Statement) *MySQLPreparedStatement
NewPreparedStatement makes a new prepared statement.
func NewPreparedStatementWithName ¶
func NewPreparedStatementWithName(name string, sqlString string, sqlStatement sqlparser.Statement) *MySQLPreparedStatement
NewPreparedStatementWithName makes a new prepared statement with name and zero paramsNum
func (*MySQLPreparedStatement) Name ¶
func (s *MySQLPreparedStatement) Name() string
Name return prepared statement name
func (*MySQLPreparedStatement) ParamsNum ¶
func (s *MySQLPreparedStatement) ParamsNum() int
ParamsNum return number of prepared statements params
func (*MySQLPreparedStatement) Query ¶
func (s *MySQLPreparedStatement) Query() sqlparser.Statement
Query returns the prepared query, in its parsed form.
func (*MySQLPreparedStatement) QueryText ¶
func (s *MySQLPreparedStatement) QueryText() string
QueryText returns sqlString of the prepared query, as provided by the client.
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet struct that store header and payload, reads it from connection
func ReadPacket ¶
ReadPacket from connection and return Packet struct with data or error
func (*Packet) GetBindParameters ¶
func (packet *Packet) GetBindParameters(paramNum int) ([]base.BoundValue, error)
GetBindParameters returns packet Bind parameters
func (*Packet) GetPacketPayloadLength ¶
GetPacketPayloadLength returns payload length from first 3 bytes of header
func (*Packet) GetSequenceNumber ¶
GetSequenceNumber returned as byte
func (*Packet) ReadPacket ¶
ReadPacket header and payload from connection or return error
func (*Packet) SetData ¶
SetData replace packet data with newData and update payload length in header
func (*Packet) SetParameters ¶
func (packet *Packet) SetParameters(values []base.BoundValue) (err error)
SetParameters updates statement parameters from Bind packet.
type PrepareStatementResponse ¶
type PrepareStatementResponse struct { StatementID uint32 ColumnsNum, ParamsNum, WarningNum uint16 Reserved uint8 }
PrepareStatementResponse used for handling MySQL prepared statement response https://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html status(1) + statement_id(4) + num_columns(2) + num_params(2) + reserved_1(1) + warning_count(2) status is ignored because of status checking on ProxyDatabaseConnection
func ParsePrepareStatementResponse ¶
func ParsePrepareStatementResponse(data []byte) (*PrepareStatementResponse, error)
ParsePrepareStatementResponse parse prepared statement from packet data
type PreparedStatement ¶
type PreparedStatement interface { Name() string Query() sqlparser.Statement QueryText() string ParamsNum() int }
PreparedStatement is a prepared statement, ready to be executed. It can be either a textual SQL statement from "PREPARE", or a database protocol equivalent.
type PreparedStatementFieldTracker ¶
type PreparedStatementFieldTracker struct {
// contains filtered or unexported fields
}
PreparedStatementFieldTracker track and replace DataType for column and param ColumnDefinition
func NewPreparedStatementFieldTracker ¶
func NewPreparedStatementFieldTracker(handler *Handler, columnNum uint16) PreparedStatementFieldTracker
NewPreparedStatementFieldTracker create new PreparedStatementFieldTracker
func (*PreparedStatementFieldTracker) ColumnsTrackHandler ¶
func (p *PreparedStatementFieldTracker) ColumnsTrackHandler(ctx context.Context, packet *Packet, _, clientConnection net.Conn) error
ColumnsTrackHandler implements ResponseHandler to track prepared statement columns
func (*PreparedStatementFieldTracker) ParamsTrackHandler ¶
func (p *PreparedStatementFieldTracker) ParamsTrackHandler(ctx context.Context, packet *Packet, _, clientConnection net.Conn) error
ParamsTrackHandler implements ResponseHandler to track prepare statement params
type PreparedStatementItem ¶
type PreparedStatementItem struct {
// contains filtered or unexported fields
}
PreparedStatementItem represent an item to store in PreparedStatementRegistry
func NewPreparedStatementItem ¶
func NewPreparedStatementItem(stmt PreparedStatement, querySelectSettings []*encryptor.QueryDataItem) PreparedStatementItem
NewPreparedStatementItem create a new PreparedStatementItem
func (*PreparedStatementItem) Name ¶
func (r *PreparedStatementItem) Name() string
Name return PreparedStatementItem name
func (*PreparedStatementItem) QuerySettings ¶
func (r *PreparedStatementItem) QuerySettings() []*encryptor.QueryDataItem
QuerySettings return PreparedStatementItem querySettings
func (*PreparedStatementItem) Statement ¶
func (r *PreparedStatementItem) Statement() PreparedStatement
Statement return PreparedStatementItem statememt
type PreparedStatementRegistry ¶
type PreparedStatementRegistry struct {
// contains filtered or unexported fields
}
PreparedStatementRegistry is a MySQL PreparedStatementRegistry.
func NewPreparedStatementRegistry ¶
func NewPreparedStatementRegistry() *PreparedStatementRegistry
NewPreparedStatementRegistry makes a new empty prepared statement registry.
func (*PreparedStatementRegistry) AddStatement ¶
func (r *PreparedStatementRegistry) AddStatement(statement PreparedStatementItem)
AddStatement adds a prepared statement to the registry. If an existing statement with the same name exists, it is replaced with the new one.
func (*PreparedStatementRegistry) DeleteStatementByID ¶
func (r *PreparedStatementRegistry) DeleteStatementByID(stmtID string) bool
DeleteStatementByID returns a prepared statement from the registry by its id, if it exists.
func (*PreparedStatementRegistry) StatementByID ¶
func (r *PreparedStatementRegistry) StatementByID(stmtID string) (PreparedStatementItem, error)
StatementByID returns a prepared statement from the registry by its id, if it exists.
type PreparedStatementsQuery ¶
type PreparedStatementsQuery struct {
// contains filtered or unexported fields
}
PreparedStatementsQuery process MySQL SQL PreparedStatement
func NewMySQLPreparedStatementsQuery ¶
func NewMySQLPreparedStatementsQuery(proxyHandler *Handler, parser *sqlparser.Parser, schemaStore config.TableSchemaStore) *PreparedStatementsQuery
NewMySQLPreparedStatementsQuery create new PreparedStatementsQuery to handle SQL PreparedStatement in the following format https://dev.mysql.com/doc/refman/8.0/en/sql-prepared-statements.html
func (*PreparedStatementsQuery) ID ¶
func (e *PreparedStatementsQuery) ID() string
ID returns name of this QueryObserver.
func (*PreparedStatementsQuery) OnBind ¶
func (e *PreparedStatementsQuery) OnBind(ctx context.Context, statement sqlparser.Statement, values []base.BoundValue) ([]base.BoundValue, bool, error)
OnBind just a stub method of QueryObserver of PreparedStatementsQuery
func (*PreparedStatementsQuery) OnColumn ¶
func (e *PreparedStatementsQuery) OnColumn(ctx context.Context, data []byte) (context.Context, []byte, error)
OnColumn return new encryption setting context if info exist, otherwise column data and passed context will be returned
func (*PreparedStatementsQuery) OnQuery ¶
func (e *PreparedStatementsQuery) OnQuery(ctx context.Context, query mysql.OnQueryObject) (mysql.OnQueryObject, bool, error)
OnQuery processes query text before database sees it.
func (*PreparedStatementsQuery) SetDataEncryptor ¶
func (e *PreparedStatementsQuery) SetDataEncryptor(dataEncryptor encryptor.DataEncryptor)
SetDataEncryptor set encryptor.DataEncryptor
type ProtocolState ¶
type ProtocolState struct {
// contains filtered or unexported fields
}
ProtocolState keeps track of MySQL protocol state.
func NewProtocolState ¶
func NewProtocolState() *ProtocolState
NewProtocolState makes an initial MySQL state, awaiting for queries.
func (*ProtocolState) AddColumnDescription ¶
func (p *ProtocolState) AddColumnDescription(field *ColumnDescription)
AddColumnDescription add ColumnDescription
func (*ProtocolState) GetStmtID ¶
func (p *ProtocolState) GetStmtID() uint32
GetStmtID set stmtID value
func (*ProtocolState) PendingParse ¶
func (p *ProtocolState) PendingParse() mysql.OnQueryObject
PendingParse returns the pending prepared statement, if any.
func (*ProtocolState) SetPendingParse ¶
func (p *ProtocolState) SetPendingParse(obj mysql.OnQueryObject)
SetPendingParse set pendingParse value
func (*ProtocolState) SetStmtID ¶
func (p *ProtocolState) SetStmtID(id uint32)
SetStmtID set stmtID value
type ResponseHandler ¶
type ResponseHandler func(ctx context.Context, packet *Packet, dbConnection, clientConnection net.Conn) error
ResponseHandler database response header
type TypeConfiguration ¶
type TypeConfiguration struct { // https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_character_set.html Charset uint16 ColumnLength uint32 // https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_query_response_text_resultset_column_definition.html Decimal uint8 }
TypeConfiguration represent configurations details of specific type