Bug #25535 | load_defaults() no longer included by mysql.h | ||
---|---|---|---|
Submitted: | 10 Jan 2007 20:17 | Modified: | 20 May 2009 20:26 |
Reporter: | Hartmut Holzgraefe | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S4 (Feature request) |
Version: | 5.1.12 and up | OS: | Any (*) |
Assigned to: | CPU Architecture: | Any |
[10 Jan 2007 20:17]
Hartmut Holzgraefe
[10 Jan 2007 20:44]
Hartmut Holzgraefe
test project
Attachment: bug25535-0.1.tar.bz2 (application/x-tar, text), 188.92 KiB.
[10 Jan 2007 20:47]
Hartmut Holzgraefe
The attached test project tries to build two binaries "without_my_sys" and "with_my_sys" that just consist of a load_defaults call. with "configure --with-mysql=/path/to/mysql-5.0" the without version that just includes mysql.h works fine, only the with_my_sys build fails due to the addition of #include <my_sys.h> when configuring against 5.1 instead both builds fail for anything after 5.1.11
[16 Jan 2007 19:26]
Konstantin Osipov
Dear Hartmut, this function is not documented, has no reserved name prefix, and therefore should not be exported by the client API. Moreover, mysql.h is a header for MySQL client library, whereas load_defaults belongs to mysys/ library. If you would like to use this function from mysys, you should include the corresponding header. Long term we may remove or rename any function that is currently declared in a public header but is not documented and/or does not start with my_ or mysql_. Please feel free to reopen this bug if you have further feedback.
[16 Jan 2007 22:35]
Hartmut Holzgraefe
>this function is not documented, has no reserved name prefix, > and therefore should not be exported by the client API. this function is used by all cluster tools to fetch cluster configuration from the [mysql_cluster] section in my.cnf, especially the connect_string that is essential for all cluster operations IMHO it is perfectly valid to expect to be able to use the same mechanism for any other ndbapi applications, to have them behave like the distributed ndbapi tools as much as possible > Moreover, mysql.h is a header for MySQL client library, > whereas load_defaults belongs to mysys/ library. If you > would like to use this function from mysys, > you should include the corresponding header. No problem with that *if* just including my_sys.h in addition to mysql.h would work, which it doesn't. See the attached test project, adding "#include <my_sys.h>" produces *lots* of compile errors ... > Long term we may remove or rename any function that is > currently declared in a public header but is not documented > and/or does not start with my_ or mysql_. I'm all for having proper name prefixes, but access to the [mysql_cluster] section in my.cnf section is essential for ndbapi based tools, and it is usefull for applications using mysqlclient, too, e.g to fetch the default socket file name from the my.cnf [client] section (this would have helped to prevent *tons* of PHP bug reports caused by PHPs bundled libmysqlclient being compiled with different defaults than the local mysql installation ...) > Please feel free to reopen this bug if you have further feedback. Done, reopened as verified high priority feature request
[25 Jan 2007 11:20]
Sergei Golubchik
This is also documented in Paul's MySQL book, and it's the only way for MySQL clients to get a mysql-compatible behaviour regardning command line options and options files (getting options from my.cnf).
[26 Jan 2007 18:30]
Sergei Golubchik
suggestion: rename it to my_load_defaults (to match my_getopt) or mysql_load_defaults, and add back to mysql.h
[26 Jan 2007 18:33]
Paul DuBois
The same treatment should be given to any other function from the client libs that people need to use when the write MySQL programs. handle_options() is such an instance. Rename to my_handle_options() or some such?
[4 Apr 2007 10:47]
deepika saffar
Hello Sir, Sir I want to use load_default() in my client program MySQL-4.1.20 the program gets compiled without error, but when executed the program does not take data from .my.cnf file. Platform is FC4 Sir if u can help on it plz do so, yours truly, Deepika
[4 Dec 2007 19:32]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/39244 ChangeSet@1.2614, 2007-12-04 22:32:08+03:00, kostja@bodhi.(none) +1 -0 Fix Bug#25535 "load_defaults() no longer included by mysql.h" by making sure that load_defaults can be made available by including my_sys.h. Note, if one includes both my_sys.h and mysql.h, my_sys.h got to go first (this is how mysql.h is written).
[20 May 2009 20:26]
Jim Winstead
This patch is out-of-date now that load_defaults() has been renamed to my_load_defaults().
[7 Dec 2017 8:41]
Bharathy Satish
Checked on latest 5.1 and see that load_defaults is declared in my_sys.h and removed from mysql.h.