>Description:
On an unsuccessful INSERT DELAYED using mysql_query(), there is disagreement
between the two functions mysql_error() and mysql_errno(). Specifically,
mysql_errno() will return 0 (indicating no error), whereas mysql_error()
will return what really happened, e.g. "Table 'foo' doesn't exist".
>How-To-Repeat:
int retval;
unsigned int real_error;
char *query="insert delayed into `headers_out` (id, item, val) values
('PfF5PsCoCj0AAEVCCiY','Content-Type','text/html')";
/* table "headers_out" hasn't been created yet... */
retval = mysql_query(mysql_log, query);
real_error = mysql_errno(mysql_log);
printf("Error %d, means %s", real_error, mysql_error(mysql_log));
What gets output from this pseudocodish snippet is:
"Error 0, means Table 'apache_test.notes' doesn't exist"
>Fix:
Obviously the two error functions should agree; either, both reporting 'no
error' or both agreeing that error 1146, nonexistent table, just happened.
It would be preferable for the latter to be the fix, so one could then
still check for success or failure of the INSERT DELAYED. I do confess that
a strict reading of the INSERT DELAYED docs indicates that it doesn't bother
to wait around to check for success/failure...so the "desired" fix might not
be totally in line with the "strict, by-the-book" fix. It sure would be
nice to know the fate of the delayed insert, though...
>Submitter-Id: chris@stripped
>Originator: chris@stripped
>Organization: mod_log_sql http://www.grubbybaby.com/mod_log_sql
>MySQL support: none
>Synopsis: Disagreement between mysql_error() and mysql_errno() on INSERT DELAYED
>Severity: serious
>Priority: medium
>Category: mysql
>Class: sw-bug
>Release: mysql-3.23.52 (Mandrake Linux MySQL RPM)
>Environment:
System: Linux crib.corp.grubbybaby.com 2.4.19-16mdkcustom #1 Sat Nov 30 17:47:29 PST 2002
i686 unknown unknown GNU/Linux
Architecture: i686
Some paths: /usr//bin/perl /usr//bin/make /usr//bin/gmake /usr//bin/gcc /usr//bin/cc
GCC: Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib
--mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --enable-long-long --enable-__cxa_atexit
--enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu
--with-system-zlib
Thread model: posix
gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)
Compilation info: CC='gcc-3.2' CFLAGS='-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro
-march=i586 -ffast-math -fno-strength-reduce -fno-omit-frame-pointer' CXX='g++-3.2'
CXXFLAGS='-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math
-fno-strength-reduce -fno-omit-frame-pointer' LDFLAGS=''
LIBC:
lrwxr-xr-x 1 root root 13 Nov 30 16:34 /lib/libc.so.6 -> libc-2.2.5.so
-rwxr-xr-x 1 root root 1147848 Aug 19 03:17 /lib/libc-2.2.5.so
-rw-r--r-- 1 root root 178 Aug 19 03:08 /usr/lib/libc.so
Configure command: ./configure '--disable-shared' '--with-mysqld-ldflags=-all-static'
'--with-client-ldflags=-all-static' '--with-other-libc=/lib' '--without-berkeley-db'
'--without-innodb' '--enable-assembler' '--enable-local-infile'
'--with-mysqld-user=mysql' '--with-unix-socket-path=/var/lib/mysql/mysql.sock'
'--prefix=/' '--libdir=/usr/lib' '--with-extra-charsets=complex' '--exec-prefix=/usr'
'--libexecdir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share'
'--localstatedir=/var/lib/mysql' '--infodir=/usr/share/info' '--includedir=/usr/include'
'--mandir=/usr/share/man' '--with-comment=Mandrake Linux MySQL RPM' 'CC=gcc-3.2'
'CFLAGS=-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math
-fno-strength-reduce -fno-omit-frame-pointer' 'CXXFLAGS=-O3 -fomit-frame-pointer -pipe
-mcpu=pentiumpro -march=i586 -ffast-math -fno-strength-reduce -fno-omit-frame-pointer'
'CXX=g++-3.2'