mysql

package
v2.3.0-beta21 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

MySQL Package Documentation

The mysqlparser package encompasses the parser and mapping logic required to read MySql binary messages and capture and test the outputs. Utilized by the hooks package, it assists in redirecting outgoing calls for the purpose of recording or testing the outputs.

SSL Support

Please note that SSL is currently not supported in the MySQL package. To use the package without SSL, you can include the following parameters in your database URL like the following example:

jdbc:mysql://localhost:3306/db_name?useSSL=false&allowPublicKeyRetrieval=true

The following MySQL packet types are handled in the parser:

COM_PING: A ping command sent to the server to check if it's alive and responsive.

COM_STMT_EXECUTE: Executes a prepared statement that was prepared using the COM_STMT_PREPARE command.

COM_STMT_FETCH: Fetches rows from a statement which produced a result set. Used with cursors in server-side prepared statements.

COM_STMT_PREPARE: Prepares a SQL statement for execution.

COM_STMT_CLOSE: Closes a prepared statement, freeing up server resources associated with it.

COM_CHANGE_USER: Changes the user of the current connection and resets the connection state.

MySQLOK: A packet indicating a successful operation. It is usually received after commands like INSERT, UPDATE, DELETE, etc.

MySQLErr: An error packet sent from the server to the client, indicating an error occurred with the last command sent.

RESULT_SET_PACKET: Contains the actual result set data returned by a query. It's a series of packets containing rows and columns of data.

MySQLHandshakeV10: The initial handshake packet sent from the server to the client when a connection is established, containing authentication and connection details.

HANDSHAKE_RESPONSE: The response packet sent by the client in reply to MySQLHandshakeV10, containing client authentication data.

MySQLQuery: Contains a SQL query that is to be executed on the server.

AUTH_SWITCH_REQUEST: Sent by the server to request an authentication method switch during the connection process.

AUTH_SWITCH_RESPONSE: Sent by the client to respond to the AUTH_SWITCH_REQUEST, containing authentication data.

MySQLEOF: An EOF (End Of File) packet that marks the end of a result set or the end of the fields list.

AUTH_MORE_DATA: Sent by the server if it needs more data for authentication (used in plugins).

COM_STMT_SEND_LONG_DATA: Sends data for a column in a row to be inserted/updated in a table using a prepared statement.

COM_STMT_RESET: Resets the data of a prepared statement which was accumulated with COM_STMT_SEND_LONG_DATA commands.

COM_QUIT: Sent by the client to close the connection to the server gracefully.

Documentation

Overview

Package mysql provides the MySQL integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger *zap.Logger) integrations.Integrations

Types

type MySQL

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

func (*MySQL) MatchType

func (m *MySQL) MatchType(_ context.Context, _ []byte) bool

func (*MySQL) MockOutgoing

func (m *MySQL) MockOutgoing(ctx context.Context, src net.Conn, dstCfg *integrations.ConditionalDstCfg, mockDb integrations.MockMemDb, opts models.OutgoingOptions) error

func (*MySQL) RecordOutgoing

func (m *MySQL) RecordOutgoing(ctx context.Context, src net.Conn, dst net.Conn, mocks chan<- *models.Mock, opts models.OutgoingOptions) error

Directories

Path Synopsis
Package recorder is used to record the MySQL traffic between the client and the server.
Package recorder is used to record the MySQL traffic between the client and the server.
Package replayer is used to mock the MySQL traffic between the client and the server.
Package replayer is used to mock the MySQL traffic between the client and the server.
Package utils provides utility functions for MySQL packets
Package utils provides utility functions for MySQL packets
Package wire provides encoding and decoding operation of MySQL packets.
Package wire provides encoding and decoding operation of MySQL packets.
phase
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
phase/conn
Package conn provides decoding and encoding of connection phase mysql packets
Package conn provides decoding and encoding of connection phase mysql packets
phase/query
Package query provides functions to decode MySQL command phase packets.
Package query provides functions to decode MySQL command phase packets.
phase/query/preparedstmt
Package preparedstmt provides functionality for decoding prepared statement packets.
Package preparedstmt provides functionality for decoding prepared statement packets.
phase/query/rowscols
Package rowscols provides encoding and decoding of MySQL row & column packets.
Package rowscols provides encoding and decoding of MySQL row & column packets.
phase/query/utility
Package utility provides encoding and decoding of utility command packets.
Package utility provides encoding and decoding of utility command packets.

Jump to

Keyboard shortcuts

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