Skip to content

Commit e9c27e2

Browse files
committed
Fix version checks, add comment, add LUW version check
1 parent 7e973ed commit e9c27e2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/test_boolean.phpt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ IBM-DB2: Boolean data type test.
55

66
require_once('skipif.inc');
77

8-
// This test requires IBM i 7.5 or a version of LUW that supports boolean
8+
// This test requires IBM i 7.5 or DB2/LUW 9.7 for the boolean type
99
require_once('connection.inc');
1010
$conn = db2_connect($database, $user, $password);
1111
if (!$conn) {
@@ -15,14 +15,19 @@ if (!$conn) {
1515
$info = db2_server_info($conn);
1616
if ($info->DBMS_NAME == "AS") { // IBM i
1717
// DBMS_VER is VVRRM string
18-
$major = $info[1];
19-
$minor = $info[3];
20-
$mod = $info[4];
18+
$major = $info["DBMS_VER"][1];
19+
$minor = $info["DBMS_VER"][3];
20+
$mod = $info["DBMS_VER"][4];
2121
if (!version_compare("$major.$minor.$mod", "7.5.0", ">=")) {
2222
die("skip IBM i version too old");
2323
}
24+
} else { // Should cover i.e. DB2/LINUX
25+
// DBMS_VER is VV.RR.MMMM, version_compore should work directly
26+
if (!version_compare($info["DBMS_VER"], "9.7.0", ">=")) {
27+
die("skip DB2 version too old");
28+
}
2429
}
25-
// XXX: LUW, z
30+
// XXX: z
2631

2732
?>
2833
--FILE--
@@ -40,6 +45,7 @@ $s = db2_exec($conn, "values (true, false)");
4045
$r = db2_fetch_array($s);
4146
var_dump($r);
4247

48+
// db2_result can't return true/false due to API limitations, so these will be ints
4349
$s = db2_exec($conn, "values (true, false)");
4450
db2_fetch_row($s);
4551
var_dump(db2_result($s, 0));

0 commit comments

Comments
 (0)