php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77863 PDO firebird support type Boolean in input parameters
Submitted: 2019-04-07 11:42 UTC Modified: 2019-09-10 07:24 UTC
From: sim-mail at list dot ru Assigned: cmb (profile)
Status: Closed Package: PDO Firebird
PHP Version: 7.3.4 OS: any
Private report: No CVE-ID: None
 [2019-04-07 11:42 UTC] sim-mail at list dot ru
Description:
------------
PDO firebird does not support type Boolean in input parameters

Test script:
---------------
$sql = <<<SQL
with t(b, s) as (
  select true, 'true' from rdb\$database
  union all
  select false, 'false' from rdb\$database
  union all
  select unknown, 'unknown' from rdb\$database
)
select trim(s) as s from t where b is not distinct from :p
SQL;

require 'testdb.inc';
$db = new PDO('firebird:dbname='.$test_base, $user, $password) or die;
try { 
  // PDO::PARAM_BOOL

  $query = $db->prepare($sql);
  
  $query->bindValue('p', 0, PDO::PARAM_BOOL);
  $query->execute();
  var_dump($query->fetchColumn(0));  
  
  $query->bindValue('p', 1, PDO::PARAM_BOOL);
  $query->execute();
  var_dump($query->fetchColumn(0));  
  
  $query->bindValue('p', false, PDO::PARAM_BOOL);
  $query->execute();
  var_dump($query->fetchColumn(0));   
  
  $query->bindValue('p', true, PDO::PARAM_BOOL);
  $query->execute();
  var_dump($query->fetchColumn(0));     
  echo "OK\n";
}
catch(Exception $e) {
	echo $e->getMessage() . '<br>';
	echo $e->getTraceAsString();
}

Expected result:
----------------
string(5) "false"
string(4) "true"
string(5) "false"
string(4) "true"
OK


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-07 12:12 UTC]
The following pull request has been associated:

Patch Name:  Request #77863 Add support boolean datatype for PDO Firebird in input parameters
On GitHub:  https://github.com/php/php-src/pull/4014
Patch:      https://github.com/php/php-src/pull/4014.patch
 [2019-09-10 07:24 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC