mirror of
https://github.com/php/pecl-database-ibm_db2.git
synced 2026-03-23 23:02:16 +01:00
Adding V6R1 iSeries system support
This commit is contained in:
@@ -9,6 +9,38 @@ $port = 60000;
|
||||
$db = $database;
|
||||
$username = $user;
|
||||
|
||||
// test connection ok
|
||||
$prepconn = db2_connect($database, $user, $password);
|
||||
if (!$prepconn) die('skip');
|
||||
|
||||
// control skipif.inc
|
||||
$server = db2_server_info($prepconn);
|
||||
if ($server->DBMS_NAME == "QSQ" || $server->DBMS_NAME == "AS") {
|
||||
if ($server->DBMS_VER > "06000") $rel = "V6";
|
||||
else $rel = "V5";
|
||||
// PASE test_xxx_V5V6.phpt
|
||||
if (eregi("V6|V5", $_SERVER["PHP_SELF"])) {
|
||||
if (!eregi($rel, $_SERVER["PHP_SELF"])) {
|
||||
die('skip');
|
||||
}
|
||||
}
|
||||
// check the skipif.PASE
|
||||
else {
|
||||
$result=file_get_contents("skipif.PASE");
|
||||
for ($line = strtok($result, "\n"); $line; $line = strtok("\n")) {
|
||||
$pos=strpos($line,"PASE");
|
||||
if ($pos && strpos($line, "|$rel|")){
|
||||
$check = substr($line, 1, $pos-6);
|
||||
if (strpos($_SERVER["PHP_SELF"], $check)) {
|
||||
die('skip');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (eregi("V5|V6",$_SERVER["PHP_SELF"])) die('skip');
|
||||
}
|
||||
|
||||
db2_close($prepconn);
|
||||
?>
|
||||
|
||||
25
tests/escape_out.dat
Normal file
25
tests/escape_out.dat
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Original: Some random special characters:
|
||||
,
|
||||
, \ , ' , " .
|
||||
db2_escape_string: Some random special characters:
|
||||
,
|
||||
, \ , ' , " .
|
||||
|
||||
Original: Backslash (\). Single quote ('). Double quote (")
|
||||
db2_escape_string: Backslash (\). Single quote ('). Double quote (")
|
||||
|
||||
Original: The NULL character \0 must be escaped manually
|
||||
db2_escape_string: The NULL character \0 must be escaped manually
|
||||
|
||||
Original: Intersting characters must be escaped manually: \x1a , \x00 .
|
||||
db2_escape_string: Intersting characters must be escaped manually: \x1a , \x00 .
|
||||
|
||||
Original: Nothing to quote
|
||||
db2_escape_string: Nothing to quote
|
||||
|
||||
Original: 200676
|
||||
db2_escape_string: 200676
|
||||
|
||||
Original:
|
||||
db2_escape_string:
|
||||
49
tests/skipif.PASE
Normal file
49
tests/skipif.PASE
Normal file
@@ -0,0 +1,49 @@
|
||||
test_002.phpt|PASE|V5|V6|test specific protocol not valid|
|
||||
test_023.phpt|PASE|V5|V6|i5 column priv (bug?) vs LUW column priv|
|
||||
test_039.phpt|PASE|V5|V6|i5 .10 vs LUW 0.10|
|
||||
test_041.phpt|PASE|V5|V6|i5 .10 vs LUW 0.10|
|
||||
test_053.phpt|PASE|V5|V6|i5 no support (V6R1?) vs LUW client attributes|
|
||||
test_060.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_061.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_062.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_064.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_065.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_066.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
|
||||
test_080.phpt|PASE|V5|V6|i5 SQLSTATE=42705 vs LUW SQLSTATE=800xxx|
|
||||
test_090.phpt|PASE|V5|V6|i5 different error msg vs LUW|
|
||||
test_091.phpt|PASE|V5|V6|i5 different error msg vs LUW|
|
||||
test_092.phpt|PASE|V5|V6|i5 different error msg vs LUW|
|
||||
test_102.phpt|PASE|V5|V6|i5 no support vs LUW SQL VALUES(1)|
|
||||
test_131a.phpt|PASE|V5|V6|i5 db2_num_rows error vs LUW -1|
|
||||
test_133.phpt|PASE|V5|V6|i5 different error msg vs LUW|
|
||||
test_149.phpt|PASE|V5|V6|i5 varchar len 10 vs LUW data len|
|
||||
test_160.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
|
||||
test_161.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
|
||||
test_162.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
|
||||
test_180.phpt|PASE|V5|V6|i5 different error msg vs LUW|
|
||||
test_191.phpt|PASE|V5|V6|i5 IS_NULLABLE (na v5r4) and need schema (v6r1)|
|
||||
test_192.phpt|PASE|V5|i5 IS_NULLABLE (na v5r4)|
|
||||
test_194.phpt|PASE|V5|V6|i5 data ok vs LUW error (LUW bug)|
|
||||
test_195.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
|
||||
test_196.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
|
||||
test_198.phpt|PASE|V5|V6|i5 blob data ASCII vs LUW blob data hex|
|
||||
test_201.phpt|PASE|V5|V6|i5 .20 vs LUW 0.20|
|
||||
test_210.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
|
||||
test_211.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
|
||||
test_212.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
|
||||
test_213.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
|
||||
test_240.phpt|PASE|V5|V6|i5 field widths (bug?) vs LUW field widths|
|
||||
test_241.phpt|PASE|V5|V6|i5 field widths (bug?) vs LUW field widths|
|
||||
test_260.phpt|PASE|V5|V6|stdClass)#2 vs LUW stdClass)#1 (bug?)|
|
||||
test_263.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
|
||||
test_300.phpt|PASE|V5|V6|i5 server info (V6R1?) vs LUW server info|
|
||||
test_310.phpt|PASE|V5|V6|i5 client info (V6R1?) vs LUW client info|
|
||||
test_321.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
|
||||
test_6792.phpt|PASE|V5|V6|i5 time seperator vs LUW time seperator|
|
||||
test_9173.phpt|PASE|V5|V6|i5 store proc info vs LUW store proc info|
|
||||
test_10931.phpt|PASE|V5|V6|i5 default schema is DB2 not TEST|
|
||||
test_clob_special_char.phpt|PASE|V5|V6|insert:3030802e expect:3030802e actual:30301a2e |
|
||||
test_trusted_context_connect.phpt|PASE|V5|V6|i5 no trust?|
|
||||
test_trusted_context_pconnect.phpt|PASE|V5|V6|i5 no trust?|
|
||||
test_10353.phpt|PASE|V5|V6|i5 PHP no compiled debug mode|
|
||||
test_last_insert_id.phpt|PASE|V5|V6|i5 sql IDENTITY_VAL_LOCAL()|
|
||||
@@ -2,4 +2,5 @@
|
||||
if (!extension_loaded('ibm_db2')) {
|
||||
die('skip');
|
||||
}
|
||||
require_once('connection.inc');
|
||||
?>
|
||||
|
||||
19
tests/skipifNotRowcountPrefetch.inc
Normal file
19
tests/skipifNotRowcountPrefetch.inc
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if (!extension_loaded('ibm_db2')) {
|
||||
die('skip');
|
||||
}
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$server = db2_server_info( $conn );
|
||||
$client = db2_client_info( $conn );
|
||||
|
||||
$minversion = "09.05.0003";
|
||||
|
||||
if ( ($server->DBMS_VER < $minversion) || ($client->DRIVER_VER < $minversion ) ) {
|
||||
die('skip');
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
tests/spook_out.png
Normal file
BIN
tests/spook_out.png
Normal file
Binary file not shown.
36
tests/test_017.phpt
Normal file
36
tests/test_017.phpt
Normal file
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_num_rows - select (rowcount prefetch) - stmt option
|
||||
--SKIPIF--
|
||||
<?php require_once('skipifNotRowcountPrefetch.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_ON );
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_exec( $conn, "SELECT * from animals WHERE weight < 10.0", array('cursor' => DB2_SCROLLABLE) );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
echo "\n";
|
||||
$stmt = db2_exec( $conn, "SELECT * from animals WHERE weight < 10.0", array('cursor' => DB2_FORWARD_ONLY) );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
echo "\n";
|
||||
$stmt = db2_exec( $conn, "SELECT * from animals WHERE weight < 10.0", array('rowcount' => DB2_ROWCOUNT_PREFETCH_ON) );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
echo "\n";
|
||||
$stmt = db2_exec( $conn, "SELECT * from animals WHERE weight < 10.0", array('rowcount' => DB2_ROWCOUNT_PREFETCH_OFF) );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Number of affected rows: 4
|
||||
Number of affected rows: -1
|
||||
Number of affected rows: 4
|
||||
Number of affected rows: -1
|
||||
42
tests/test_018.phpt
Normal file
42
tests/test_018.phpt
Normal file
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_num_rows - select (rowcount prefetch) - set option
|
||||
--SKIPIF--
|
||||
<?php require_once('skipifNotRowcountPrefetch.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_ON );
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_prepare( $conn, "SELECT * from animals WHERE weight < 10.0" );
|
||||
$options = array('rowcount' => DB2_ROWCOUNT_PREFETCH_ON);
|
||||
db2_set_option($stmt, $options, 2);
|
||||
db2_execute( $stmt );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
echo "\n";
|
||||
db2_free_result( $stmt );
|
||||
$options = array('rowcount' => DB2_ROWCOUNT_PREFETCH_OFF);
|
||||
db2_set_option($stmt, $options, 2);
|
||||
db2_execute( $stmt );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
echo "\n";
|
||||
db2_free_result( $stmt );
|
||||
$options = array('rowcount' => DB2_ROWCOUNT_PREFETCH_ON);
|
||||
db2_set_option($stmt, $options, 2);
|
||||
db2_execute( $stmt );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Number of affected rows: 4
|
||||
Number of affected rows: -1
|
||||
Number of affected rows: 4
|
||||
26
tests/test_019.phpt
Normal file
26
tests/test_019.phpt
Normal file
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_num_rows - select (rowcount prefetch) - prep option
|
||||
--SKIPIF--
|
||||
<?php require_once('skipifNotRowcountPrefetch.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_ON );
|
||||
|
||||
if ($conn) {
|
||||
$options = array('rowcount' => DB2_ROWCOUNT_PREFETCH_ON);
|
||||
$stmt = db2_prepare( $conn, "SELECT * from animals WHERE weight < 10.0", $options );
|
||||
db2_execute( $stmt );
|
||||
echo "Number of affected rows: " . db2_num_rows( $stmt );
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Number of affected rows: 4
|
||||
31
tests/test_023_V5V6.phpt
Normal file
31
tests/test_023_V5V6.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_column_privileges -- tests the db2_column_privileges functionality
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn != 0)
|
||||
{
|
||||
$stmt = db2_column_privileges($conn, NULL, NULL, 'ANIMALS');
|
||||
$row = db2_fetch_array($stmt);
|
||||
print $row[2] . "\n";
|
||||
print $row[3] . "\n";
|
||||
print $row[7];
|
||||
db2_close($conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo db2_conn_errormsg();
|
||||
printf("Connection failed\n\n");
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
ANIMALS
|
||||
ID
|
||||
YES
|
||||
76
tests/test_039_V5V6.phpt
Normal file
76
tests/test_039_V5V6.phpt
Normal file
@@ -0,0 +1,76 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_row\(\) (index by position) - 3 - nested
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_prepare($conn, "SELECT * FROM animals", array('cursor' => DB2_SCROLLABLE) );
|
||||
db2_execute($result);
|
||||
while ($row = db2_fetch_row($result)) {
|
||||
$result2 = db2_prepare($conn, "SELECT * FROM animals", array ('cursor' => DB2_SCROLLABLE));
|
||||
db2_execute($result2);
|
||||
while ($row2 = db2_fetch_row($result2)) {
|
||||
echo db2_result($result2, 0) . " : ";
|
||||
echo db2_result($result2, 1) . " : ";
|
||||
echo db2_result($result2, 2) . " : ";
|
||||
echo db2_result($result2, 3) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
0 : cat : Pook : 3.20
|
||||
1 : dog : Peaches : 12.30
|
||||
2 : horse : Smarty : 350.00
|
||||
3 : gold fish : Bubbles : .10
|
||||
4 : budgerigar : Gizmo : .20
|
||||
5 : goat : Rickety Ride : 9.70
|
||||
6 : llama : Sweater : 150.00
|
||||
|
||||
41
tests/test_041_V5V6.phpt
Normal file
41
tests/test_041_V5V6.phpt
Normal file
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_array several rows
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_exec( $conn, "select * from animals order by breed" );
|
||||
|
||||
$i = 0;
|
||||
|
||||
while( $cols = db2_fetch_array( $stmt ) ) {
|
||||
foreach ($cols as $col) {
|
||||
print "$col ";
|
||||
}
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo "\nNumber of rows: ".$i;
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
4 budgerigar Gizmo .20
|
||||
0 cat Pook 3.20
|
||||
1 dog Peaches 12.30
|
||||
5 goat Rickety Ride 9.70
|
||||
3 gold fish Bubbles .10
|
||||
2 horse Smarty 350.00
|
||||
6 llama Sweater 150.00
|
||||
|
||||
Number of rows: 7
|
||||
57
tests/test_060_V5V6.phpt
Normal file
57
tests/test_060_V5V6.phpt
Normal file
@@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
if ($conn)
|
||||
{
|
||||
$result = db2_tables($conn,NULL,strtoupper('t'));
|
||||
$i = 0;
|
||||
while ($row=db2_fetch_both($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row[2])) {
|
||||
if ($i < 4) print $row[1] . "/" . $row[2] . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
print "done!";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
T/T1
|
||||
T/T2
|
||||
T/T3
|
||||
T/T4
|
||||
done!
|
||||
58
tests/test_061_V5.phpt
Normal file
58
tests/test_061_V5.phpt
Normal file
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 2
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
if ($conn)
|
||||
{
|
||||
$result = db2_tables($conn,NULL,strtoupper('t'));
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row['TABLE_NAME'])) {
|
||||
$str = $row['TABLE_SCHEM'] . $row['TABLE_NAME'] . $row['TABLE_TYPE'];
|
||||
if ($i < 4) print $str . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
print "done!";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TT1BASE TABLE
|
||||
TT2BASE TABLE
|
||||
TT3BASE TABLE
|
||||
TT4BASE TABLE
|
||||
done!
|
||||
58
tests/test_061_V6.phpt
Normal file
58
tests/test_061_V6.phpt
Normal file
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 2
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
if ($conn)
|
||||
{
|
||||
$result = db2_tables($conn,NULL,strtoupper('t'));
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row['TABLE_NAME'])) {
|
||||
$str = $row['TABLE_SCHEM'] . $row['TABLE_NAME'] . $row['TABLE_TYPE'];
|
||||
if ($i < 4) print $str . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
print "done!";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TT1TABLE
|
||||
TT2TABLE
|
||||
TT3TABLE
|
||||
TT4TABLE
|
||||
done!
|
||||
60
tests/test_062_V5.phpt
Normal file
60
tests/test_062_V5.phpt
Normal file
@@ -0,0 +1,60 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 3
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
if ($conn)
|
||||
{
|
||||
$schema = strtoupper('t');
|
||||
$result = db2_tables($conn,NULL,$schema);
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row[2])) {
|
||||
$str = $row[1] ."/". $row[2] ."/". $row[3];
|
||||
if ($i < 4) print $str . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
print "done!";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
T/T1/BASE TABLE
|
||||
T/T2/BASE TABLE
|
||||
T/T3/BASE TABLE
|
||||
T/T4/BASE TABLE
|
||||
done!
|
||||
60
tests/test_062_V6.phpt
Normal file
60
tests/test_062_V6.phpt
Normal file
@@ -0,0 +1,60 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 3
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
if ($conn)
|
||||
{
|
||||
$schema = strtoupper('t');
|
||||
$result = db2_tables($conn,NULL,$schema);
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row[2])) {
|
||||
$str = $row[1] ."/". $row[2] ."/". $row[3];
|
||||
if ($i < 4) print $str . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
print "done!";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
T/T1/TABLE
|
||||
T/T2/TABLE
|
||||
T/T3/TABLE
|
||||
T/T4/TABLE
|
||||
done!
|
||||
59
tests/test_064_V5.phpt
Normal file
59
tests/test_064_V5.phpt
Normal file
@@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 5
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$result = db2_tables($conn, NULL, "T");
|
||||
|
||||
for ($i=0; $i<db2_num_fields($result); $i++)
|
||||
{
|
||||
print db2_field_name($result, $i) . ", ";
|
||||
}
|
||||
print "\n\n";
|
||||
|
||||
$i = 0;
|
||||
while ($row=db2_fetch_array($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row[2])) {
|
||||
db2_num_fields($result);
|
||||
if ($i < 4) print ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", , \n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
db2_free_result($result);
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
|
||||
|
||||
, T, T1, BASE TABLE, ,
|
||||
, T, T2, BASE TABLE, ,
|
||||
, T, T3, BASE TABLE, ,
|
||||
, T, T4, BASE TABLE, ,
|
||||
59
tests/test_064_V6.phpt
Normal file
59
tests/test_064_V6.phpt
Normal file
@@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - 5
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$result = db2_tables($conn, NULL, "T");
|
||||
|
||||
for ($i=0; $i<db2_num_fields($result); $i++)
|
||||
{
|
||||
print db2_field_name($result, $i) . ", ";
|
||||
}
|
||||
print "\n\n";
|
||||
|
||||
$i = 0;
|
||||
while ($row=db2_fetch_array($result))
|
||||
{
|
||||
if (eregi("T1|T2|T3|T4",$row[2])) {
|
||||
db2_num_fields($result);
|
||||
if ($i < 4) print ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", , \n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
db2_free_result($result);
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
|
||||
|
||||
, T, T1, TABLE, ,
|
||||
, T, T2, TABLE, ,
|
||||
, T, T3, TABLE, ,
|
||||
, T, T4, TABLE, ,
|
||||
54
tests/test_065_V5.phpt
Normal file
54
tests/test_065_V5.phpt
Normal file
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - Filter by table name
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$result = db2_tables($conn, NULL, '%', "T3");
|
||||
|
||||
$columns = db2_num_fields($result);
|
||||
|
||||
for ($i=0; $i < $columns; $i++) {
|
||||
print db2_field_name($result, $i) . ", ";
|
||||
}
|
||||
print "\n\n";
|
||||
|
||||
while ($row = db2_fetch_array($result)) {
|
||||
$final = ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", " . $row[4] . ", ";
|
||||
if ($row[2][0]=='T' && $row[3][0]=='T' && $row[3][1]=='3') break;
|
||||
}
|
||||
|
||||
print $final . "\n";
|
||||
|
||||
db2_free_result($result);
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
|
||||
|
||||
, T, T3, BASE TABLE, ,
|
||||
54
tests/test_065_V6.phpt
Normal file
54
tests/test_065_V6.phpt
Normal file
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - Filter by table name
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$schema = 'CREATE SCHEMA t';
|
||||
$result = @db2_exec($conn, $schema);
|
||||
|
||||
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
|
||||
$result = @db2_exec($conn, $create);
|
||||
|
||||
$result = db2_tables($conn, NULL, '%', "T3");
|
||||
|
||||
$columns = db2_num_fields($result);
|
||||
|
||||
for ($i=0; $i < $columns; $i++) {
|
||||
print db2_field_name($result, $i) . ", ";
|
||||
}
|
||||
print "\n\n";
|
||||
|
||||
while ($row = db2_fetch_array($result)) {
|
||||
$final = ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", " . $row[4] . ", ";
|
||||
if ($row[2][0]=='T' && $row[3][0]=='T' && $row[3][1]=='3') break;
|
||||
}
|
||||
|
||||
print $final . "\n";
|
||||
|
||||
db2_free_result($result);
|
||||
|
||||
@db2_exec($conn, 'DROP TABLE t.t1');
|
||||
@db2_exec($conn, 'DROP TABLE t.t2');
|
||||
@db2_exec($conn, 'DROP TABLE t.t3');
|
||||
@db2_exec($conn, 'DROP TABLE t.t4');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
|
||||
|
||||
, T, T3, TABLE, ,
|
||||
37
tests/test_066_V5.phpt
Normal file
37
tests/test_066_V5.phpt
Normal file
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - Play with table objects
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$result = db2_tables($conn, NULL, strtoupper($user), 'ANIM%');
|
||||
|
||||
while ($row = db2_fetch_object($result)) {
|
||||
if (eregi("ANIME_CAT|ANIMALS",$row->TABLE_NAME)) {
|
||||
echo 'Schema: ' . $row->TABLE_SCHEM . "\n";
|
||||
echo 'Name: ' . $row->TABLE_NAME . "\n";
|
||||
echo 'Type: ' . $row->TABLE_TYPE . "\n";
|
||||
echo 'Remarks: ' . $row->REMARKS . "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
db2_free_result($result);
|
||||
db2_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Schema: %s
|
||||
Name: ANIMALS
|
||||
Type: BASE TABLE
|
||||
Remarks:
|
||||
|
||||
Schema: %s
|
||||
Name: ANIME_CAT
|
||||
Type: VIEW
|
||||
Remarks:
|
||||
|
||||
37
tests/test_066_V6.phpt
Normal file
37
tests/test_066_V6.phpt
Normal file
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_tables() - Play with table objects
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$result = db2_tables($conn, NULL, strtoupper($user), 'ANIM%');
|
||||
|
||||
while ($row = db2_fetch_object($result)) {
|
||||
if (eregi("ANIME_CAT|ANIMALS",$row->TABLE_NAME)) {
|
||||
echo 'Schema: ' . $row->TABLE_SCHEM . "\n";
|
||||
echo 'Name: ' . $row->TABLE_NAME . "\n";
|
||||
echo 'Type: ' . $row->TABLE_TYPE . "\n";
|
||||
echo 'Remarks: ' . $row->REMARKS . "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
db2_free_result($result);
|
||||
db2_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Schema: %s
|
||||
Name: ANIMALS
|
||||
Type: TABLE
|
||||
Remarks:
|
||||
|
||||
Schema: %s
|
||||
Name: ANIME_CAT
|
||||
Type: VIEW
|
||||
Remarks:
|
||||
|
||||
22
tests/test_080_V5V6.phpt
Normal file
22
tests/test_080_V5V6.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_conn_error() - wrong database alias
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = @db2_connect("x", $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
echo "??? No way.\n";
|
||||
}
|
||||
else {
|
||||
$err = db2_conn_error();
|
||||
echo $err."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
42705
|
||||
23
tests/test_090_V5V6.phpt
Normal file
23
tests/test_090_V5V6.phpt
Normal file
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_conn_errormsg() - wrong database alias
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = @db2_connect("x", $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
echo "??? No way.\n";
|
||||
}
|
||||
else {
|
||||
$err = db2_conn_errormsg();
|
||||
echo $err."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Relational database x not in relational database directory. SQLCODE=-950
|
||||
|
||||
25
tests/test_091_V5V6.phpt
Normal file
25
tests/test_091_V5V6.phpt
Normal file
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_conn_errormsg() - wrong username
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipif3.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = @db2_connect($database, "y", $password);
|
||||
|
||||
if ($conn) {
|
||||
echo "??? No way.\n";
|
||||
}
|
||||
else {
|
||||
$err = db2_conn_errormsg();
|
||||
echo $err."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Authorization failure on distributed database connection attempt. SQLCODE=-30082
|
||||
26
tests/test_092_V5V6.phpt
Normal file
26
tests/test_092_V5V6.phpt
Normal file
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_conn_errormsg() - wrong password
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipif3.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = @db2_connect($database, $user, "z");
|
||||
|
||||
if ($conn) {
|
||||
echo "??? No way.\n";
|
||||
}
|
||||
else {
|
||||
$err = db2_conn_errormsg();
|
||||
echo $err."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Authorization failure on distributed database connection attempt. SQLCODE=-30082
|
||||
|
||||
137
tests/test_10931_V5.phpt
Normal file
137
tests/test_10931_V5.phpt
Normal file
@@ -0,0 +1,137 @@
|
||||
--TEST--
|
||||
IBM-DB2: PECL bug 10931 -- no result for db2_columns with lowercase table name
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$sql = "DROP TABLE \"DB2\".\"test_10931\"";
|
||||
@db2_exec($conn, $sql);
|
||||
|
||||
$sql = "create table \"DB2\".\"test_10931\" ( \"id\" INTEGER not null generated BY DEFAULT AS identity (NOCACHE, INCREMENT BY 1), \"title\" VARCHAR(50), \"created\" TIMESTAMP DEFAULT CURRENT TIMESTAMP, constraint P_USERS_U1 primary key (\"id\"))";
|
||||
db2_exec($conn, $sql);
|
||||
|
||||
$stmt = db2_columns ($conn ,null , 'DB2' , 'test_10931' , '%' );
|
||||
if ( $stmt )
|
||||
{
|
||||
while ($rowC = db2_fetch_assoc($stmt))
|
||||
{
|
||||
var_dump( $rowC );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(16) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(2) "id"
|
||||
["DATA_TYPE"]=>
|
||||
int(4)
|
||||
["TYPE_NAME"]=>
|
||||
string(8) "INTEGER "
|
||||
["LENGTH_PRECISION"]=>
|
||||
int(9)
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(4)
|
||||
["NUM_SCALE"]=>
|
||||
int(0)
|
||||
["NUM_PREC_RADIX"]=>
|
||||
int(10)
|
||||
["NULLABLE"]=>
|
||||
int(0)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
NULL
|
||||
["DATETIME_CODE"]=>
|
||||
NULL
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
NULL
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(1)
|
||||
}
|
||||
array(16) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(5) "title"
|
||||
["DATA_TYPE"]=>
|
||||
int(12)
|
||||
["TYPE_NAME"]=>
|
||||
string(8) "VARCHAR "
|
||||
["LENGTH_PRECISION"]=>
|
||||
NULL
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(52)
|
||||
["NUM_SCALE"]=>
|
||||
NULL
|
||||
["NUM_PREC_RADIX"]=>
|
||||
NULL
|
||||
["NULLABLE"]=>
|
||||
int(1)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
NULL
|
||||
["DATETIME_CODE"]=>
|
||||
NULL
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
int(50)
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(2)
|
||||
}
|
||||
array(16) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(7) "created"
|
||||
["DATA_TYPE"]=>
|
||||
int(9)
|
||||
["TYPE_NAME"]=>
|
||||
string(8) "TIMESTMP"
|
||||
["LENGTH_PRECISION"]=>
|
||||
NULL
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(10)
|
||||
["NUM_SCALE"]=>
|
||||
NULL
|
||||
["NUM_PREC_RADIX"]=>
|
||||
NULL
|
||||
["NULLABLE"]=>
|
||||
int(1)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
string(17) "CURRENT_TIMESTAMP"
|
||||
["DATETIME_CODE"]=>
|
||||
int(93)
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
NULL
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(3)
|
||||
}
|
||||
149
tests/test_10931_V6.phpt
Normal file
149
tests/test_10931_V6.phpt
Normal file
@@ -0,0 +1,149 @@
|
||||
--TEST--
|
||||
IBM-DB2: PECL bug 10931 -- no result for db2_columns with lowercase table name
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$sql = "DROP TABLE \"DB2\".\"test_10931\"";
|
||||
@db2_exec($conn, $sql);
|
||||
|
||||
$sql = "create table \"DB2\".\"test_10931\" ( \"id\" INTEGER not null generated BY DEFAULT AS identity (NOCACHE, INCREMENT BY 1), \"title\" VARCHAR(50), \"created\" TIMESTAMP DEFAULT CURRENT TIMESTAMP, constraint P_USERS_U1 primary key (\"id\"))";
|
||||
db2_exec($conn, $sql);
|
||||
|
||||
$stmt = db2_columns ($conn ,null , 'DB2' , 'test_10931' , '%' );
|
||||
if ( $stmt )
|
||||
{
|
||||
while ($rowC = db2_fetch_assoc($stmt))
|
||||
{
|
||||
var_dump( $rowC );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(18) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(2) "id"
|
||||
["DATA_TYPE"]=>
|
||||
int(4)
|
||||
["TYPE_NAME"]=>
|
||||
string(7) "INTEGER"
|
||||
["COLUMN_SIZE"]=>
|
||||
int(10)
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(4)
|
||||
["DECIMAL_DIGITS"]=>
|
||||
int(0)
|
||||
["NUM_PREC_RADIX"]=>
|
||||
int(10)
|
||||
["NULLABLE"]=>
|
||||
int(0)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
NULL
|
||||
["SQL_DATA_TYPE"]=>
|
||||
int(4)
|
||||
["SQL_DATETIME_SUB"]=>
|
||||
NULL
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
NULL
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(1)
|
||||
["IS_NULLABLE"]=>
|
||||
string(2) "NO"
|
||||
}
|
||||
array(18) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(5) "title"
|
||||
["DATA_TYPE"]=>
|
||||
int(12)
|
||||
["TYPE_NAME"]=>
|
||||
string(7) "VARCHAR"
|
||||
["COLUMN_SIZE"]=>
|
||||
int(50)
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(50)
|
||||
["DECIMAL_DIGITS"]=>
|
||||
NULL
|
||||
["NUM_PREC_RADIX"]=>
|
||||
NULL
|
||||
["NULLABLE"]=>
|
||||
int(1)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
NULL
|
||||
["SQL_DATA_TYPE"]=>
|
||||
int(12)
|
||||
["SQL_DATETIME_SUB"]=>
|
||||
NULL
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
int(50)
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(2)
|
||||
["IS_NULLABLE"]=>
|
||||
string(3) "YES"
|
||||
}
|
||||
array(18) {
|
||||
["TABLE_CAT"]=>
|
||||
string(%d) "%s"
|
||||
["TABLE_SCHEM"]=>
|
||||
string(3) "DB2"
|
||||
["TABLE_NAME"]=>
|
||||
string(10) "test_10931"
|
||||
["COLUMN_NAME"]=>
|
||||
string(7) "created"
|
||||
["DATA_TYPE"]=>
|
||||
int(93)
|
||||
["TYPE_NAME"]=>
|
||||
string(9) "TIMESTAMP"
|
||||
["COLUMN_SIZE"]=>
|
||||
int(26)
|
||||
["BUFFER_LENGTH"]=>
|
||||
int(16)
|
||||
["DECIMAL_DIGITS"]=>
|
||||
int(6)
|
||||
["NUM_PREC_RADIX"]=>
|
||||
NULL
|
||||
["NULLABLE"]=>
|
||||
int(1)
|
||||
["REMARKS"]=>
|
||||
NULL
|
||||
["COLUMN_DEF"]=>
|
||||
string(17) "CURRENT_TIMESTAMP"
|
||||
["SQL_DATA_TYPE"]=>
|
||||
int(9)
|
||||
["SQL_DATETIME_SUB"]=>
|
||||
int(3)
|
||||
["CHAR_OCTET_LENGTH"]=>
|
||||
NULL
|
||||
["ORDINAL_POSITION"]=>
|
||||
int(3)
|
||||
["IS_NULLABLE"]=>
|
||||
string(3) "YES"
|
||||
}
|
||||
547
tests/test_131a_V5V6.phpt
Normal file
547
tests/test_131a_V5V6.phpt
Normal file
@@ -0,0 +1,547 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_prepare / db2_execute: Checking for datatype conversions and errors when failed.
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
//Drop the test table, in case it exists
|
||||
$dropTableSQL = "DROP TABLE TESTTABLE";
|
||||
$res = @db2_exec($conn, $dropTableSQL);
|
||||
|
||||
//Create the test table
|
||||
$createTableSQL = "CREATE TABLE TESTTABLE (
|
||||
USERID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
|
||||
START WITH +0
|
||||
INCREMENT BY +1
|
||||
MINVALUE +0
|
||||
MAXVALUE +2147483647
|
||||
NO CYCLE
|
||||
NO CACHE
|
||||
NO ORDER
|
||||
),
|
||||
USERNAME VARCHAR(20),
|
||||
PASSWORD VARCHAR(20),
|
||||
NUMBER_SINT SMALLINT,
|
||||
NUMBER_INT INTEGER,
|
||||
NUMBER_BINT BIGINT,
|
||||
NUMBER_DOU DOUBLE,
|
||||
NUMBER_R REAL,
|
||||
NUMBER_DEC DECIMAL (7, 2)
|
||||
)";
|
||||
$res = db2_exec($conn, $createTableSQL);
|
||||
print db2_conn_error($conn);
|
||||
|
||||
//Populating the test table
|
||||
$rows = array(
|
||||
array('user0', 'password0', 0, 0, 0, 0000.00, 0000.00, 0000.00),
|
||||
array('user1', 'password1', 1, 1, 1, 1000.00, 1000.00, 1000.00),
|
||||
array('user2', 'password2', 2, 2, 2, 2000.00, 2000.00, 2000.00),
|
||||
array('user3', 'password3', 3, 3, 3, 3000.00, 3000.00, 3000.00),
|
||||
array('user4', 'password4', 4, 4, 4, 4000.00, 4000.00, 4000.00),
|
||||
array('user5', 'password5', 5, 5, 5, 5000.00, 5000.00, 5000.00),
|
||||
array('user6', 'password6', 6, 6, 6, 6000.00, 6000.00, 6000.00),
|
||||
array('user7', 'password7', 7, 7, 7, 7000.00, 7000.00, 7000.00),
|
||||
array('user8', 'password8', 8, 8, 8, 8000.00, 8000.00, 8000.00),
|
||||
array('user9', 'password9', 9, 9, 9, 9000.00, 9000.00, 9000.00)
|
||||
);
|
||||
$insertIntoTableSQL = "INSERT INTO TESTTABLE (
|
||||
USERNAME,
|
||||
PASSWORD,
|
||||
NUMBER_SINT,
|
||||
NUMBER_INT,
|
||||
NUMBER_BINT,
|
||||
NUMBER_DOU,
|
||||
NUMBER_R,
|
||||
NUMBER_DEC
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$sth = db2_prepare($conn, $insertIntoTableSQL);
|
||||
if($sth){
|
||||
foreach($rows as $row){
|
||||
$res = db2_execute($sth, $row);
|
||||
}
|
||||
}
|
||||
|
||||
//Altering the test table.
|
||||
$alterTable = "ALTER TABLE TESTTABLE ADD PRIMARY KEY (USERID)";
|
||||
$res = @db2_exec($prepconn, $alterTable);
|
||||
|
||||
$alterTable = "ALTER TABLE TESTTABLE ADD UNIQUE (USERNAME)";
|
||||
$res = @db2_exec($prepconn, $alterTable);
|
||||
|
||||
$alterTable = "ALTER TABLE TESTTABLE ALTER COLUMN USERID RESTART WITH 10";
|
||||
$res = @db2_exec($prepconn, $alterTable);
|
||||
|
||||
//Update query for Primary Key.
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE USERID = ?";
|
||||
|
||||
//Updating row with fake USERID.
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('PK_pass0', 'fakeUserID');
|
||||
//print "Updating TESTTABLE with 'fake' USERID" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = '1' (PK Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('PK_pass1', '1');
|
||||
//print "Updating TESTTABLE with USERID = '1'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = 1 (PK Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('PK_pass2', 1);
|
||||
//print "Updating TESTTABLE with USERID = 1" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = '10' (PK Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('PK_pass3', '10');
|
||||
//print "Updating TESTTABLE with USERID = '10'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = 10 (PK Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('PK_pass4', 10);
|
||||
//print "Updating TESTTABLE with USERID = 10" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Update query for SMALLINT.
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_SINT = ?";
|
||||
|
||||
//Updating row with fake NUMBER_SINT (SMALLINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('SINT_pass0', 'fakeNUMBER_SINT');
|
||||
//print "Updating TESTTABLE with 'fake' NUMBER_SINT" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_SINT = '1' (SMALLINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('SINT_pass1', '1');
|
||||
//print "Updating TESTTABLE with NUMBER_SINT = '1'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_SINT = 1 (SMALLINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('SINT_pass2', 1);
|
||||
//print "Updating TESTTABLE with NUMBER_SINT = 1" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_SINT = '10' (SMALLINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('SINT_pass3', '10');
|
||||
//print "Updating TESTTABLE with NUMBER_SINT = '10'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_SINT = 10 (SMALLINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('SINT_pass4', 10);
|
||||
//print "Updating TESTTABLE with NUMBER_SINT = 10" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Update query for INTEGER.
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_INT = ?";
|
||||
|
||||
//Updating row with fake NUMBER_INT (INTEGER Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('INT_pass0', 'fakeNUMBER_INT');
|
||||
//print "Updating TESTTABLE with 'fake' NUMBER_INT" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_INT = '1' (INTEGER Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('INT_pass1', '1');
|
||||
//print "Updating TESTTABLE with NUMBER_INT = '1'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_INT = 1 (INTEGER Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('INT_pass2', 1);
|
||||
//print "Updating TESTTABLE with NUMBER_INT = 1" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_INT = '10' (INTEGER Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('INT_pass3', '10');
|
||||
//print "Updating TESTTABLE with NUMBER_INT = '10'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_INT = 10 (INTEGER Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('INT_pass4', 10);
|
||||
//print "Updating TESTTABLE with NUMBER_INT = 10" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Update query for BIGINT.
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_BINT = ?";
|
||||
|
||||
//Updating row with fake NUMBER_BINT (BIGINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BINT_pass0', 'fakeNUMBER_BINT');
|
||||
//print "Updating TESTTABLE with 'fake' NUMBER_BINT" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_BINT = '1' (BIGINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BINT_pass1', '1');
|
||||
//print "Updating TESTTABLE with NUMBER_BINT = '1'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_BINT = 1 (BIGINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BINT_pass2', 1);
|
||||
//print "Updating TESTTABLE with NUMBER_BINT = 1" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_BINT = '10' (BIGINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BINT_pass3', '10');
|
||||
//print "Updating TESTTABLE with NUMBER_BINT = '10'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_BINT = 10 (BIGINT Test).
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BINT_pass4', 10);
|
||||
//print "Updating TESTTABLE with NUMBER_BINT = 10" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
|
||||
//Updating row with fake NUMBER_DOU (DOUBLE Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DOU = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass0', 'fakeNUMBER_DOU');
|
||||
//print "Updating TESTTABLE with NUMBER_DOU = 'fake'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DOU = '1000' (DOUBLE Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DOU = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass1', '1000');
|
||||
//print "Updating TESTTABLE with NUMBER_DOU = '1000'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DOU = 1000 (DOUBLE Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET NUMBER_DOU = ? WHERE NUMBER_DOU = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('1000.50', 1000);
|
||||
//print "Updating TESTTABLE with NUMBER_DOU = 1000" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DOU = '1000.50' (DOUBLE Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DOU = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass2', '1000.50');
|
||||
//print "Updating TESTTABLE with NUMBER_DOU = '1000.50'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DOU = 1000.50 (DOUBLE Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DOU = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass4', 1000.50);
|
||||
//print "Updating TESTTABLE with NUMBER_DOU = 1000.50" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with fake NUMBER_R (REAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_R = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass0', 'fakeNUMBER_R');
|
||||
//print "Updating TESTTABLE with NUMBER_R = 'fake'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_R = '1000' (REAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_R = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass1', '1000');
|
||||
//print "Updating TESTTABLE with NUMBER_R = '1000'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_R = 1000 (REAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET NUMBER_R = ? WHERE NUMBER_R = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('1000.50', 1000);
|
||||
//print "Updating TESTTABLE with NUMBER_R = 1000" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_R = '1000.50' (REAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_R = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass2', '1000.50');
|
||||
//print "Updating TESTTABLE with NUMBER_R = '1000.50'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_R = 1000.50 (REAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_R = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass4', 1000.50);
|
||||
//print "Updating TESTTABLE with NUMBER_R = 1000.50" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with fake NUMBER_DEC (DECIMAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DEC = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass0', 'fakeNUMBER_DEC');
|
||||
//print "Updating TESTTABLE with NUMBER_DEC = 'fake'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if($result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DEC = '1000' (DECIMAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DEC = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass1', '1000');
|
||||
//print "Updating TESTTABLE with NUMBER_DEC = '1000'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DEC = 1000 (DECIMAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET NUMBER_DEC = ? WHERE NUMBER_DEC = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('1000.50', 1000);
|
||||
//print "Updating TESTTABLE with NUMBER_DEC = 1000" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DEC = '1000.50' (DECIMAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DEC = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass2', '1000.50');
|
||||
//print "Updating TESTTABLE with NUMBER_DEC = '1000.50'" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with NUMBER_DEC = 1000.50 (DECIMAL Test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE NUMBER_DEC = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('DOU_pass4', 1000.50);
|
||||
//print "Updating TESTTABLE with NUMBER_DEC = 1000.50" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = TRUE (Boolean test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE USERID = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BOOL_pass_TRUE', TRUE);
|
||||
//print "Updating TESTTABLE with USERID = TRUE" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Updating row with USERID = FALSE (Boolean test).
|
||||
$updateRow = "UPDATE TESTTABLE SET PASSWORD = ? WHERE USERID = ?";
|
||||
$stmt = db2_prepare($conn , $updateRow);
|
||||
$parameters = array('BOOL_pass_FALSE', FALSE);
|
||||
//print "Updating TESTTABLE with USERID = FALSE" . "\n";
|
||||
$result = db2_execute($stmt, $parameters);
|
||||
if(!$result) {
|
||||
print "Test case failed." . "\n";
|
||||
}
|
||||
print db2_num_rows($stmt) . "\n";
|
||||
|
||||
//Drop the test table, in case it exists
|
||||
$dropTableSQL = "DROP TABLE TESTTABLE";
|
||||
$res = @db2_exec($conn, $dropTableSQL);
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
print "Connection not created" . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
|
||||
Warning: db2_execute(): Statement Execute Failed in %s
|
||||
|
||||
Warning: db2_num_rows(): SQLRowCount failed in %s
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
37
tests/test_133_V5V6.phpt
Normal file
37
tests/test_133_V5V6.phpt
Normal file
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_execute with excessively long input parameters
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
$sql = "INSERT INTO animals (id, breed, name, weight)
|
||||
VALUES (?, ?, ?, ?)";
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_OFF );
|
||||
|
||||
if (!$conn) {
|
||||
die("Connection failed.\n");
|
||||
}
|
||||
|
||||
$stmt = db2_prepare($conn, $sql);
|
||||
$res = db2_execute($stmt, array(128, 'hacker of human and technological nature', 'Wez the ruler of all things PECL', 88.3));
|
||||
var_dump($res);
|
||||
print "SQLSTATE: " . db2_stmt_error($stmt);
|
||||
print "\nMessage: " . db2_stmt_errormsg($stmt);
|
||||
|
||||
$stmt = db2_prepare($conn, "SELECT breed, name FROM animals WHERE id = ?");
|
||||
$res = db2_execute ($stmt, array(128));
|
||||
$row = db2_fetch_assoc($stmt);
|
||||
print_r($row);
|
||||
|
||||
db2_rollback($conn);
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
(PHP )?Warning:\s+db2_execute\(\): Statement Execute Failed in .*?test_133_V5V6.php on line \d+
|
||||
bool\(false\)
|
||||
SQLSTATE: 22001
|
||||
Message: Value for column or variable BREED too long.
|
||||
64
tests/test_148_V5V6.phpt
Normal file
64
tests/test_148_V5V6.phpt
Normal file
@@ -0,0 +1,64 @@
|
||||
--TEST--
|
||||
IBM-DB2: Call a stored procedure in a different binding pattern
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once('connection.inc');
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
// Set up //
|
||||
$sql = "DROP TABLE sptb";
|
||||
@db2_exec( $conn, $sql );
|
||||
$sql = "DROP PROCEDURE sp";
|
||||
@db2_exec( $conn, $sql );
|
||||
$sql = "CREATE TABLE sptb (c1 INTEGER, c2 FLOAT, c3 VARCHAR(10), c4 BIGINT, c5 CLOB)";
|
||||
db2_exec( $conn, $sql );
|
||||
$sql = "INSERT INTO sptb (c1, c2, c3, c4, c5) VALUES
|
||||
(1, 5.01, 'varchar', 3271982, 'clob data clob data')";
|
||||
db2_exec( $conn, $sql );
|
||||
$sql = "CREATE PROCEDURE sp(OUT out1 INTEGER, OUT out2 FLOAT, OUT out3 VARCHAR(10), OUT out4 BIGINT, OUT out5 CLOB)
|
||||
DYNAMIC RESULT SETS 1 LANGUAGE SQL BEGIN
|
||||
SELECT c1, c2, c3, c4, c5 INTO out1, out2, out3, out4, out5 FROM sptb; END";
|
||||
db2_exec($conn, $sql);
|
||||
|
||||
// Run the test //
|
||||
$stmt = db2_prepare( $conn , "CALL sp(?, ?, ?, ?, ?)" );
|
||||
|
||||
$out1 = 0;
|
||||
$out2 = 0.00;
|
||||
$out3 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
|
||||
$out4 = 0;
|
||||
$out5 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
db2_bind_param( $stmt , 1 , "out1" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 2 , "out2" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 3 , "out3" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 4 , "out4" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 5 , "out5" , DB2_PARAM_OUT , DB2_CLOB );
|
||||
|
||||
$result = db2_execute( $stmt );
|
||||
|
||||
echo "out 1:\n";
|
||||
echo $out1 . "\n";
|
||||
echo "out 2:\n";
|
||||
echo $out2 . "\n";
|
||||
echo "out 3:\n";
|
||||
echo $out3 . "\n";
|
||||
echo "out 4:\n";
|
||||
echo $out4 . "\n";
|
||||
echo "out 5:\n";
|
||||
echo $out5 . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
out 1:
|
||||
1
|
||||
out 2:
|
||||
5.01
|
||||
out 3:
|
||||
varchar
|
||||
out 4:
|
||||
3271982
|
||||
out 5:
|
||||
clob data clob data
|
||||
|
||||
64
tests/test_149_V5V6.phpt
Normal file
64
tests/test_149_V5V6.phpt
Normal file
@@ -0,0 +1,64 @@
|
||||
--TEST--
|
||||
IBM-DB2: Call a stored procedure in a different binding pattern
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once('connection.inc');
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
// Set up //
|
||||
$sql = "DROP TABLE sptb";
|
||||
@db2_exec( $conn, $sql );
|
||||
$sql = "DROP PROCEDURE sp";
|
||||
@db2_exec( $conn, $sql );
|
||||
$sql = "CREATE TABLE sptb (c1 INTEGER, c2 FLOAT, c3 VARCHAR(10), c4 BIGINT, c5 CLOB)";
|
||||
db2_exec( $conn, $sql );
|
||||
$sql = "INSERT INTO sptb (c1, c2, c3, c4, c5) VALUES
|
||||
(1, 5.01, 'varchar', 3271982, 'clob data clob data')";
|
||||
db2_exec( $conn, $sql );
|
||||
$sql = "CREATE PROCEDURE sp(OUT out1 INTEGER, OUT out2 FLOAT, OUT out3 VARCHAR(10), OUT out4 BIGINT, OUT out5 CLOB)
|
||||
DYNAMIC RESULT SETS 1 LANGUAGE SQL BEGIN
|
||||
SELECT c1, c2, c3, c4, c5 INTO out1, out2, out3, out4, out5 FROM sptb; END";
|
||||
db2_exec($conn, $sql);
|
||||
|
||||
// Run the test //
|
||||
$stmt = db2_prepare( $conn , "CALL sp(?, ?, ?, ?, ?)" );
|
||||
|
||||
$out1 = 0;
|
||||
$out2 = 0.00;
|
||||
$out3 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
|
||||
$out4 = 0;
|
||||
$out5 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
db2_bind_param( $stmt , 1 , "out1" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 2 , "out2" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 3 , "out3" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 4 , "out4" , DB2_PARAM_OUT );
|
||||
db2_bind_param( $stmt , 5 , "out5" , DB2_PARAM_OUT , DB2_CHAR );
|
||||
|
||||
$result = db2_execute( $stmt );
|
||||
|
||||
echo "out 1:\n";
|
||||
echo $out1 . "\n";
|
||||
echo "out 2:\n";
|
||||
echo $out2 . "\n";
|
||||
echo "out 3:\n";
|
||||
echo $out3 . "\n";
|
||||
echo "out 4:\n";
|
||||
echo $out4 . "\n";
|
||||
echo "out 5:\n";
|
||||
echo $out5 . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
out 1:
|
||||
1
|
||||
out 2:
|
||||
5.01
|
||||
out 3:
|
||||
varchar
|
||||
out 4:
|
||||
3271982
|
||||
out 5:
|
||||
clob data clob data
|
||||
|
||||
105
tests/test_160_V5V6.phpt
Normal file
105
tests/test_160_V5V6.phpt
Normal file
@@ -0,0 +1,105 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_both()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipif2.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from emp_act");
|
||||
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
printf ("%6s ",$row[0]);
|
||||
printf ("%-6s ",$row[1]);
|
||||
printf ("%3d ",$row[2]);
|
||||
printf ("%9s ",$row['EMPTIME']);
|
||||
printf ("%10s ", $row['EMSTDATE']);
|
||||
printf ("%10s ", $row['EMENDATE']);
|
||||
printf ("%6s", $row[0]);
|
||||
print "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
000010 MA2100 10 .50 1982-01-01 1982-11-01 000010
|
||||
000010 MA2110 10 1.00 1982-01-01 1983-02-01 000010
|
||||
000010 AD3100 10 .50 1982-01-01 1982-07-01 000010
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
000030 IF1000 10 .50 1982-06-01 1983-01-01 000030
|
||||
000030 IF2000 10 .50 1982-01-01 1983-01-01 000030
|
||||
000050 OP1000 10 .25 1982-01-01 1983-02-01 000050
|
||||
000050 OP2010 10 .75 1982-01-01 1983-02-01 000050
|
||||
000070 AD3110 10 1.00 1982-01-01 1983-02-01 000070
|
||||
000090 OP1010 10 1.00 1982-01-01 1983-02-01 000090
|
||||
000100 OP2010 10 1.00 1982-01-01 1983-02-01 000100
|
||||
000110 MA2100 20 1.00 1982-01-01 1982-03-01 000110
|
||||
000130 IF1000 90 1.00 1982-01-01 1982-10-01 000130
|
||||
000130 IF1000 100 .50 1982-10-01 1983-01-01 000130
|
||||
000140 IF1000 90 .50 1982-10-01 1983-01-01 000140
|
||||
000140 IF2000 100 1.00 1982-01-01 1982-03-01 000140
|
||||
000140 IF2000 100 .50 1982-03-01 1982-07-01 000140
|
||||
000140 IF2000 110 .50 1982-03-01 1982-07-01 000140
|
||||
000140 IF2000 110 .50 1982-10-01 1983-01-01 000140
|
||||
000150 MA2112 60 1.00 1982-01-01 1982-07-15 000150
|
||||
000150 MA2112 180 1.00 1982-07-15 1983-02-01 000150
|
||||
000160 MA2113 60 1.00 1982-07-15 1983-02-01 000160
|
||||
000170 MA2112 60 1.00 1982-01-01 1983-06-01 000170
|
||||
000170 MA2112 70 1.00 1982-06-01 1983-02-01 000170
|
||||
000170 MA2113 80 1.00 1982-01-01 1983-02-01 000170
|
||||
000180 MA2113 70 1.00 1982-04-01 1982-06-15 000180
|
||||
000190 MA2112 70 1.00 1982-02-01 1982-10-01 000190
|
||||
000190 MA2112 80 1.00 1982-10-01 1983-10-01 000190
|
||||
000200 MA2111 50 1.00 1982-01-01 1982-06-15 000200
|
||||
000200 MA2111 60 1.00 1982-06-15 1983-02-01 000200
|
||||
000210 MA2113 80 .50 1982-10-01 1983-02-01 000210
|
||||
000210 MA2113 180 .50 1982-10-01 1983-02-01 000210
|
||||
000220 MA2111 40 1.00 1982-01-01 1983-02-01 000220
|
||||
000230 AD3111 60 1.00 1982-01-01 1982-03-15 000230
|
||||
000230 AD3111 60 .50 1982-03-15 1982-04-15 000230
|
||||
000230 AD3111 70 .50 1982-03-15 1982-10-15 000230
|
||||
000230 AD3111 80 .50 1982-04-15 1982-10-15 000230
|
||||
000230 AD3111 180 1.00 1982-10-15 1983-01-01 000230
|
||||
000240 AD3111 70 1.00 1982-02-15 1982-09-15 000240
|
||||
000240 AD3111 80 1.00 1982-09-15 1983-01-01 000240
|
||||
000250 AD3112 60 1.00 1982-01-01 1982-02-01 000250
|
||||
000250 AD3112 60 .50 1982-02-01 1982-03-15 000250
|
||||
000250 AD3112 60 .50 1982-12-01 1983-01-01 000250
|
||||
000250 AD3112 60 1.00 1983-01-01 1983-02-01 000250
|
||||
000250 AD3112 70 .50 1982-02-01 1982-03-15 000250
|
||||
000250 AD3112 70 1.00 1982-03-15 1982-08-15 000250
|
||||
000250 AD3112 70 .25 1982-08-15 1982-10-15 000250
|
||||
000250 AD3112 80 .25 1982-08-15 1982-10-15 000250
|
||||
000250 AD3112 80 .50 1982-10-15 1982-12-01 000250
|
||||
000250 AD3112 180 .50 1982-08-15 1983-01-01 000250
|
||||
000260 AD3113 70 .50 1982-06-15 1982-07-01 000260
|
||||
000260 AD3113 70 1.00 1982-07-01 1983-02-01 000260
|
||||
000260 AD3113 80 1.00 1982-01-01 1982-03-01 000260
|
||||
000260 AD3113 80 .50 1982-03-01 1982-04-15 000260
|
||||
000260 AD3113 180 .50 1982-03-01 1982-04-15 000260
|
||||
000260 AD3113 180 1.00 1982-04-15 1982-06-01 000260
|
||||
000260 AD3113 180 .50 1982-06-01 1982-07-01 000260
|
||||
000270 AD3113 60 .50 1982-03-01 1982-04-01 000270
|
||||
000270 AD3113 60 1.00 1982-04-01 1982-09-01 000270
|
||||
000270 AD3113 60 .25 1982-09-01 1982-10-15 000270
|
||||
000270 AD3113 70 .75 1982-09-01 1982-10-15 000270
|
||||
000270 AD3113 70 1.00 1982-10-15 1983-02-01 000270
|
||||
000270 AD3113 80 1.00 1982-01-01 1982-03-01 000270
|
||||
000270 AD3113 80 .50 1982-03-01 1982-04-01 000270
|
||||
000280 OP1010 130 1.00 1982-01-01 1983-02-01 000280
|
||||
000290 OP1010 130 1.00 1982-01-01 1983-02-01 000290
|
||||
000300 OP1010 130 1.00 1982-01-01 1983-02-01 000300
|
||||
000310 OP1010 130 1.00 1982-01-01 1983-02-01 000310
|
||||
000320 OP2011 140 .75 1982-01-01 1983-02-01 000320
|
||||
000320 OP2011 150 .25 1982-01-01 1983-02-01 000320
|
||||
000330 OP2012 140 .25 1982-01-01 1983-02-01 000330
|
||||
000330 OP2012 160 .75 1982-01-01 1983-02-01 000330
|
||||
000340 OP2013 140 .50 1982-01-01 1983-02-01 000340
|
||||
000340 OP2013 170 .50 1982-01-01 1983-02-01 000340
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
189
tests/test_161_V5V6.phpt
Normal file
189
tests/test_161_V5V6.phpt
Normal file
@@ -0,0 +1,189 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_both() - nested selects 1
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipif2.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from emp_act");
|
||||
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
printf ("%6s ",$row[0]);
|
||||
printf ("%-6s ",$row[1]);
|
||||
printf ("%3d ",$row[2]);
|
||||
printf ("%9s ",$row['EMPTIME']);
|
||||
printf ("%10s ", $row['EMSTDATE']);
|
||||
printf ("%10s ", $row['EMENDATE']);
|
||||
printf ("%6s ", $row[0]);
|
||||
print "\n";
|
||||
$result2 = db2_exec($conn,"select * from employee where employee.empno='" . $row['EMPNO'] . "'");
|
||||
|
||||
$row2 = db2_fetch_both($result2);
|
||||
|
||||
if ($row2)
|
||||
{
|
||||
printf(">>%s,%s,%s,$row2[3],$row2[3],$row2[5],$row2[6]\n",
|
||||
$row2['EMPNO'], $row2['FIRSTNME'],$row2['MIDINIT']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
000010 MA2100 10 .50 1982-01-01 1982-11-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000010 MA2110 10 1.00 1982-01-01 1983-02-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000010 AD3100 10 .50 1982-01-01 1982-07-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
>>000020,MICHAEL,L,THOMPSON,THOMPSON,3476,1973-10-10
|
||||
000030 IF1000 10 .50 1982-06-01 1983-01-01 000030
|
||||
>>000030,SALLY,A,KWAN,KWAN,4738,1975-04-05
|
||||
000030 IF2000 10 .50 1982-01-01 1983-01-01 000030
|
||||
>>000030,SALLY,A,KWAN,KWAN,4738,1975-04-05
|
||||
000050 OP1000 10 .25 1982-01-01 1983-02-01 000050
|
||||
>>000050,JOHN,B,GEYER,GEYER,6789,1949-08-17
|
||||
000050 OP2010 10 .75 1982-01-01 1983-02-01 000050
|
||||
>>000050,JOHN,B,GEYER,GEYER,6789,1949-08-17
|
||||
000070 AD3110 10 1.00 1982-01-01 1983-02-01 000070
|
||||
>>000070,EVA,D,PULASKI,PULASKI,7831,1980-09-30
|
||||
000090 OP1010 10 1.00 1982-01-01 1983-02-01 000090
|
||||
>>000090,EILEEN,W,HENDERSON,HENDERSON,5498,1970-08-15
|
||||
000100 OP2010 10 1.00 1982-01-01 1983-02-01 000100
|
||||
>>000100,THEODORE,Q,SPENSER,SPENSER,0972,1980-06-19
|
||||
000110 MA2100 20 1.00 1982-01-01 1982-03-01 000110
|
||||
>>000110,VINCENZO,G,LUCCHESSI,LUCCHESSI,3490,1958-05-16
|
||||
000130 IF1000 90 1.00 1982-01-01 1982-10-01 000130
|
||||
>>000130,DOLORES,M,QUINTANA,QUINTANA,4578,1971-07-28
|
||||
000130 IF1000 100 .50 1982-10-01 1983-01-01 000130
|
||||
>>000130,DOLORES,M,QUINTANA,QUINTANA,4578,1971-07-28
|
||||
000140 IF1000 90 .50 1982-10-01 1983-01-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 100 1.00 1982-01-01 1982-03-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 100 .50 1982-03-01 1982-07-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 110 .50 1982-03-01 1982-07-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 110 .50 1982-10-01 1983-01-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000150 MA2112 60 1.00 1982-01-01 1982-07-15 000150
|
||||
>>000150,BRUCE, ,ADAMSON,ADAMSON,4510,1972-02-12
|
||||
000150 MA2112 180 1.00 1982-07-15 1983-02-01 000150
|
||||
>>000150,BRUCE, ,ADAMSON,ADAMSON,4510,1972-02-12
|
||||
000160 MA2113 60 1.00 1982-07-15 1983-02-01 000160
|
||||
>>000160,ELIZABETH,R,PIANKA,PIANKA,3782,1977-10-11
|
||||
000170 MA2112 60 1.00 1982-01-01 1983-06-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000170 MA2112 70 1.00 1982-06-01 1983-02-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000170 MA2113 80 1.00 1982-01-01 1983-02-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000180 MA2113 70 1.00 1982-04-01 1982-06-15 000180
|
||||
>>000180,MARILYN,S,SCOUTTEN,SCOUTTEN,1682,1973-07-07
|
||||
000190 MA2112 70 1.00 1982-02-01 1982-10-01 000190
|
||||
>>000190,JAMES,H,WALKER,WALKER,2986,1974-07-26
|
||||
000190 MA2112 80 1.00 1982-10-01 1983-10-01 000190
|
||||
>>000190,JAMES,H,WALKER,WALKER,2986,1974-07-26
|
||||
000200 MA2111 50 1.00 1982-01-01 1982-06-15 000200
|
||||
>>000200,DAVID, ,BROWN,BROWN,4501,1966-03-03
|
||||
000200 MA2111 60 1.00 1982-06-15 1983-02-01 000200
|
||||
>>000200,DAVID, ,BROWN,BROWN,4501,1966-03-03
|
||||
000210 MA2113 80 .50 1982-10-01 1983-02-01 000210
|
||||
>>000210,WILLIAM,T,JONES,JONES,0942,1979-04-11
|
||||
000210 MA2113 180 .50 1982-10-01 1983-02-01 000210
|
||||
>>000210,WILLIAM,T,JONES,JONES,0942,1979-04-11
|
||||
000220 MA2111 40 1.00 1982-01-01 1983-02-01 000220
|
||||
>>000220,JENNIFER,K,LUTZ,LUTZ,0672,1968-08-29
|
||||
000230 AD3111 60 1.00 1982-01-01 1982-03-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 60 .50 1982-03-15 1982-04-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 70 .50 1982-03-15 1982-10-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 80 .50 1982-04-15 1982-10-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 180 1.00 1982-10-15 1983-01-01 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000240 AD3111 70 1.00 1982-02-15 1982-09-15 000240
|
||||
>>000240,SALVATORE,M,MARINO,MARINO,3780,1979-12-05
|
||||
000240 AD3111 80 1.00 1982-09-15 1983-01-01 000240
|
||||
>>000240,SALVATORE,M,MARINO,MARINO,3780,1979-12-05
|
||||
000250 AD3112 60 1.00 1982-01-01 1982-02-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 .50 1982-02-01 1982-03-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 .50 1982-12-01 1983-01-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 1.00 1983-01-01 1983-02-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 .50 1982-02-01 1982-03-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 1.00 1982-03-15 1982-08-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 .25 1982-08-15 1982-10-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 80 .25 1982-08-15 1982-10-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 80 .50 1982-10-15 1982-12-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 180 .50 1982-08-15 1983-01-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000260 AD3113 70 .50 1982-06-15 1982-07-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 70 1.00 1982-07-01 1983-02-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 80 1.00 1982-01-01 1982-03-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 80 .50 1982-03-01 1982-04-15 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 .50 1982-03-01 1982-04-15 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 1.00 1982-04-15 1982-06-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 .50 1982-06-01 1982-07-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000270 AD3113 60 .50 1982-03-01 1982-04-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 60 1.00 1982-04-01 1982-09-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 60 .25 1982-09-01 1982-10-15 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 70 .75 1982-09-01 1982-10-15 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 70 1.00 1982-10-15 1983-02-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 80 1.00 1982-01-01 1982-03-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 80 .50 1982-03-01 1982-04-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000280 OP1010 130 1.00 1982-01-01 1983-02-01 000280
|
||||
>>000280,ETHEL,R,SCHNEIDER,SCHNEIDER,8997,1967-03-24
|
||||
000290 OP1010 130 1.00 1982-01-01 1983-02-01 000290
|
||||
>>000290,JOHN,R,PARKER,PARKER,4502,1980-05-30
|
||||
000300 OP1010 130 1.00 1982-01-01 1983-02-01 000300
|
||||
>>000300,PHILIP,X,SMITH,SMITH,2095,1972-06-19
|
||||
000310 OP1010 130 1.00 1982-01-01 1983-02-01 000310
|
||||
>>000310,MAUDE,F,SETRIGHT,SETRIGHT,3332,1964-09-12
|
||||
000320 OP2011 140 .75 1982-01-01 1983-02-01 000320
|
||||
>>000320,RAMLAL,V,MEHTA,MEHTA,9990,1965-07-07
|
||||
000320 OP2011 150 .25 1982-01-01 1983-02-01 000320
|
||||
>>000320,RAMLAL,V,MEHTA,MEHTA,9990,1965-07-07
|
||||
000330 OP2012 140 .25 1982-01-01 1983-02-01 000330
|
||||
>>000330,WING, ,LEE,LEE,2103,1976-02-23
|
||||
000330 OP2012 160 .75 1982-01-01 1983-02-01 000330
|
||||
>>000330,WING, ,LEE,LEE,2103,1976-02-23
|
||||
000340 OP2013 140 .50 1982-01-01 1983-02-01 000340
|
||||
>>000340,JASON,R,GOUNOT,GOUNOT,5698,1947-05-05
|
||||
000340 OP2013 170 .50 1982-01-01 1983-02-01 000340
|
||||
>>000340,JASON,R,GOUNOT,GOUNOT,5698,1947-05-05
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
>>000020,MICHAEL,L,THOMPSON,THOMPSON,3476,1973-10-10
|
||||
189
tests/test_162_V5V6.phpt
Normal file
189
tests/test_162_V5V6.phpt
Normal file
@@ -0,0 +1,189 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_both() - nested selects 2
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipif2.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from emp_act");
|
||||
|
||||
while ($row = db2_fetch_both($result))
|
||||
{
|
||||
printf ("%6s ",$row[0]);
|
||||
printf ("%-6s ",$row[1]);
|
||||
printf ("%3d ",$row[2]);
|
||||
printf ("%9s ",$row['EMPTIME']);
|
||||
printf ("%10s ", $row['EMSTDATE']);
|
||||
printf ("%10s ", $row['EMENDATE']);
|
||||
printf ("%6s ", $row[0]);
|
||||
print "\n";
|
||||
$result2 = db2_exec($conn,"select * from employee where employee.empno='" . $row['EMPNO'] . "'");
|
||||
|
||||
$row2 = db2_fetch_both($result2);
|
||||
|
||||
if ($row2)
|
||||
{
|
||||
printf(">>%s,%s,%s,$row2[3],$row2[3],$row2[5],$row2[6]\n",
|
||||
$row2['EMPNO'], $row2['FIRSTNME'],$row2['MIDINIT']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
000010 MA2100 10 .50 1982-01-01 1982-11-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000010 MA2110 10 1.00 1982-01-01 1983-02-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000010 AD3100 10 .50 1982-01-01 1982-07-01 000010
|
||||
>>000010,CHRISTINE,I,HAAS,HAAS,3978,1965-01-01
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
>>000020,MICHAEL,L,THOMPSON,THOMPSON,3476,1973-10-10
|
||||
000030 IF1000 10 .50 1982-06-01 1983-01-01 000030
|
||||
>>000030,SALLY,A,KWAN,KWAN,4738,1975-04-05
|
||||
000030 IF2000 10 .50 1982-01-01 1983-01-01 000030
|
||||
>>000030,SALLY,A,KWAN,KWAN,4738,1975-04-05
|
||||
000050 OP1000 10 .25 1982-01-01 1983-02-01 000050
|
||||
>>000050,JOHN,B,GEYER,GEYER,6789,1949-08-17
|
||||
000050 OP2010 10 .75 1982-01-01 1983-02-01 000050
|
||||
>>000050,JOHN,B,GEYER,GEYER,6789,1949-08-17
|
||||
000070 AD3110 10 1.00 1982-01-01 1983-02-01 000070
|
||||
>>000070,EVA,D,PULASKI,PULASKI,7831,1980-09-30
|
||||
000090 OP1010 10 1.00 1982-01-01 1983-02-01 000090
|
||||
>>000090,EILEEN,W,HENDERSON,HENDERSON,5498,1970-08-15
|
||||
000100 OP2010 10 1.00 1982-01-01 1983-02-01 000100
|
||||
>>000100,THEODORE,Q,SPENSER,SPENSER,0972,1980-06-19
|
||||
000110 MA2100 20 1.00 1982-01-01 1982-03-01 000110
|
||||
>>000110,VINCENZO,G,LUCCHESSI,LUCCHESSI,3490,1958-05-16
|
||||
000130 IF1000 90 1.00 1982-01-01 1982-10-01 000130
|
||||
>>000130,DOLORES,M,QUINTANA,QUINTANA,4578,1971-07-28
|
||||
000130 IF1000 100 .50 1982-10-01 1983-01-01 000130
|
||||
>>000130,DOLORES,M,QUINTANA,QUINTANA,4578,1971-07-28
|
||||
000140 IF1000 90 .50 1982-10-01 1983-01-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 100 1.00 1982-01-01 1982-03-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 100 .50 1982-03-01 1982-07-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 110 .50 1982-03-01 1982-07-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000140 IF2000 110 .50 1982-10-01 1983-01-01 000140
|
||||
>>000140,HEATHER,A,NICHOLLS,NICHOLLS,1793,1976-12-15
|
||||
000150 MA2112 60 1.00 1982-01-01 1982-07-15 000150
|
||||
>>000150,BRUCE, ,ADAMSON,ADAMSON,4510,1972-02-12
|
||||
000150 MA2112 180 1.00 1982-07-15 1983-02-01 000150
|
||||
>>000150,BRUCE, ,ADAMSON,ADAMSON,4510,1972-02-12
|
||||
000160 MA2113 60 1.00 1982-07-15 1983-02-01 000160
|
||||
>>000160,ELIZABETH,R,PIANKA,PIANKA,3782,1977-10-11
|
||||
000170 MA2112 60 1.00 1982-01-01 1983-06-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000170 MA2112 70 1.00 1982-06-01 1983-02-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000170 MA2113 80 1.00 1982-01-01 1983-02-01 000170
|
||||
>>000170,MASATOSHI,J,YOSHIMURA,YOSHIMURA,2890,1978-09-15
|
||||
000180 MA2113 70 1.00 1982-04-01 1982-06-15 000180
|
||||
>>000180,MARILYN,S,SCOUTTEN,SCOUTTEN,1682,1973-07-07
|
||||
000190 MA2112 70 1.00 1982-02-01 1982-10-01 000190
|
||||
>>000190,JAMES,H,WALKER,WALKER,2986,1974-07-26
|
||||
000190 MA2112 80 1.00 1982-10-01 1983-10-01 000190
|
||||
>>000190,JAMES,H,WALKER,WALKER,2986,1974-07-26
|
||||
000200 MA2111 50 1.00 1982-01-01 1982-06-15 000200
|
||||
>>000200,DAVID, ,BROWN,BROWN,4501,1966-03-03
|
||||
000200 MA2111 60 1.00 1982-06-15 1983-02-01 000200
|
||||
>>000200,DAVID, ,BROWN,BROWN,4501,1966-03-03
|
||||
000210 MA2113 80 .50 1982-10-01 1983-02-01 000210
|
||||
>>000210,WILLIAM,T,JONES,JONES,0942,1979-04-11
|
||||
000210 MA2113 180 .50 1982-10-01 1983-02-01 000210
|
||||
>>000210,WILLIAM,T,JONES,JONES,0942,1979-04-11
|
||||
000220 MA2111 40 1.00 1982-01-01 1983-02-01 000220
|
||||
>>000220,JENNIFER,K,LUTZ,LUTZ,0672,1968-08-29
|
||||
000230 AD3111 60 1.00 1982-01-01 1982-03-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 60 .50 1982-03-15 1982-04-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 70 .50 1982-03-15 1982-10-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 80 .50 1982-04-15 1982-10-15 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000230 AD3111 180 1.00 1982-10-15 1983-01-01 000230
|
||||
>>000230,JAMES,J,JEFFERSON,JEFFERSON,2094,1966-11-21
|
||||
000240 AD3111 70 1.00 1982-02-15 1982-09-15 000240
|
||||
>>000240,SALVATORE,M,MARINO,MARINO,3780,1979-12-05
|
||||
000240 AD3111 80 1.00 1982-09-15 1983-01-01 000240
|
||||
>>000240,SALVATORE,M,MARINO,MARINO,3780,1979-12-05
|
||||
000250 AD3112 60 1.00 1982-01-01 1982-02-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 .50 1982-02-01 1982-03-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 .50 1982-12-01 1983-01-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 60 1.00 1983-01-01 1983-02-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 .50 1982-02-01 1982-03-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 1.00 1982-03-15 1982-08-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 70 .25 1982-08-15 1982-10-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 80 .25 1982-08-15 1982-10-15 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 80 .50 1982-10-15 1982-12-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000250 AD3112 180 .50 1982-08-15 1983-01-01 000250
|
||||
>>000250,DANIEL,S,SMITH,SMITH,0961,1969-10-30
|
||||
000260 AD3113 70 .50 1982-06-15 1982-07-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 70 1.00 1982-07-01 1983-02-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 80 1.00 1982-01-01 1982-03-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 80 .50 1982-03-01 1982-04-15 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 .50 1982-03-01 1982-04-15 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 1.00 1982-04-15 1982-06-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000260 AD3113 180 .50 1982-06-01 1982-07-01 000260
|
||||
>>000260,SYBIL,P,JOHNSON,JOHNSON,8953,1975-09-11
|
||||
000270 AD3113 60 .50 1982-03-01 1982-04-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 60 1.00 1982-04-01 1982-09-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 60 .25 1982-09-01 1982-10-15 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 70 .75 1982-09-01 1982-10-15 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 70 1.00 1982-10-15 1983-02-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 80 1.00 1982-01-01 1982-03-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000270 AD3113 80 .50 1982-03-01 1982-04-01 000270
|
||||
>>000270,MARIA,L,PEREZ,PEREZ,9001,1980-09-30
|
||||
000280 OP1010 130 1.00 1982-01-01 1983-02-01 000280
|
||||
>>000280,ETHEL,R,SCHNEIDER,SCHNEIDER,8997,1967-03-24
|
||||
000290 OP1010 130 1.00 1982-01-01 1983-02-01 000290
|
||||
>>000290,JOHN,R,PARKER,PARKER,4502,1980-05-30
|
||||
000300 OP1010 130 1.00 1982-01-01 1983-02-01 000300
|
||||
>>000300,PHILIP,X,SMITH,SMITH,2095,1972-06-19
|
||||
000310 OP1010 130 1.00 1982-01-01 1983-02-01 000310
|
||||
>>000310,MAUDE,F,SETRIGHT,SETRIGHT,3332,1964-09-12
|
||||
000320 OP2011 140 .75 1982-01-01 1983-02-01 000320
|
||||
>>000320,RAMLAL,V,MEHTA,MEHTA,9990,1965-07-07
|
||||
000320 OP2011 150 .25 1982-01-01 1983-02-01 000320
|
||||
>>000320,RAMLAL,V,MEHTA,MEHTA,9990,1965-07-07
|
||||
000330 OP2012 140 .25 1982-01-01 1983-02-01 000330
|
||||
>>000330,WING, ,LEE,LEE,2103,1976-02-23
|
||||
000330 OP2012 160 .75 1982-01-01 1983-02-01 000330
|
||||
>>000330,WING, ,LEE,LEE,2103,1976-02-23
|
||||
000340 OP2013 140 .50 1982-01-01 1983-02-01 000340
|
||||
>>000340,JASON,R,GOUNOT,GOUNOT,5698,1947-05-05
|
||||
000340 OP2013 170 .50 1982-01-01 1983-02-01 000340
|
||||
>>000340,JASON,R,GOUNOT,GOUNOT,5698,1947-05-05
|
||||
000020 PL2100 30 1.00 1982-01-01 1982-09-15 000020
|
||||
>>000020,MICHAEL,L,THOMPSON,THOMPSON,3476,1973-10-10
|
||||
44
tests/test_180_V5V6.phpt
Normal file
44
tests/test_180_V5V6.phpt
Normal file
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_stmt_errormsg()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_OFF );
|
||||
|
||||
if ($conn) {
|
||||
$result = @db2_exec($conn,"insert int0 t_string values(123,1.222333,'one to one')");
|
||||
if ($result) {
|
||||
$cols = db2_num_fields($result);
|
||||
echo 'col: ' . $cols . ',';
|
||||
$rows = db2_num_rows($result);
|
||||
echo 'affected row: ' . $rows ;
|
||||
}
|
||||
else {
|
||||
echo db2_stmt_errormsg();
|
||||
}
|
||||
$result = @db2_exec($conn,"delete from t_string where a=123");
|
||||
if ($result) {
|
||||
$cols = db2_num_fields($result);
|
||||
echo 'col: ' . $cols . ',';
|
||||
$rows = db2_num_rows($result);
|
||||
echo 'affected row: ' . $rows ;
|
||||
}
|
||||
else {
|
||||
echo db2_stmt_errormsg();
|
||||
}
|
||||
|
||||
db2_rollback($conn);
|
||||
|
||||
}
|
||||
else {
|
||||
echo 'no connection';
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Token INT0 was not valid. Valid tokens: INTO. SQLCODE=-104col: 0,affected row: 0
|
||||
34
tests/test_191_V5.phpt
Normal file
34
tests/test_191_V5.phpt
Normal file
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_columns() - 2 - table
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
if ($conn) {
|
||||
$result = db2_columns($conn,NULL,NULL,"EMP_PHOTO");
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result)) {
|
||||
// IS_NULLABLE is NULLABLE
|
||||
if ($row['COLUMN_NAME'] != 'EMP_ROWID' && $i < 3) {
|
||||
printf ("%s,%s,%s,%s\n", $row['TABLE_SCHEM'],
|
||||
$row['TABLE_NAME'], $row['COLUMN_NAME'], $row['NULLABLE']);
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
print "done!";
|
||||
} else {
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
%s,EMP_PHOTO,EMPNO,0
|
||||
%s,EMP_PHOTO,PHOTO_FORMAT,0
|
||||
%s,EMP_PHOTO,PICTURE,1
|
||||
done!
|
||||
32
tests/test_191_V6.phpt
Normal file
32
tests/test_191_V6.phpt
Normal file
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_columns() - 2 - table
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
if ($conn) {
|
||||
$result = db2_columns($conn,NULL,strtoupper($username),"EMP_PHOTO");
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result)) {
|
||||
if ($row['COLUMN_NAME'] != 'EMP_ROWID' && $i < 3) {
|
||||
printf ("%s,%s,%s,%s\n", $row['TABLE_SCHEM'],
|
||||
$row['TABLE_NAME'], $row['COLUMN_NAME'], $row['IS_NULLABLE']);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
print "done!";
|
||||
} else {
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
%s,EMP_PHOTO,EMPNO,NO
|
||||
%s,EMP_PHOTO,PHOTO_FORMAT,NO
|
||||
%s,EMP_PHOTO,PICTURE,YES
|
||||
done!
|
||||
31
tests/test_192_V5V6.phpt
Normal file
31
tests/test_192_V5V6.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_columns() - 3 - table
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
if ($conn) {
|
||||
$result = db2_columns($conn,NULL,strtoupper($username),"EMP_RESUME");
|
||||
$i = 0;
|
||||
while ($row = db2_fetch_both($result)) {
|
||||
// IS_NULLABLE (index 10) is NULLABLE (index 17)
|
||||
if ($row['COLUMN_NAME'] != 'EMP_ROWID' && $i < 3) {
|
||||
printf ("%s,%s,%s,%s\n", $row[1],
|
||||
$row[2], $row[3], $row[10]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
%s,EMP_RESUME,EMPNO,0
|
||||
%s,EMP_RESUME,RESUME_FORMAT,0
|
||||
%s,EMP_RESUME,RESUME,1
|
||||
270
tests/test_194_V5V6.phpt
Normal file
270
tests/test_194_V5V6.phpt
Normal file
@@ -0,0 +1,270 @@
|
||||
--TEST--
|
||||
IBM-DB2: retrieve CLOB columns: scrollable cursor
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$sql = "SELECT empno, resume_format, resume
|
||||
FROM emp_resume
|
||||
WHERE resume_format = 'ascii'";
|
||||
|
||||
if (!$conn) {
|
||||
die('no connection: ' . db2_conn_errormsg());
|
||||
}
|
||||
$result = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
|
||||
$i = 1;
|
||||
while ($row = db2_fetch_array($result, $i++)) {
|
||||
print_r($row);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => 000130
|
||||
[1] => ascii
|
||||
[2] =>
|
||||
|
||||
Resume: Delores M. Quintana
|
||||
|
||||
|
||||
Personal Information
|
||||
|
||||
Address: 1150 Eglinton Ave
|
||||
Mellonville, Idaho 83725
|
||||
Phone: (208) 875-9933
|
||||
Birthdate: September 15, 1925
|
||||
Sex: Female
|
||||
Marital Status: Married
|
||||
Height: 5'2"
|
||||
Weight: 120 lbs.
|
||||
|
||||
|
||||
Department Information
|
||||
|
||||
Employee Number: 000130
|
||||
Dept Number: C01
|
||||
Manager: Sally Kwan
|
||||
Position: Analyst
|
||||
Phone: (208) 385-4578
|
||||
Hire Date: 1971-07-28
|
||||
|
||||
|
||||
Education
|
||||
|
||||
1965 Math and English, B.A.
|
||||
Adelphi University
|
||||
|
||||
1960 Dental Technician
|
||||
Florida Institute of Technology
|
||||
|
||||
|
||||
Work History
|
||||
|
||||
10/91 - present Advisory Systems Analyst
|
||||
Producing documentation tools for engineering
|
||||
department.
|
||||
|
||||
12/85 - 9/91 Technical Writer
|
||||
Writer, text programmer, and planner.
|
||||
|
||||
1/79 - 11/85 COBOL Payroll Programmer
|
||||
Writing payroll programs for a diesel fuel
|
||||
company.
|
||||
|
||||
|
||||
Interests
|
||||
|
||||
o Cooking
|
||||
o Reading
|
||||
o Sewing
|
||||
o Remodeling
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 000140
|
||||
[1] => ascii
|
||||
[2] =>
|
||||
|
||||
Resume: Heather A. Nicholls
|
||||
|
||||
|
||||
Personal Information
|
||||
|
||||
Address: 844 Don Mills Ave
|
||||
Mellonville, Idaho 83734
|
||||
Phone: (208) 610-2310
|
||||
Birthdate: January 19, 1946
|
||||
Sex: Female
|
||||
Marital Status: Single
|
||||
Height: 5'8"
|
||||
Weight: 130 lbs.
|
||||
|
||||
|
||||
Department Information
|
||||
|
||||
Employee Number: 000140
|
||||
Dept Number: C01
|
||||
Manager: Sally Kwan
|
||||
Position: Analyst
|
||||
Phone: (208) 385-1793
|
||||
Hire Date: 1976-12-15
|
||||
|
||||
|
||||
Education
|
||||
|
||||
1972 Computer Engineering, Ph.D.
|
||||
University of Washington
|
||||
|
||||
1969 Music and Physics, B.A.
|
||||
Vassar College
|
||||
|
||||
|
||||
Work History
|
||||
|
||||
2/83 - present Architect, OCR Development
|
||||
Designing the architecture of OCR products.
|
||||
|
||||
12/76 - 1/83 Text Programmer
|
||||
Optical character recognition (OCR) programming in
|
||||
PL/I.
|
||||
|
||||
9/72 - 11/76 Punch Card Quality Analyst
|
||||
Checking punch cards met quality specifications.
|
||||
|
||||
|
||||
Interests
|
||||
|
||||
o Model railroading
|
||||
o Interior decorating
|
||||
o Embroidery
|
||||
o Knitting
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 000150
|
||||
[1] => ascii
|
||||
[2] =>
|
||||
|
||||
Resume: Bruce Adamson
|
||||
|
||||
|
||||
Personal Information
|
||||
|
||||
Address: 3600 Steeles Ave
|
||||
Mellonville, Idaho 83757
|
||||
Phone: (208) 725-4489
|
||||
Birthdate: May 17, 1947
|
||||
Sex: Male
|
||||
Marital Status: Married
|
||||
Height: 6'0"
|
||||
Weight: 175 lbs.
|
||||
|
||||
|
||||
Department Information
|
||||
|
||||
Employee Number: 000150
|
||||
Dept Number: D11
|
||||
Manager: Irving Stern
|
||||
Position: Designer
|
||||
Phone: (208) 385-4510
|
||||
Hire Date: 1972-02-12
|
||||
|
||||
|
||||
Education
|
||||
|
||||
1971 Environmental Engineering, M.Sc.
|
||||
Johns Hopkins University
|
||||
|
||||
1968 American History, B.A.
|
||||
Northwestern University
|
||||
|
||||
|
||||
Work History
|
||||
|
||||
8/79 - present Neural Network Design
|
||||
Developing neural networks for machine
|
||||
intelligence products.
|
||||
|
||||
2/72 - 7/79 Robot Vision Development
|
||||
Developing rule-based systems to emulate sight.
|
||||
|
||||
9/71 - 1/72 Numerical Integration Specialist
|
||||
Helping bank systems communicate with each other.
|
||||
|
||||
|
||||
Interests
|
||||
|
||||
o Racing motorcycles
|
||||
o Building loudspeakers
|
||||
o Assembling personal computers
|
||||
o Sketching
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 000190
|
||||
[1] => ascii
|
||||
[2] =>
|
||||
|
||||
Resume: James H. Walker
|
||||
|
||||
|
||||
Personal Information
|
||||
|
||||
Address: 3500 Steeles Ave
|
||||
Mellonville, Idaho 83757
|
||||
Phone: (208) 725-7325
|
||||
Birthdate: June 25, 1952
|
||||
Sex: Male
|
||||
Marital Status: Single
|
||||
Height: 5'11"
|
||||
Weight: 166 lbs.
|
||||
|
||||
|
||||
Department Information
|
||||
|
||||
Employee Number: 000190
|
||||
Dept Number: D11
|
||||
Manager: Irving Stern
|
||||
Position: Designer
|
||||
Phone: (208) 385-2986
|
||||
Hire Date: 1974-07-26
|
||||
|
||||
|
||||
Education
|
||||
|
||||
1974 Computer Studies, B.Sc.
|
||||
University of Massachusetts
|
||||
|
||||
1972 Linguistic Anthropology, B.A.
|
||||
University of Toronto
|
||||
|
||||
|
||||
Work History
|
||||
|
||||
6/87 - present Microcode Design
|
||||
Optimizing algorithms for mathematical functions.
|
||||
|
||||
4/77 - 5/87 Printer Technical Support
|
||||
Installing and supporting laser printers.
|
||||
|
||||
9/74 - 3/77 Maintenance Programming
|
||||
Patching assembly language compiler for
|
||||
mainframes.
|
||||
|
||||
|
||||
Interests
|
||||
|
||||
o Wine tasting
|
||||
o Skiing
|
||||
o Swimming
|
||||
o Dancing
|
||||
|
||||
)
|
||||
75
tests/test_198_V5V6.phpt
Normal file
75
tests/test_198_V5V6.phpt
Normal file
@@ -0,0 +1,75 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_lob_read() -- Reading and writing lobs from memory
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$username,$password);
|
||||
|
||||
if ($conn) {
|
||||
$drop = 'DROP TABLE clob_stream';
|
||||
$result = @db2_exec( $conn, $drop );
|
||||
|
||||
$create = 'CREATE TABLE clob_stream (id INTEGER, my_clob CLOB)';
|
||||
$result = db2_exec( $conn, $create );
|
||||
|
||||
$variable = "";
|
||||
$stmt = db2_prepare($conn, "INSERT INTO clob_stream (id,my_clob) VALUES (1, ?)");
|
||||
$variable = "THIS IS A CLOB TEST. THIS IS A CLOB TEST.";
|
||||
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
|
||||
db2_execute($stmt);
|
||||
|
||||
$sql = "SELECT id,my_clob FROM clob_stream";
|
||||
$result = db2_prepare($conn, $sql);
|
||||
db2_execute($result);
|
||||
db2_fetch_row($result);
|
||||
$i = 0;
|
||||
while ($data = db2_lob_read($result, 2, 6)) {
|
||||
echo "Loop $i: $data\n";
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$drop = 'DROP TABLE blob_stream';
|
||||
$result = @db2_exec( $conn, $drop );
|
||||
|
||||
$create = 'CREATE TABLE blob_stream (id INTEGER, my_blob BLOB)';
|
||||
$result = db2_exec( $conn, $create );
|
||||
|
||||
$variable = "";
|
||||
$stmt = db2_prepare($conn, "INSERT INTO blob_stream (id,my_blob) VALUES (1, ?)");
|
||||
$variable = "THIS IS A BLOB TEST. THIS IS A BLOB TEST.";
|
||||
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
|
||||
db2_execute($stmt);
|
||||
|
||||
$sql = "SELECT id,my_blob FROM blob_stream";
|
||||
$result = db2_prepare($conn, $sql);
|
||||
db2_execute($result);
|
||||
db2_fetch_row($result);
|
||||
$i = 0;
|
||||
while ($data = db2_lob_read($result, 2, 6)) {
|
||||
echo "Loop $i: $data\n";
|
||||
$i = $i + 1;
|
||||
}
|
||||
} else {
|
||||
echo 'no connection: ' . db2_conn_errormsg();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Loop 0: THIS I
|
||||
Loop 1: S A CL
|
||||
Loop 2: OB TES
|
||||
Loop 3: T. THI
|
||||
Loop 4: S IS A
|
||||
Loop 5: CLOB
|
||||
Loop 6: TEST.
|
||||
Loop 0: THIS I
|
||||
Loop 1: S A BL
|
||||
Loop 2: OB TES
|
||||
Loop 3: T. THI
|
||||
Loop 4: S IS A
|
||||
Loop 5: BLOB
|
||||
Loop 6: TEST.
|
||||
216
tests/test_201_V5V6.phpt
Normal file
216
tests/test_201_V5V6.phpt
Normal file
@@ -0,0 +1,216 @@
|
||||
--TEST--
|
||||
IBM-DB2: Multiple result sets (different column definitions)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$procedure = <<<HERE
|
||||
CREATE PROCEDURE multiResults ()
|
||||
RESULT SETS 3
|
||||
LANGUAGE SQL
|
||||
BEGIN
|
||||
DECLARE c1 CURSOR WITH RETURN FOR
|
||||
SELECT name, id
|
||||
FROM animals
|
||||
ORDER BY name;
|
||||
|
||||
DECLARE c2 CURSOR WITH RETURN FOR
|
||||
SELECT name, id, breed, weight
|
||||
FROM animals
|
||||
ORDER BY name DESC;
|
||||
|
||||
DECLARE c3 CURSOR WITH RETURN FOR
|
||||
SELECT name
|
||||
FROM animals
|
||||
ORDER BY name;
|
||||
|
||||
OPEN c1;
|
||||
OPEN c2;
|
||||
OPEN c3;
|
||||
END
|
||||
HERE;
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
db2_autocommit( $conn, DB2_AUTOCOMMIT_OFF );
|
||||
|
||||
if ($conn) {
|
||||
@db2_exec($conn, 'DROP PROCEDURE multiResults()');
|
||||
db2_exec($conn, $procedure);
|
||||
$stmt = db2_exec($conn, 'CALL multiResults()');
|
||||
|
||||
print "Fetching first result set\n";
|
||||
while ($row = db2_fetch_array($stmt)) {
|
||||
var_dump($row);
|
||||
}
|
||||
|
||||
print "Fetching second result set\n";
|
||||
$res = db2_next_result($stmt);
|
||||
if ($res) {
|
||||
while ($row = db2_fetch_array($res)) {
|
||||
var_dump($row);
|
||||
}
|
||||
}
|
||||
|
||||
print "Fetching third result set\n";
|
||||
$res2 = db2_next_result($stmt);
|
||||
if ($res2) {
|
||||
while ($row = db2_fetch_array($res2)) {
|
||||
var_dump($row);
|
||||
}
|
||||
}
|
||||
|
||||
db2_rollback($conn);
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Fetching first result set
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Bubbles "
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Gizmo "
|
||||
[1]=>
|
||||
int(4)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Peaches "
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Pook "
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Rickety Ride "
|
||||
[1]=>
|
||||
int(5)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Smarty "
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(16) "Sweater "
|
||||
[1]=>
|
||||
int(6)
|
||||
}
|
||||
Fetching second result set
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Sweater "
|
||||
[1]=>
|
||||
int(6)
|
||||
[2]=>
|
||||
string(5) "llama"
|
||||
[3]=>
|
||||
string(6) "150.00"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Smarty "
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
string(5) "horse"
|
||||
[3]=>
|
||||
string(6) "350.00"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Rickety Ride "
|
||||
[1]=>
|
||||
int(5)
|
||||
[2]=>
|
||||
string(4) "goat"
|
||||
[3]=>
|
||||
string(4) "9.70"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Pook "
|
||||
[1]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
string(3) "cat"
|
||||
[3]=>
|
||||
string(4) "3.20"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Peaches "
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
string(3) "dog"
|
||||
[3]=>
|
||||
string(5) "12.30"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Gizmo "
|
||||
[1]=>
|
||||
int(4)
|
||||
[2]=>
|
||||
string(10) "budgerigar"
|
||||
[3]=>
|
||||
string(3) ".20"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(16) "Bubbles "
|
||||
[1]=>
|
||||
int(3)
|
||||
[2]=>
|
||||
string(9) "gold fish"
|
||||
[3]=>
|
||||
string(3) ".10"
|
||||
}
|
||||
Fetching third result set
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Bubbles "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Gizmo "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Peaches "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Pook "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Rickety Ride "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Smarty "
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(16) "Sweater "
|
||||
}
|
||||
31
tests/test_210_V6.phpt
Normal file
31
tests/test_210_V6.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_display_size() - 1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from staff");
|
||||
$cols = db2_num_fields($result);
|
||||
|
||||
for ($i=0; $i<$cols; $i++)
|
||||
{
|
||||
$size = db2_field_display_size($result,$i);
|
||||
print "col:$i and size: $size\n";
|
||||
}
|
||||
|
||||
db2_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
col:0 and size: 7
|
||||
col:1 and size: 10
|
||||
col:2 and size: 7
|
||||
col:3 and size: 6
|
||||
col:4 and size: 7
|
||||
col:5 and size: 10
|
||||
col:6 and size: 10
|
||||
29
tests/test_211_V6.phpt
Normal file
29
tests/test_211_V6.phpt
Normal file
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_display_size() - 2
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
|
||||
$i=1;
|
||||
|
||||
while ($i <= db2_num_fields($result))
|
||||
{
|
||||
printf ("%d size %d\n",$i, db2_field_display_size($result,$i));
|
||||
$i++;
|
||||
}
|
||||
|
||||
db2_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
1 size 16
|
||||
2 size 16
|
||||
3 size 12
|
||||
4 size 0
|
||||
24
tests/test_212_V6.phpt
Normal file
24
tests/test_212_V6.phpt
Normal file
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_display_size() - 3
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
|
||||
$i = "SALES_PERSON";
|
||||
|
||||
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
$i=2;
|
||||
printf ("%d size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
SALES_PERSON size 16
|
||||
2 size 16
|
||||
55
tests/test_213_V6.phpt
Normal file
55
tests/test_213_V6.phpt
Normal file
@@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_display_size() - 4
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
|
||||
$i = "sales_person";
|
||||
|
||||
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
$i = "REGION";
|
||||
|
||||
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
$i = "REgion";
|
||||
|
||||
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
$i = "HELMUT";
|
||||
|
||||
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
|
||||
|
||||
$t = db2_field_display_size($result,"");
|
||||
|
||||
var_dump( $t );
|
||||
|
||||
$t = db2_field_display_size($result,"HELMUT");
|
||||
|
||||
var_dump( $t );
|
||||
|
||||
$t = db2_field_display_size($result,"Region");
|
||||
|
||||
var_dump( $t );
|
||||
|
||||
$t = db2_field_display_size($result,"SALES_DATE");
|
||||
|
||||
var_dump( $t );
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
sales_person size 0
|
||||
REGION size 16
|
||||
REgion size 0
|
||||
HELMUT size 0
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(11)
|
||||
59
tests/test_240_V5.phpt
Normal file
59
tests/test_240_V5.phpt
Normal file
@@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_width() - by position and name
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
$result2 = db2_exec($conn, "select * from staff");
|
||||
$result3 = db2_exec($conn, "select * from emp_photo");
|
||||
|
||||
for ($i=0; $i < db2_num_fields($result); $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result,$i) . "\n";
|
||||
}
|
||||
print "\n-----\n";
|
||||
for ($i=0; $i < db2_num_fields($result2); $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result2,db2_field_name($result2,$i)) . "\n";
|
||||
}
|
||||
print "\n-----\n";
|
||||
for ($i=0; $i < 3; $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result3,$i) . "," . db2_field_display_size($result3,$i)."\n";
|
||||
}
|
||||
|
||||
print "\n-----\n";
|
||||
print "region:" . db2_field_type($result,'region') . "\n";
|
||||
|
||||
print "5:" . db2_field_type($result2,5) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
0:10
|
||||
1:15
|
||||
2:15
|
||||
3:4
|
||||
|
||||
-----
|
||||
0:2
|
||||
1:9
|
||||
2:2
|
||||
3:5
|
||||
4:2
|
||||
5:1794
|
||||
6:1794
|
||||
|
||||
-----
|
||||
0:6,6
|
||||
1:10,10
|
||||
2:102400,102400
|
||||
|
||||
-----
|
||||
region:
|
||||
5:real
|
||||
59
tests/test_240_V6.phpt
Normal file
59
tests/test_240_V6.phpt
Normal file
@@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_width() - by position and name
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
$result2 = db2_exec($conn, "select * from staff");
|
||||
$result3 = db2_exec($conn, "select * from emp_photo");
|
||||
|
||||
for ($i=0; $i < db2_num_fields($result); $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result,$i) . "\n";
|
||||
}
|
||||
print "\n-----\n";
|
||||
for ($i=0; $i < db2_num_fields($result2); $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result2,db2_field_name($result2,$i)) . "\n";
|
||||
}
|
||||
print "\n-----\n";
|
||||
for ($i=0; $i < 3; $i++)
|
||||
{
|
||||
print $i . ":" . db2_field_width($result3,$i) . "," . db2_field_display_size($result3,$i)."\n";
|
||||
}
|
||||
|
||||
print "\n-----\n";
|
||||
print "region:" . db2_field_type($result,'region') . "\n";
|
||||
|
||||
print "5:" . db2_field_type($result2,5) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
0:10
|
||||
1:15
|
||||
2:15
|
||||
3:4
|
||||
|
||||
-----
|
||||
0:2
|
||||
1:9
|
||||
2:2
|
||||
3:5
|
||||
4:2
|
||||
5:1794
|
||||
6:1794
|
||||
|
||||
-----
|
||||
0:6,7
|
||||
1:10,11
|
||||
2:102400,102400
|
||||
|
||||
-----
|
||||
region:
|
||||
5:real
|
||||
40
tests/test_241_V5.phpt
Normal file
40
tests/test_241_V5.phpt
Normal file
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_field_width() - by position and name 2
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($db,$user,$password);
|
||||
|
||||
$result = db2_exec($conn, "select * from sales");
|
||||
$result2 = db2_exec($conn, "select * from staff");
|
||||
$result3 = db2_exec($conn, "select * from emp_photo");
|
||||
|
||||
for ($i=0; $i < db2_num_fields($result); $i++)
|
||||
{
|
||||
var_dump( db2_field_width($result,$i) );
|
||||
}
|
||||
print "\n-----\n";
|
||||
for ($i=0; $i < db2_num_fields($result2); $i++)
|
||||
{
|
||||
var_dump( db2_field_width($result2,db2_field_name($result2,$i)) );
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(10)
|
||||
int(15)
|
||||
int(15)
|
||||
int(4)
|
||||
|
||||
-----
|
||||
int(2)
|
||||
int(9)
|
||||
int(2)
|
||||
int(5)
|
||||
int(2)
|
||||
int(1794)
|
||||
int(1794)
|
||||
@@ -23,8 +23,8 @@ else {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (4) {
|
||||
--EXPECTF--
|
||||
object(stdClass)#%d (4) {
|
||||
["ID"]=>
|
||||
int(0)
|
||||
["BREED"]=>
|
||||
|
||||
36
tests/test_260_V5V6.phpt
Normal file
36
tests/test_260_V5V6.phpt
Normal file
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_fetch_object()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_exec( $conn, "SELECT id, breed, name, weight FROM animals WHERE id = 0" );
|
||||
|
||||
while ($object = db2_fetch_object($stmt)) {
|
||||
var_dump( $object );
|
||||
}
|
||||
db2_close($conn);
|
||||
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#2 (4) {
|
||||
["ID"]=>
|
||||
int(0)
|
||||
["BREED"]=>
|
||||
string(3) "cat"
|
||||
["NAME"]=>
|
||||
string(16) "Pook "
|
||||
["WEIGHT"]=>
|
||||
string(4) "3.20"
|
||||
}
|
||||
67
tests/test_300_V5V6.phpt
Normal file
67
tests/test_300_V5V6.phpt
Normal file
@@ -0,0 +1,67 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_server_info()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$server = db2_server_info( $conn );
|
||||
|
||||
if ($server) {
|
||||
echo "DBMS_NAME: "; var_dump( $server->DBMS_NAME );
|
||||
echo "DBMS_VER: "; var_dump( $server->DBMS_VER );
|
||||
// echo "DB_CODEPAGE: "; // var_dump( $server->DB_CODEPAGE );
|
||||
echo "DB_NAME: "; var_dump( $server->DB_NAME );
|
||||
// echo "INST_NAME: "; // var_dump( $server->INST_NAME );
|
||||
// echo "SPECIAL_CHARS: "; // var_dump( $server->SPECIAL_CHARS );
|
||||
echo "KEYWORDS: "; var_dump( sizeof($server->KEYWORDS) );
|
||||
echo "DFT_ISOLATION: "; var_dump( $server->DFT_ISOLATION );
|
||||
// echo "ISOLATION_OPTION: ";
|
||||
// $il = '';
|
||||
// foreach( $server->ISOLATION_OPTION as $opt )
|
||||
// {
|
||||
// $il .= $opt." ";
|
||||
// }
|
||||
// var_dump( $il );
|
||||
echo "SQL_CONFORMANCE: "; var_dump( $server->SQL_CONFORMANCE );
|
||||
echo "PROCEDURES: "; var_dump( $server->PROCEDURES );
|
||||
echo "IDENTIFIER_QUOTE_CHAR: "; var_dump( $server->IDENTIFIER_QUOTE_CHAR );
|
||||
echo "LIKE_ESCAPE_CLAUSE: "; var_dump( $server->LIKE_ESCAPE_CLAUSE );
|
||||
echo "MAX_COL_NAME_LEN: "; var_dump( $server->MAX_COL_NAME_LEN );
|
||||
echo "MAX_ROW_SIZE: "; var_dump( $server->MAX_ROW_SIZE );
|
||||
// echo "MAX_IDENTIFIER_LEN: "; // var_dump( $server->MAX_IDENTIFIER_LEN );
|
||||
// echo "MAX_INDEX_SIZE: "; // var_dump( $server->MAX_INDEX_SIZE );
|
||||
// echo "MAX_PROC_NAME_LEN: "; // var_dump( $server->MAX_PROC_NAME_LEN );
|
||||
echo "MAX_SCHEMA_NAME_LEN: "; var_dump( $server->MAX_SCHEMA_NAME_LEN );
|
||||
echo "MAX_STATEMENT_LEN: "; var_dump( $server->MAX_STATEMENT_LEN );
|
||||
echo "MAX_TABLE_NAME_LEN: "; var_dump( $server->MAX_TABLE_NAME_LEN );
|
||||
echo "NON_NULLABLE_COLUMNS: "; var_dump( $server->NON_NULLABLE_COLUMNS );
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Error.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
DBMS_NAME: string(%d) %s
|
||||
DBMS_VER: string(%d) %s
|
||||
DB_NAME: string(%d) %s
|
||||
KEYWORDS: int(%d)
|
||||
DFT_ISOLATION: string(%d) %s
|
||||
SQL_CONFORMANCE: string(%d) %s
|
||||
PROCEDURES: bool(%s)
|
||||
IDENTIFIER_QUOTE_CHAR: string(%d) %s
|
||||
LIKE_ESCAPE_CLAUSE: bool(%s)
|
||||
MAX_COL_NAME_LEN: int(%d)
|
||||
MAX_ROW_SIZE: int(%d)
|
||||
MAX_SCHEMA_NAME_LEN: int(%d)
|
||||
MAX_STATEMENT_LEN: int(%d)
|
||||
MAX_TABLE_NAME_LEN: int(%d)
|
||||
NON_NULLABLE_COLUMNS: bool(%s)
|
||||
|
||||
37
tests/test_310_V5V6.phpt
Normal file
37
tests/test_310_V5V6.phpt
Normal file
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
IBM-DB2: db2_client_info()
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
$client = db2_client_info( $conn );
|
||||
|
||||
if ($client) {
|
||||
echo "DRIVER_NAME: "; var_dump( $client->DRIVER_NAME );
|
||||
echo "DRIVER_VER: "; var_dump( $client->DRIVER_VER );
|
||||
echo "DATA_SOURCE_NAME: "; var_dump( $client->DATA_SOURCE_NAME );
|
||||
echo "DRIVER_ODBC_VER: "; var_dump( $client->DRIVER_ODBC_VER );
|
||||
// echo "ODBC_VER: "; // var_dump( $client->ODBC_VER );
|
||||
echo "ODBC_SQL_CONFORMANCE: "; var_dump( $client->ODBC_SQL_CONFORMANCE );
|
||||
// echo "APPL_CODEPAGE: "; // var_dump( $client->APPL_CODEPAGE );
|
||||
// echo "CONN_CODEPAGE: "; // var_dump( $client->CONN_CODEPAGE );
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Error.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
DRIVER_NAME: string(%d) %s
|
||||
DRIVER_VER: string(%d) %s
|
||||
DATA_SOURCE_NAME: string(%d) %s
|
||||
DRIVER_ODBC_VER: string(%d) %s
|
||||
ODBC_SQL_CONFORMANCE: string(%d) %s
|
||||
|
||||
56
tests/test_6792_V5V6.phpt
Normal file
56
tests/test_6792_V5V6.phpt
Normal file
@@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
IBM-DB2: PECL bug 6792 -- db2_field_type returns 'string' for date, time, and timestamp
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$statement = "DROP TABLE table_6792";
|
||||
$result = @db2_exec($conn, $statement);
|
||||
$statement = "CREATE TABLE table_6792 (col1 TIME, col2 DATE, col3 TIMESTAMP)";
|
||||
$result = db2_exec($conn, $statement);
|
||||
$statement = "INSERT INTO table_6792 (col1, col2, col3) values ('10.42.34', '1981-07-08', '1981-07-08-10.42.34')";
|
||||
$result = db2_exec($conn, $statement);
|
||||
$statement = "SELECT * FROM table_6792";
|
||||
$result = db2_exec($conn, $statement);
|
||||
|
||||
for ($i=0; $i < db2_num_fields($result); $i++)
|
||||
{
|
||||
echo $i . ":" . db2_field_type($result,$i) . "\n";
|
||||
}
|
||||
|
||||
$statement = "SELECT * FROM table_6792";
|
||||
$stmt = db2_prepare($conn, $statement);
|
||||
$rc = db2_execute($stmt);
|
||||
while(db2_fetch_row($stmt)) {
|
||||
$row0 = db2_result($stmt, 0);
|
||||
$row1 = db2_result($stmt, 1);
|
||||
$row2 = db2_result($stmt, 2);
|
||||
echo $row0 . "\n";
|
||||
echo $row1 . "\n";
|
||||
echo $row2 . "\n";
|
||||
}
|
||||
|
||||
$statement = "DROP TABLE table_6792";
|
||||
$result = @db2_exec($conn, $statement);
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
0:time
|
||||
1:date
|
||||
2:timestamp
|
||||
10.42.34
|
||||
1981-07-08
|
||||
1981-07-08-10.42.34.000000
|
||||
|
||||
41
tests/test_9173_V5.phpt
Normal file
41
tests/test_9173_V5.phpt
Normal file
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
IBM-DB2: PECL bug 9173 -- db2_procedures & db2_ procedure_columns doesn't work on persistent connections
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_pconnect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_procedures($conn, NULL, 'SYS%', '%%');
|
||||
|
||||
$row = db2_fetch_assoc($stmt);
|
||||
var_dump($row);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(7) {
|
||||
["PROCEDURE_CAT"]=>
|
||||
%s
|
||||
["PROCEDURE_SCHEM"]=>
|
||||
string(%d) "%s"
|
||||
["PROCEDURE_NAME"]=>
|
||||
string(%d) "%s"
|
||||
["NUM_INPUT_PARAMS"]=>
|
||||
int(%d)
|
||||
["NUM_OUTPUT_PARAMS"]=>
|
||||
int(%d)
|
||||
["NUM_RESULT_SETS"]=>
|
||||
int(%d)
|
||||
["REMARKS"]=>
|
||||
%s
|
||||
}
|
||||
43
tests/test_9173_V6.phpt
Normal file
43
tests/test_9173_V6.phpt
Normal file
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
IBM-DB2: PECL bug 9173 -- db2_procedures & db2_ procedure_columns doesn't work on persistent connections
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
|
||||
$conn = db2_pconnect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
$stmt = db2_procedures($conn, NULL, 'SYS%', '%%');
|
||||
|
||||
$row = db2_fetch_assoc($stmt);
|
||||
var_dump($row);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(8) {
|
||||
["PROCEDURE_CAT"]=>
|
||||
%s
|
||||
["PROCEDURE_SCHEM"]=>
|
||||
string(%d) "%s"
|
||||
["PROCEDURE_NAME"]=>
|
||||
string(%d) "%s"
|
||||
["NUM_INPUT_PARAMS"]=>
|
||||
int(%d)
|
||||
["NUM_OUTPUT_PARAMS"]=>
|
||||
int(%d)
|
||||
["NUM_RESULT_SETS"]=>
|
||||
int(%d)
|
||||
["REMARKS"]=>
|
||||
%s
|
||||
["PROCEDURE_TYPE"]=>
|
||||
int(%d)
|
||||
}
|
||||
107
tests/test_last_insert_id_V5V6.phpt
Normal file
107
tests/test_last_insert_id_V5V6.phpt
Normal file
@@ -0,0 +1,107 @@
|
||||
--TEST--
|
||||
IBM-DB2: Last Insert ID test
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
|
||||
if ($conn) {
|
||||
echo "Connection succeeded.\n";
|
||||
|
||||
$dropTable = 'DROP TABLE lastInsertID';
|
||||
|
||||
$createTable = 'CREATE TABLE lastInsertID (id integer GENERATED BY DEFAULT AS IDENTITY, name varchar(20))';
|
||||
$insertTable = 'INSERT INTO lastInsertID (name) VALUES (\'Temp Name\')';
|
||||
$insertMany = 'INSERT INTO lastInsertID (name) VALUES (\'Temp Name\'), (\'Temp Name\')';
|
||||
|
||||
$stmt = @db2_exec($conn, $dropTable);
|
||||
$stmt = @db2_exec($conn, $createTable);
|
||||
|
||||
/* Checking when no insert has been executed. */
|
||||
$ret = db2_last_insert_id($conn);
|
||||
if($ret) {
|
||||
echo "Last Insert ID is : " . $ret . "\n";
|
||||
} else {
|
||||
echo "No Last insert ID.\n";
|
||||
}
|
||||
|
||||
/* Inserting many rows from VALUES clause */
|
||||
$stmt = db2_exec($conn, $insertMany);
|
||||
$ret = db2_last_insert_id($conn);
|
||||
if($ret) {
|
||||
echo "Last Insert ID is : " . $ret . "\n";
|
||||
} else {
|
||||
echo "No Last insert ID.\n";
|
||||
}
|
||||
|
||||
/* Checking for single row inserted. */
|
||||
$stmt = db2_exec($conn, $insertTable);
|
||||
$ret = db2_last_insert_id($conn);
|
||||
if($ret) {
|
||||
echo "Last Insert ID is : " . $ret . "\n";
|
||||
} else {
|
||||
echo "No Last insert ID.\n";
|
||||
}
|
||||
|
||||
/* Checking when multiple rows has been inserted separately. */
|
||||
for ($i = 0;$i < 5;$i++) {
|
||||
$stmt = db2_exec($conn, $insertTable);
|
||||
$ret = db2_last_insert_id($conn);
|
||||
if($ret) {
|
||||
echo "Last Insert ID is : " . $ret . "\n";
|
||||
} else {
|
||||
echo "No Last insert ID.\n";
|
||||
}
|
||||
}
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
//Testing when there is no serial column in table.
|
||||
$conn = db2_connect($database, $user, $password);
|
||||
if ($conn) {
|
||||
echo "Connection succeeded.\n";
|
||||
|
||||
$dropTable = 'DROP TABLE lastInsertID';
|
||||
|
||||
$createTable = 'CREATE TABLE lastInsertID (id integer, name varchar(20))';
|
||||
$insertTable = 'INSERT INTO lastInsertID (id, name) VALUES (1, \'Temp Name\')';
|
||||
|
||||
$stmt = @db2_exec($conn, $dropTable);
|
||||
$stmt = @db2_exec($conn, $createTable);
|
||||
|
||||
$stmt = db2_exec($conn, $insertTable);
|
||||
$ret = db2_last_insert_id($conn);
|
||||
if($ret) {
|
||||
echo "Last Insert ID is : " . $ret . "\n";
|
||||
} else {
|
||||
echo "No Last insert ID.\n";
|
||||
}
|
||||
|
||||
$stmt = @db2_exec($conn, $dropTable);
|
||||
|
||||
db2_close($conn);
|
||||
}
|
||||
else {
|
||||
echo "Connection failed.";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Connection succeeded.
|
||||
No Last insert ID.
|
||||
Last Insert ID is : 2
|
||||
Last Insert ID is : 3
|
||||
Last Insert ID is : 4
|
||||
Last Insert ID is : 5
|
||||
Last Insert ID is : 6
|
||||
Last Insert ID is : 7
|
||||
Last Insert ID is : 8
|
||||
Connection succeeded.
|
||||
No Last insert ID.
|
||||
Reference in New Issue
Block a user