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

mysql field: expose API to modify field value #960

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

walkline
Copy link
Contributor

@walkline walkline commented Dec 21, 2024

In my use case, I have a kind of MySQL proxy that can modify values for certain fields, but I couldn't find an API that allows this. So, I came up with this solution, which can be used as follows:

func (p *Proxy) HandleStmtExecute(context interface{}, query string, args []interface{}) (*mysql.Result, error) {
	var stmt *client.Stmt
        //...
	res, err := stmt.Execute(args...)
        //...
        res.Values[row][column] = mysql.NewFieldValue(mysql.FieldValueTypeUnsigned, rawGUID, []byte(fmt.Sprintf("%d", rawGUID)))
	return res, nil
}

@lance6716 lance6716 merged commit 2f42179 into go-mysql-org:master Dec 21, 2024
15 checks passed
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