[PHP-DOC] Re: [PHP-DEV] PHP 4.0 Bug #6675: mysql_insert_id returns incorrect size for BIGINT fields From: Daniel Beckham (danbeck <email protected>)
Date: 09/11/00

I just submitted this bug report. If it helps at all, I found this in the
source code.

In php_mysql.c, ~1103:
        /* conversion from int64 to long happing here */
        return_value->value.lval = (long) mysql_insert_id(mysql);
        return_value->type = IS_LONG;

It appears that this problem is already known. Are there any plans to
actually support large database field types? If this is an inherent problem
with PHP/Zend then the large integer fields in various databases are
useless.

Thanks,

Daniel Beckham

----- Original Message -----
From: <danbeck <email protected>>
To: <php-dev <email protected>>
Sent: Tuesday, September 12, 2000 3:54 AM
Subject: [PHP-DEV] PHP 4.0 Bug #6675: mysql_insert_id returns incorrect size
for BIGINT fields

> From: danbeck <email protected>
> Operating system: Linux (redhat 6.1)
> PHP version: 4.0.0
> PHP Bug Type: MySQL related
> Bug description: mysql_insert_id returns incorrect size for BIGINT fields
>
> If you have a table with an auto_increment BIGINT field:
>
> CREATE TABLE bigtest (
> id bigint(20) NOT NULL auto_increment,
> PRIMARY KEY (id)
> );
>
> and the last ID you inserted was larger than 32 bits:
>
> i.e. 293949384923
>
> If you insert a new record using:
>
> insert into bigtest values (null);
>
> mysql_insert_id() will return an incorrect number usually negative. It
looks like it's storing that large (64bit) number in a 32bit field of some
sort before returning it to the caller.
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
> For additional commands, e-mail: php-dev-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>