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

Implement CheckNamedValue for statsColumnConverter #3

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions driver.go
Expand Up @@ -334,6 +334,15 @@ func (vc *statsColumnConverter) ColumnConverter(idx int) driver.ValueConverter {
return vc.wrapped.ColumnConverter(idx)
}

// we add this method for implementing NamedValueChecker interface
// and this is for escaping arguments checker, see the relating PR for more information
func (vc *statsColumnConverter) CheckNamedValue(nv *driver.NamedValue) (err error) {
// the index for ColumnConverter doesn't matter and it just returns an new converter
// see: https://github.com/go-sql-driver/mysql/blob/master/statement.go#L43
nv.Value, err = vc.ColumnConverter(nv.Ordinal).ConvertValue(nv.Value)
return
}

func (s *statsStmt) Close() error {
err := s.wrapped.Close()
s.d.StmtClosed(err)
Expand Down