Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.

Поиск
Список
Период
Сортировка
От Mark Kirkwood
Тема Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.
Дата
Msg-id 4AAF32AA.1010408@catalyst.net.nz
обсуждение исходный текст
Ответ на Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.  (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>)
Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.  (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>)
Список pgsql-bugs
Tom Lane wrote:
> "Yujin" <aloudnoise@mail.ru> writes:
>
>> When i get query from table with bolean type fields, that have false value ,
>> function PDO -> fetch  return that fields with not "0" value , but empty
>> string.
>>
>
> Are you sure the field is actually false, and not null?
>
> If so, this is a PDO bug, not a Postgres bug.
>
>             regards, tom lane
>
>
Does seem to be a PDO bug or some sort:

Trying out some code with Php 5.3.1-dev:

$sql = "SELECT false";
$stmt = $dbh->query($sql);
$result = $stmt->fetch(PDO::FETCH_NUM);
print("  " . $result[0] . "\n");

reproduces what Yujin is seeing, whereas replacing $sql with:

$sql = "SELECT false::int4";

gives a 0 in the result array. I guess it must be something funny with
how PDO represents the bool type...(will have a look at the PDI code).
But this needs to be raised on bugs.php.net.

Cheers

Mark

В списке pgsql-bugs по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: BUG #5055: Invalid page header error
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Re: BUG #5054: PDO -> Query returns "" from Boolean type field, if it has false value.