zendframework/zend-db

PDO, PostgreSQL and bool

Opened this issue · 2 comments

GeeH commented

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7284
User: @mbn18
Created On: 2015-03-01T17:06:51Z
Updated At: 2015-03-02T13:53:18Z
Body
PDO cast bool values to string so when such value is passed to PostgreSQL it fail:
Example:

$value = false;
$sql = "INSERT INTO table (bool_field) VALUES (?);
$this->getAdapter()->query($sql)->execute([$values]);

To go around the problem I issue:

$value = ($value) ? true : '0';

Is it possible to cast such values in the driver?

Related info


Comment

User: @Ocramius
Created On: 2015-03-02T13:53:18Z
Updated At: 2015-03-02T13:53:18Z
Body
Eventually related:


Related to #125

This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#114.