Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 25671
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: CAPTTOFU [...] cpan.org
Requestors: roam [...] ringlet.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 4.003
Fixed in: (no value)



Subject: Finish the do_error() fix for MySQL 4.0 :)
Download (untitled) / with headers
text/plain 260b
It seems the cleanup of #ifdef's related to mysql_sqlstate() in 4.003 was not quite complete. The attached patch should fix the build with MySQL 4.0.x :) At least, it helps here, with MySQL 4.0.27 on FreeBSD 6.2-STABLE. Thanks for taking care of DBD::mysql!
Subject: sqlstate-purge.patch
--- dbdimp.c.orig Thu Mar 22 10:30:12 2007 +++ dbdimp.c Thu Mar 22 10:31:00 2007 @@ -3413,11 +3413,7 @@ if (!imp_sth->result) { do_error(sth, JW_ERR_SEQUENCE, "fetch() without execute()" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return Nullav; } @@ -3577,11 +3573,7 @@ if (mysql_errno(&imp_dbh->mysql)) do_error(sth, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif #if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION @@ -3909,11 +3901,7 @@ /* Are we asking for a legal value? */ if (what < 0 || what >= AV_ATTRIB_LAST) do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif /* Return cached value, if possible */ else if (cacheit && imp_sth->av_attr[what]) @@ -3923,11 +3911,7 @@ else if (!res) do_error(sth, JW_ERR_NOT_ACTIVE, "statement contains no result" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif /* Do the real work. */ else { @@ -4238,11 +4222,7 @@ { do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, "Illegal parameter number" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif return FALSE; } @@ -4265,11 +4245,7 @@ "Binding non-numeric field %d, value %s as a numeric!", param_num, neatsvpv(value,0)); do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, err_msg -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif } } @@ -4277,11 +4253,7 @@ { do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Output parameters not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return FALSE; } @@ -4439,11 +4411,7 @@ if (!my_login(h, imp_dbh)) { do_error(h, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif memcpy (&imp_dbh->mysql, &save_socket, sizeof(save_socket)); ++imp_dbh->stats.auto_reconnects_failed; return FALSE; --- dbdimp.h.orig Thu Mar 22 10:28:38 2007 +++ dbdimp.h Thu Mar 22 10:28:54 2007 @@ -282,11 +282,7 @@ #endif #include <dbd_xsh.h> -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION void do_error (SV* h, int rc, const char *what, const char *sqlstate); -#else -void do_error (SV* h, int rc, const char *what); -#endif SV *dbd_db_fieldlist (MYSQL_RES* res); void dbd_preparse (imp_sth_t *imp_sth, SV *statement);
Download (untitled) / with headers
text/plain 111b
Thanks for letting me know about this. It has been fixed in the latest 4.004 that will be released later today.
Download (untitled) / with headers
text/plain 400b
On Thu Mar 22 12:15:46 2007, CAPTTOFU wrote: Show quoted text
> Thanks for letting me know about this. It has been fixed in the latest > 4.004 that will be released later today.
Unfortunately, 4.004 does not quite fix this - there are still a couple of leftover #ifdef's in dbdimp.c. Attached is a patch that removes them and lets DBD::mysql 4.004 build with MySQL 4.0.27. Still, thanks a lot for the prompt reply!
Index: dbdimp.c =================================================================== --- dbdimp.c (revision 1182) +++ dbdimp.c (revision 1185) @@ -3423,11 +3423,7 @@ if (!imp_sth->result) { do_error(sth, JW_ERR_SEQUENCE, "fetch() without execute()" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return Nullav; } @@ -3587,11 +3583,7 @@ if (mysql_errno(&imp_dbh->mysql)) do_error(sth, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif #if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION @@ -3925,11 +3917,7 @@ /* Are we asking for a legal value? */ if (what < 0 || what >= AV_ATTRIB_LAST) do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif /* Return cached value, if possible */ else if (cacheit && imp_sth->av_attr[what]) @@ -3939,11 +3927,7 @@ else if (!res) do_error(sth, JW_ERR_NOT_ACTIVE, "statement contains no result" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif /* Do the real work. */ else { @@ -4258,11 +4242,7 @@ { do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, "Illegal parameter number" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif return FALSE; } @@ -4285,11 +4265,7 @@ "Binding non-numeric field %d, value %s as a numeric!", param_num, neatsvpv(value,0)); do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, err_msg -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif } } @@ -4297,11 +4273,7 @@ { do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Output parameters not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return FALSE; } @@ -4459,11 +4431,7 @@ if (!my_login(h, imp_dbh)) { do_error(h, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif memcpy (&imp_dbh->mysql, &save_socket, sizeof(save_socket)); ++imp_dbh->stats.auto_reconnects_failed; return FALSE; Index: dbdimp.h =================================================================== --- dbdimp.h (revision 1182) +++ dbdimp.h (revision 1185) @@ -29,6 +29,7 @@ * statements as opposed to emulation in the driver */ #define SQL_STATE_VERSION 40101 +#define WARNING_COUNT_VERSION 40101 #define FIELD_CHARSETNR_VERSION 40101 /* should equivalent to 4.1.0 */ #define MULTIPLE_RESULT_SET_VERSION 40102 #define SERVER_PREPARE_VERSION 40103 @@ -42,8 +43,12 @@ #define mysql_sqlstate(svsock) (NULL) #endif +#if MYSQL_VERSION_ID < WARNING_COUNT_VERSION +#define mysql_warning_count(svscok) 0 +#endif + /* * The following are return codes passed in $h->err in case of * errors by DBD::mysql. Index: Makefile.PL =================================================================== --- Makefile.PL (revision 1182) +++ Makefile.PL (revision 1185) @@ -220,6 +220,7 @@ 'DIST_DEFAULT' => 'all installhtml tardist', 'COMPRESS' => "gzip -9f" }, 'clean' => { 'FILES' => '*.xsi' }, + 'realclean' => { 'FILES' => 't/mysql.mtest' }, 'C' => ["dbdimp.c", "mysql.c"], 'XS' => {'mysql.xs' => 'mysql.c'}, 'OBJECT' => '$(O_FILES)',
Download (untitled) / with headers
text/plain 701b
On Fri Mar 23 10:01:25 2007, ROAM wrote: Show quoted text
> On Thu Mar 22 12:15:46 2007, CAPTTOFU wrote:
> > Thanks for letting me know about this. It has been fixed in the latest > > 4.004 that will be released later today.
> > Unfortunately, 4.004 does not quite fix this - there are still > a couple of leftover #ifdef's in dbdimp.c. Attached is a patch > that removes them and lets DBD::mysql 4.004 build with MySQL 4.0.27. > > Still, thanks a lot for the prompt reply!
Erm... oops! I uploaded a patch that changes much too much - it includes some other changes that I'll submit as separate RT tickets. Here's the "real" sqlstate-purge patch for 4.004, also available at http://devel.ringlet.net/db/DBD-mysql/
Index: dbdimp.c =================================================================== --- dbdimp.c (revision 1182) +++ dbdimp.c (revision 1185) @@ -3423,11 +3423,7 @@ if (!imp_sth->result) { do_error(sth, JW_ERR_SEQUENCE, "fetch() without execute()" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return Nullav; } @@ -3587,11 +3583,7 @@ if (mysql_errno(&imp_dbh->mysql)) do_error(sth, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif #if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION @@ -3925,11 +3917,7 @@ /* Are we asking for a legal value? */ if (what < 0 || what >= AV_ATTRIB_LAST) do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif /* Return cached value, if possible */ else if (cacheit && imp_sth->av_attr[what]) @@ -3939,11 +3927,7 @@ else if (!res) do_error(sth, JW_ERR_NOT_ACTIVE, "statement contains no result" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif /* Do the real work. */ else { @@ -4258,11 +4242,7 @@ { do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, "Illegal parameter number" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , NULL); -#else - ); -#endif return FALSE; } @@ -4285,11 +4265,7 @@ "Binding non-numeric field %d, value %s as a numeric!", param_num, neatsvpv(value,0)); do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, err_msg -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif } } @@ -4297,11 +4273,7 @@ { do_error(sth, JW_ERR_NOT_IMPLEMENTED, "Output parameters not implemented" -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION ,NULL); -#else - ); -#endif return FALSE; } @@ -4459,11 +4431,7 @@ if (!my_login(h, imp_dbh)) { do_error(h, mysql_errno(&imp_dbh->mysql), mysql_error(&imp_dbh->mysql) -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION , mysql_sqlstate(&imp_dbh->mysql)); -#else - ); -#endif memcpy (&imp_dbh->mysql, &save_socket, sizeof(save_socket)); ++imp_dbh->stats.auto_reconnects_failed; return FALSE;
Fixing, working on this now ;)
Fixed in upcoming 4.005


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.