> Some of the differences are style differences, but for a lot of it I
> felt that the patch just didn't go far enough.
Thanks. I appreciate your additions/modifications. I hope that the
benefits outweigh the added effort you had to put into it.
> For instance, your example disabled exceptions, where it should have
> paid attention to them as warnings that the internals of the library
> were confused about what was going on.
I had turned off the exceptions because a BadQuery exception was being
thrown by store if the result set was null, but no error given, such as
the case with a DROP, CREATE, INSERT, etc. statements, which I took from
the c api example (perhaps I should have used a better example). But I
now see that you modified the store method to not throw an exception in
the case of a null result set with no error.
> Another example is your extension of connect_to_db() to add the
> necessary connection flag, instead of adding a
> mysql_set_server_option() wrapper to Connection to allow this flag to
> be set at any time.
Good point. I think, being new to the library, I was slightly nervous
about modifying more library code than I had to, which seemed to block
me from realizing that simple approach. Sorry about that. But when I
checked the latest code out from svn and tested, the call to the stored
procedure was returning an error, that I can only seem to correct by
setting the CLIENT_MULTI_STATEMENTS when it connects. The other multi
query examples seem to work fine, but for some reason the stored
procedure call needs that. I'd rather use the connect_to_db from utils,
but if there's no other way to modify the connection properly after it
has been established, I can just connect a different way from within the
> FYI, with a suitable diff statement, the example could have been part
> of the patch.
I was doing an svn diff on the repository as specified in the HACKERS
file, and wasn't quite sure how to get the diff for it without adding
the file to the repository. Is there a way? Or was I supposed to add
the file, without committing it, and then do the diff?
> Also, it would have been nice if you'd provided patches for
Sorry, didn't see that there.
> Can you explain why this change was needed, though:
> - fields_ = other.fields_;
> + fields_ = Fields(this);
The Fields class stores a pointer to the ResUse object which initialized
it, and works on that ResUse object when a caller tries to access a
field through it. In assigning the other.fields_ to this->fields_, we
are copying the pointer, which still points to the "other" ResUse object
which is about to be invalidated. We need to point the fields_ variable
to "this" ResUse object, which now contains the result set previously
contained by the other ResUse object.
I checked out the latest code from subversion and tried to compile it on
my fc3 box with gcc 3.4, and got a compilation error. It complained
about an invalid conversion from `int' to `enum_mysql_set_option' in the
set_option function in connection.h. I modified it to do a static cast
of the int parameter to the proper enum type, which did the trick. I
wasn't sure if you would rather change the parameter type to the "enum
enum_mysql_set_option" type, or do it this way. I've included the patch
for the static_cast.
Attachment: [application/x-gzip] set_option.patch.gz set_option.patch.gz