Hi,
> Hm, hard to track down. But are you sure that your converting is correct and
> that you do not produce a buffer overflow somewhere? For example the lines
>
> case MYSQL_TYPE_LONG:
> printf("L:%u(%p), ", *(unsigned long int*)stmt->params[j].buffer,
> stmt->params[j].buffer);
>
> do give warnings with -Wall. Of course this is only the debugging statement...
Sorry, change the %u to a %lu and the warning is fixed.
Also the earlier debug printf have %d when %u or %lu would be more
correct.
fmt_xfields_bind() on line 478 sets up the MYSQL_BIND structure
setting the pointer and MYSQL_TYPE. Which I have combed through
many times. I do have printf %p all over the place to insure that the
buffer pointers are correct.
If its usefull the url to see what MYSQL_TYPE_ goes with what C type is:
http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statement-datatypes.html
fmt_xfields_bind() sets the MYSQL_TYPES and on line 163 down you
can see the C types.
> Can you shrink the program down to only one query? You can use the "log =
> /var/log/mysql/mysql.log" option or tcpdump/ngrep to verify what the server
> receives.
I will try to simplify it.
I can't garentee my code is bug free but I beleive I have killed most in trying
to solve this one, plus there is the fact that mysql's binary server
and 32bit run ok.
To reduce the number of queries sent change the for() on line 368, eg
- for (i=0; i<34235; i++) {
+ for (i=0; i<1; i++) {
that should just send one. But note because 1 is less then the
BULK_INSERT_COUNT (=2) it will be the 'insert remainder' starting
line 413 that will send the query. you can reduce BULK_INSERT_COUNT
to 1 or have a loop that does at least 2.
I was planning on editing the test code to do larger BULK_INSERT_COUNT
(limit to 2 by the pre filled array on line 216) so that I can look at
things that cause mysqld and the client to die. (my app does 100
bulk inserts and ~12 million records, thats 120'000 iterations)
I will let you know when I find out more.
> > I did originally posted this bug to MySQL, until I found that their binaries
> > work fine: http://bugs.mysql.com/bug.php?id=14988
> Which binaries, the libraries you link against or the mysql server? Try
> linking statically against mine or their library to see if the bug is in the
> prepare statement code or in the server.
/usr/local/mysql/ is not in any library path so my app is linking with
/usr/lib/libmysqlclient.so.15 from the debian package.
infact all the debian packages are still installed. All I did was stop
the debian mysqld_safe and start mysql's, so just the running server
differs.
Thank you for looking at this.
Thorben