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

Will this driver trigger the seng long data protocol #3330

Open
deskau opened this issue Jan 17, 2025 · 2 comments
Open

Will this driver trigger the seng long data protocol #3330

deskau opened this issue Jan 17, 2025 · 2 comments

Comments

@deskau
Copy link

deskau commented Jan 17, 2025

Will this driver trigger the seng long data protocol. If possible, could you provide an example code to take a look at?

@sidorares
Copy link
Owner

Are you referring to https://dev.mysql.com/doc/dev/mysql-server/9.1.0/page_protocol_com_stmt_send_long_data.html ?

This driver currently does not support it, relatively easy to implement though.

Example golang driver with this feature: https://github.com/bketelsen/GoMySQL/blob/9d271105c498f4513ae6e85ea1b36ec4b835d50a/mysql_statement.go#L126-L160

If somebody wants to add support, some steps as I see it:

  • add COM_STMT_SEND_LONG_DATA packet serialisation/deserealisation
  • figure out limits for a "standard" COM_STMT_EXECUTE parameters maximum size
  • add a field to statement object to track bound parameters.
  • update connection.execute() to check the size of supplied parameters array, for all parameters that are too big for a "regular" com_stmt_execute send them using COM_STMT_SEND_LONG_DATA packets and mark as bound, then send com_execute as per usual except using NULL values for long parameters sent earlier
  • potentially add public api form manual stmt = await connection.prepare() / stmt.sendLongData(paramId, value) / stmt.execute(params)

( maybe add a field to statement object to track bound parameters. actually is not needed )

@deskau
Copy link
Author

deskau commented Jan 20, 2025

Thank you for your reply and guidance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants