Neubauer, Ralf | 18 Oct 2011 18:13
Picon

DBD::mysql: no errstr under Windows

Hi,

as you may have seen in https://rt.cpan.org/Public/Bug/Display.html?id=71047 or even in
http://bugs.activestate.com/show_bug.cgi?id=91026 there is no ->errstr or ->err on the Windows
platform, if ->execute failed.

In DBD::mysql 4.018 the code at the end of mysql_st_internal_execute() in dbdimp.c that executed the
statement and transferred the error codes looked like this:

if ((mysql_real_query(svsock, sbuf, slen))  &&
      (!mysql_db_reconnect(h)  ||
       (mysql_real_query(svsock, sbuf, slen))))
  {
    Safefree(salloc);
    do_error(h, mysql_errno(svsock), mysql_error(svsock), 
             mysql_sqlstate(svsock));
    if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
      PerlIO_printf(DBILOGFP, "IGNORING ERROR errno %d\n", errno);
    return -2;
  }
  Safefree(salloc);

In 4.020 it looks like this (Note that MYSQL_ASYNC is 0 on the Windows platform as defined in dbdimp.h):

#if MYSQL_ASYNC
  if(async) {
    if((mysql_send_query(svsock, sbuf, slen)) &&
       (!mysql_db_reconnect(h) ||
        (mysql_send_query(svsock, sbuf, slen))))
    {
(Continue reading)


Gmane