-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from php/bool
Boolean support
- Loading branch information
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--TEST-- | ||
pdo_ibm: Boolean data type | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
require_once('fvt.inc'); | ||
class Test extends FVTTest | ||
{ | ||
public function runTest() | ||
{ | ||
// XXX: Skip on older LUW/i | ||
$this->connect(); | ||
|
||
// Tests insert and select | ||
try { | ||
$this->db->exec("drop table booltest"); | ||
} catch (Exception $e) {} | ||
$this->db->exec("create table booltest (id integer not null, enabled boolean, primary key(id))"); | ||
|
||
$s = $this->db->prepare("insert into booltest (id, enabled) values (1, ?)"); | ||
$x = true; | ||
$s->bindParam(1, $x, PDO::PARAM_BOOL); | ||
$r = $s->execute();; | ||
|
||
$s = $this->db->prepare("insert into booltest (id, enabled) values (2, ?)"); | ||
$x = false; | ||
$s->bindParam(1, $x, PDO::PARAM_BOOL); | ||
$r = $s->execute(); | ||
|
||
$s = $this->db->prepare("select * from booltest"); | ||
$s->execute(); | ||
while ($r = $s->fetch(PDO::FETCH_ASSOC)) { | ||
// This can return 0/1 on LUW or TRUE/FALSE on i | ||
echo $r["ID"] . ": " . $r["ENABLED"] . "\n"; | ||
} | ||
} | ||
} | ||
|
||
$testcase = new Test(); | ||
$testcase->runTest(); | ||
?> | ||
--EXPECTREGEX-- | ||
1: (1|TRUE) | ||
2: (0|FALSE) |