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

Allow logging base64-encoded queries, instead of replacing bad chars. #1667

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

PavelSafronov
Copy link
Contributor

No description provided.

@PavelSafronov
Copy link
Contributor Author

Matching dolt PR: dolthub/dolt#5615

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG but see comment

sel ServerEventListener
}

var _ mysql.Handler = (*Handler)(nil)

// NewHandler creates a new Handler given a SQLe engine.
func NewHandler(e *sqle.Engine, sm *SessionManager, rt time.Duration, disableMultiStmts bool, maxLoggedQueryLen int, listener ServerEventListener) *Handler {
func NewHandler(e *sqle.Engine, sm *SessionManager, rt time.Duration, disableMultiStmts bool, maxLoggedQueryLen int, encodeLoggedQuery bool, listener ServerEventListener) *Handler {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor is just crying out for a struct instead of all these separate params. Want to take another pass and add one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we're just assigning those values to a struct... And if we replace the parameters with a struct, then we'll need a constructor for that struct (and that constructor will look suspiciously similar to this constructor).

If the method wasn't a constructor, I would agree, it's better to use a struct than so many parameters. But as it stands, we gain nothing by adding another struct here.

I'm inclined to keep the constructor as-is. Or if we're not happy with so many params, we can get rid of the constructor entirely. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I'm unhappy with the number of parameters is that it becomes difficult at the call site to know what each of the many very similar parameters all mean, especially when they are booleans.

You could simply get rid of the constructor and construct the Handler struct directly (with named fields) at each call site. That would probably be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree. Updated.

@PavelSafronov PavelSafronov merged commit b57fb48 into main Mar 23, 2023
@Hydrocharged Hydrocharged deleted the pavel/encode-logged-queries branch March 29, 2023 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants