mysql_errno() problem with recent MySQL versions
| From: | Paul DuBois | Date: | Thu, 16 Sep 1999 01:31:02 +0000 |
| Subject: | mysql_errno() problem with recent MySQL versions | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4503@lists.php.net to get a copy of this message | ||
I'll report this for PHP 4, but it's also a problem with PHP 3.
Support for mysql_errno() in ext/mysql/mysql.c (functions/mysql.c
for PHP 3) is enabled based on tests of the following form:
#ifdef mysql_errno
... include a bunch of code here ...
#endif
For example:
#ifdef mysql_errno
PHP_FE(mysql_errno,
NULL)
#endif
That used to work because mysql_errno() used to be a macro, defined
in mysql.h:
#define mysql_errno(mysql) (mysql)->net.last_errno
But in recent versions of MySQL, mysql_errno() is a true function.
The result is that the PHP support for MySQL doesn't include
mysql_errno() and any calls to the corresponding PHP function result
in errors like this:
Fatal error: Call to unsupported or undefined function mysql_errno()
I'm not sure what the best way to fix this is, but I've changed
the test to the one shown below in my source and it seems to work.
It's based on the fact that mysql_errno() was introduced in MySQL 3.21.7.
#if MYSQL_VERSION_ID >= 32107
#endif
I can supply a patch if anyone wants it.
This problem will occur with versions of MySQL from 3.23.0
on; that's where mysql_errno() changed from a macro to a
function.
--
Paul DuBois, paul@snake.net