Hi!
On Dec 11, Konstantin Osipov wrote:
> * Sergei Golubchik <serg@stripped> [07/12/11 13:38]:
>
> > > The header files are different, and it uses MY_INIT() rather than
> > > my_init(). I seem to be using the same example for the
> > > (now-in-progress) fourth edition. Is the current code okay?
> >
> > try to use mysql_library_init() instead of MY_INIT(). And if
> > load_defaults() will be in mysql.h then you won't need my_sys.h and
> > my_global.h
>
> OK, I'd leave it to Paul.
>
> Paul, there are these alternatives now:
>
> * I do nothing with this bug. Then the example in the third
> * edition of your book stays valid and canonical.
>
> * I push my patch. The canonical example will look like this:
>
> #include <my_sys.h>
> #include <mysql.h>
> ... (same as before)
>
> Rationale: load_defaults is not part of the client
> library/connector but part of mysys (MySQL library for
> system utilities and wrappers, which we happen to ship with the
> connector). In effect this makes "officially" public other mysys
> functions (free_defaults, modify_defaults_file). We do not
> promise ABI compatibility for these, but we say they are there
> and could be used.
>
> * I follow Serg's suggestion. The example in your book will look
> like
>
> #include <mysql.h>
>
> ... (same as before)
>
> Rationale: load_defaults is an essential part of the client
> library, that users should know about and be able to use.
> We do not publicise the rest of mysys library.
>
> Note, that the current example has a small memory leak: the
> memory used for load_defaults is never freed (for that one has to
> use free_defaults). Since it is not a recurring leak it's not a
> problem, it will only be visible at exit, when running the program
> under valgrind.
>
> Serg, please correct me if I did not summarize the options correctly.
You did it perfectly.
Btw, I've just asked Monty. He says that load_defaults() should definitely be
in mysql_com.h. But also prefers to see it in my_sys.h too.
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140