At 2:08 PM -0500 2000-01-26, Paul Ferris wrote:
>A while back I asked if anybody knew anything about these
>functions. I'm having problems with mysql_errno not being
>defined:
>
>Call to unsupported or undefined function mysql_errno() in
>
>It's an included library in a php3 page. I've been all over the
>Msql-Mysql mailing list archives, and can't find any reference
>to the change that brought this on.
>
>Somebody here said they knew of a patch or a macro definition
>to fix this.
>
>Thought I'd ask again...
>
>Thanks!
That was probably me.
Recap:
mysql_errno() used to be a macro, and is tested as such in the
PHP sources. This breaks with curent versions of MySQL, in which
mysql_errno() is a function.
To fix this, try the following patch in the functions directory of
the PHP distribution. A better patch would test the version number
of MySQL, but this should work for any current versions.
--- mysql.c.orig Sun Jul 4 13:30:42 1999
+++ mysql.c Wed Jan 26 13:13:03 2000
@@ -115,9 +115,7 @@
{"mysql_list_tables", php3_mysql_list_tables, NULL},
{"mysql_list_fields", php3_mysql_list_fields, NULL},
{"mysql_error", php3_mysql_error,
NULL},
-#ifdef mysql_errno
{"mysql_errno", php3_mysql_errno,
NULL},
-#endif
{"mysql_affected_rows", php3_mysql_affected_rows, NULL},
{"mysql_insert_id", php3_mysql_insert_id, NULL},
{"mysql_result", php3_mysql_result,
NULL},
@@ -529,7 +527,7 @@
#if APACHE
handler=signal(SIGPIPE,SIG_IGN);
#endif
-#if defined(mysql_errno) && defined(CR_SERVER_GONE_ERROR)
+#if defined(CR_SERVER_GONE_ERROR)
mysql_stat(le->ptr);
if (mysql_errno((MYSQL *)le->ptr) ==
CR_SERVER_GONE_ERROR) {
#else
@@ -1144,7 +1142,6 @@
/* {{{ proto int mysql_errno([int link_identifier])
Returns the number of the error message from previous MySQL operation */
-#ifdef mysql_errno
void php3_mysql_errno(INTERNAL_FUNCTION_PARAMETERS)
{
pval *mysql_link;
@@ -1180,7 +1177,6 @@
RETURN_LONG(mysql_errno(mysql));
}
-#endif
/* }}} */
/* {{{ proto int mysql_affected_rows([int link_identifier])
--
Paul DuBois, paul@stripped