RE: [PHP-DEV] Re: PHP 4.0 Bug #6675 Updated: mysql_insert_id returns incorrect size for BIGINT fields

From: Date: Mon, 15 Jan 2001 15:22:49 +0000
Subject: RE: [PHP-DEV] Re: PHP 4.0 Bug #6675 Updated: mysql_insert_id returns incorrect size for BIGINT fields
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-44138@lists.php.net to get a copy of this message
What are the "casting" issues involved if we return a string? What is the potential for this breaking someones code who doesn't cross the 32bit boundary? Sean > -----Original Message----- > From: Daniel Beckham [mailto:danbeck@dealnews.com] > Sent: Monday, January 15, 2001 10:30 AM > To: Bug Database > Cc: elixer@erols.com > Subject: [PHP-DEV] Re: PHP 4.0 Bug #6675 Updated: mysql_insert_id > returns incorrect size for BIGINT fields > > > The documentation explains this issue because I wrote the > addition after > discovering this issue. I have a phpdoc cvs account... > Please re-open this > issue, unless the PHP team has no current plans to fix it. > > Daniel > > ----- Original Message ----- > From: "Bug Database" <php-dev@lists.php.net> > To: <danbeck@dealnews.com> > Sent: Monday, January 15, 2001 3:30 AM > Subject: PHP 4.0 Bug #6675 Updated: mysql_insert_id returns > incorrect size > for BIGINT fields > > > > ID: 6675 > > Updated by: sniper > > Reported By: danbeck@dealnews.com > > Old-Status: Open > > Status: Closed > > Bug Type: MySQL related > > Assigned To: > > Comments: > > > > Feedback by Sean R. Bright <elixer@erols.com>: > > ---------------------------------------------- > > the documentation for mysql_insert_id() > > states that for very large values of the returned id > (>32bits) this will > return the wrong data and users should use LAST_INSERT_ID() > to fetch that > > info from mysql instead. > > ---------------------------------------------- > > > > > > > > Previous Comments: > > > -------------------------------------------------------------- > ------------ > - > > > > [2000-09-12 21:45:15] danbeck@php.net > > I researched this a little more and found this code snippit > at line 1100: > > > > ZEND_FETCH_RESOURCE2(mysql, MYSQL *, mysql_link, id, "MySQL-Link", > le_link, le_plink); > > > > /* conversion from int64 to long happing here */ > > return_value->value.lval = (long) mysql_insert_id(mysql); > > return_value->type = IS_LONG; > > > > > > Is there any way that this could be converted into a string before > returning? (Forgive me if I'm over simplifying this...) > > > > > > > -------------------------------------------------------------- > ------------ > - > > > > [2000-09-12 04:54:10] danbeck@dealnews.com > > 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. > > > > > > > -------------------------------------------------------------- > ------------ > - > > > > > > Full Bug description available at: > > http://bugs.php.net/?id=6675 > > > > > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.dev (#44138) next »