zendframework/zend-db

SQL functions miscast boolean values

Opened this issue · 1 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/7543
User: @hschletz
Created On: 2015-05-23T09:02:46Z
Updated At: 2015-11-06T21:50:08Z
Body
This does not work (tested with SQLite):

$select->where(array('column1' => true, 'column2' => false));

which results in

... WHERE column1 = '1' AND column2 = ''

The first one is ugly, but works as expected while the second does not.

I can work around it by using 0 instead of FALSE, but these surrogates are awful and unintuitive - a number is not really a boolean. A Zend\Db\Sql\Literal would work too, but that's a lot of typing for a simple primitive. The SQL generating code should treat boolean values as such and generate literal TRUE and FALSE.


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