8 byte Integer with Doctrine and PHP

Posted by Rufinus on Stack Overflow See other posts from Stack Overflow or by Rufinus
Published on 2010-03-24T18:09:32Z Indexed on 2010/03/24 18:13 UTC
Read the original article Hit count: 344

Hi,

the players:

  1. 64bit linux with
  2. php 5 (ZendFramework 1.10.2)
  3. PostgreSQL 7.3
  4. Doctrine 1.2

Via a Flash/Flex client i get an 8byte integer value.
the field in the database is an BIGINT (8 byte)

PHP_INT_SIZE show that system supports 8byte integer.

printing out the value in the code as it is and as intval() leads to this:

Plain:  1269452776100  
intval: 1269452776099  

float rounding failure ?

but what really driving me nuts is

ERROR: invalid input syntax for integer: "1269452776099.000000"'

when i try to use it in a query. like:

Doctrine_Core::getTable('table')->findBy('external_id',$external_id);

or

Doctrine_Core::getTable('table')->findBy('external_id',intval($external_id));

How i am supposed to handle this ? or how can i give doctrine a floating point number which it should use on a bigint field ?

Any help is much appreciated!
TIA

© Stack Overflow or respective owner

Related posts about php5

Related posts about doctrine