Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
8字节整数,带条令和PHP_Php_Postgresql_Floating Point_Doctrine_Integer - Fatal编程技术网

8字节整数,带条令和PHP

8字节整数,带条令和PHP,php,postgresql,floating-point,doctrine,integer,Php,Postgresql,Floating Point,Doctrine,Integer,球员们: 64位linux和 PHP5(ZendFramework 1.10.2) PostgreSQL 8.3 原则1.2 通过Flash/Flex客户端,我得到一个8字节的整数值。 数据库中的字段是BIGINT(8字节) PHP_INT_SIZE显示系统支持8字节整数 按原样和intval()打印代码中的值会导致: Plain: 1269452776100 intval: 1269452776099 浮点舍入失败 但真正让我发疯的是 错误:整数“1269452776099.000

球员们:

  • 64位linux和
  • PHP5(ZendFramework 1.10.2)
  • PostgreSQL 8.3
  • 原则1.2
  • 通过Flash/Flex客户端,我得到一个8字节的整数值。
    数据库中的字段是BIGINT(8字节)

    PHP_INT_SIZE显示系统支持8字节整数

    按原样和intval()打印代码中的值会导致:

    Plain:  1269452776100  
    intval: 1269452776099  
    
    浮点舍入失败

    但真正让我发疯的是

    错误:整数“1269452776099.000000”的输入语法无效

    当我尝试在查询中使用它时。比如:

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

    我该怎么处理这件事?或者我如何给条令一个浮点数,它应该在bigint字段上使用它

    非常感谢您的帮助
    短暂性脑缺血发作

    编辑:

    从模型中:

        $this->hasColumn('external_id', 'integer', 8, array(
         'type' => 'integer',
         'length' => 8,
         'fixed' => false,
         'unsigned' => false,
         'notnull' => false,
         'primary' => false,
         ));
    
    数据库字段为bigint 8字节

    编辑2:
    似乎是问题的根源

    正如您已经提到的,您击中了

    要解决此问题,请将参数作为字符串传递,并确保在数据库端将其转换为
    BIGINT

    $q = Doctrine_Query::create();
    $q->from('table AS t')
      ->where("t.external_id = CAST(:external_id AS BIGINT)", array(':external_id'  => $external_id))
      ->limit(1);
    $result = $q->execute();
    

    您是从DB、yaml模式构建rou模型,还是手动创建的?这听起来像是列的模型定义和它的实际类型之间有一个反差。yaml是从DB构建的,模型是从yaml构建的。模型定义和数据库是否正确。PostgreSQL 7.3?你确定吗?把它送到博物馆,那是它的归属地。没有支持,没有更新,没有安全性。还是说8.3版?
    $q = Doctrine_Query::create();
    $q->from('table AS t')
      ->where("t.external_id = CAST(:external_id AS BIGINT)", array(':external_id'  => $external_id))
      ->limit(1);
    $result = $q->execute();