Bug #112895 mysql_stmt_bind_named_param() example has errors
Submitted: 31 Oct 2023 10:28 Modified: 24 Dec 2023 19:52
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.2.0 OS:Any
Assigned to: CPU Architecture:Any

[31 Oct 2023 10:28] Daniël van Eeden
Description:
https://dev.mysql.com/doc/c-api/8.2/en/mysql-stmt-bind-named-param.html has an example that:

1. References `mysql_simple_prepare()`, while it probably should have been `mysql_stmt_prepare()`.

2. Doesn't define `mysql`, probably because this is not a complete example

3. Mixes C and C++ (memset, std::size) without declaring in which language the example is. 

How to repeat:
See example.

Suggested fix:
Replace `mysql_simple_prepare()` with `mysql_stmt_prepare()` (and the right arguments)

Consider changing the example to a fully working example that one could compile and run
[31 Oct 2023 10:39] Daniël van Eeden
Related: Bug #112890
[31 Oct 2023 10:43] MySQL Verification Team
Hello Daniël,

Thank you for the report and feedback.

regards,
Umesh
[19 Dec 2023 22:28] Philip Olson
Posted by developer:
 
Interesting, I'm new to documenting the C API but it appears mysql_simple_prepare() is part of the test suite:

https://github.com/mysql/mysql-server/blob/87307d4ddd88405117e3f1e51323836d57ab1f57/testcl...

Which might help explain why this example has issues. I'll look into this.
[20 Dec 2023 12:05] MySQL Verification Team
Thank you, Philip.
[21 Dec 2023 19:50] Philip Olson
Posted by developer:
 
Thank you for reporting this issue, the example was updated/expanded and it includes compile instructions. It'll show up online within a few hours.
[24 Dec 2023 19:52] Daniël van Eeden
Perfect. Thanks.