2 messages in com.mysql.lists.perlDBD::mysql module doesn't return prop...| From | Sent On | Attachments |
|---|---|---|
| Chris Adams | 19 Jan 2001 14:36 | |
| Chris Adams | 19 Jan 2001 14:55 |
| Subject: | DBD::mysql module doesn't return proper error codes with MySQL 3.23![]() |
|---|---|
| From: | Chris Adams (cmad...@hiwaay.net) |
| Date: | 01/19/2001 02:36:08 PM |
| List: | com.mysql.lists.perl |
In MySQL 3.23, mysql_errno changed from a define to a function. This breaks Msql-Mysql-modules (up to version 1.2215), which assumes that mysql_errno is a define if it is available at all. So, $h->err always returns 5.
Here is a patch that fixes this (this works, but it may not be the best way, but I'm not highly familiar with the code):
************************************************************************
diff -urN Msql-Mysql-modules-1.2215-dist/dbd/dbdimp.c
Msql-Mysql-modules-1.2215/dbd/dbdimp.c
--- Msql-Mysql-modules-1.2215-dist/dbd/dbdimp.c Wed May 10 16:44:06 2000
+++ Msql-Mysql-modules-1.2215/dbd/dbdimp.c Fri Jan 19 16:29:54 2001
@@ -40,7 +40,10 @@
DBISTATE_DECLARE;
-#if defined(DBD_MYSQL) && defined(mysql_errno) +#if defined(DBD_MYSQL) && MYSQL_VERSION_ID >= 32300 +#define have_mysql_errno +#endif +#if defined(DBD_MYSQL) && defined(have_mysql_errno) #define DO_ERROR(h, c, s) do_error(h, (int) mysql_errno(s), mysql_error(s)) #else #define DO_ERROR(h, c, s) do_error(h, c, MyError(s)) @@ -931,7 +934,7 @@ break; case 'e': if (strEQ(key, "errno")) { -#if defined(DBD_MYSQL) && defined(mysql_errno) +#if defined(DBD_MYSQL) && defined(have_mysql_errno) return sv_2mortal(newSViv((IV)mysql_errno(imp_dbh->svsock))); #else return sv_2mortal(newSViv(-1)); ************************************************************************
-- Chris Adams <cmad...@hiwaay.net> Systems and Network Administrator - HiWAAY Internet Services I don't speak for anybody but myself - that's enough trouble.




