Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging improvements #286

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go/mysql/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ func (c *Conn) handleNextCommand(handler Handler) error {

parserOptions, err := handler.ParserOptionsForConnection(c)
if err != nil {
log.Errorf("unable to determine parser options for current connection: %s", err.Error())
return err
}

Expand Down Expand Up @@ -1139,8 +1140,9 @@ func (c *Conn) handleNextCommand(handler Handler) error {

c.PrepareData[c.StatementID] = prepare

fld, err := handler.ComPrepare(c, query)
fld, err := handler.ComPrepare(c, query, prepare)
if err != nil {
log.Errorf("unable to prepare query: %s", err.Error())
if werr := c.writeErrorPacketFromError(err); werr != nil {
// If we can't even write the error, we're done.
log.Error("Error writing query error to client %v: %v", c.ConnectionID, werr)
Expand Down
2 changes: 1 addition & 1 deletion go/mysql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type Handler interface {

// ComPrepare is called when a connection receives a prepared
// statement query.
ComPrepare(c *Conn, query string) ([]*querypb.Field, error)
ComPrepare(c *Conn, query string, prepare *PrepareData) ([]*querypb.Field, error)

// ComStmtExecute is called when a connection receives a statement
// execute query.
Expand Down
2 changes: 1 addition & 1 deletion go/mysql/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (th *testHandler) ComParsedQuery(c *Conn, query string, parsed sqlparser.St
return th.ComQuery(c, query, callback)
}

func (th *testHandler) ComPrepare(c *Conn, query string) ([]*querypb.Field, error) {
func (th *testHandler) ComPrepare(c *Conn, query string, prepare *PrepareData) ([]*querypb.Field, error) {
return nil, nil
}

Expand Down