diff options
author | Wez Furlong <wez@php.net> | 2005-07-07 15:36:00 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-07-07 15:36:00 +0000 |
commit | 5fe199fb0fb71bab90a293fafb2ac2b3a37bbbba (patch) | |
tree | 8fa01244005195a874b5e2c65bab00b9be958dfe /ext/pdo/tests | |
parent | 4580a7fd8e9f9b7a3dd0027c1279828eb04f741b (diff) | |
download | php-git-5fe199fb0fb71bab90a293fafb2ac2b3a37bbbba.tar.gz |
remove old test files
Diffstat (limited to 'ext/pdo/tests')
27 files changed, 0 insertions, 1130 deletions
diff --git a/ext/pdo/tests/pdo_001.inc b/ext/pdo/tests/pdo_001.inc deleted file mode 100755 index 68c61a1746..0000000000 --- a/ext/pdo/tests/pdo_001.inc +++ /dev/null @@ -1,20 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\')'); -set_sql('select', 'SELECT * FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -$stmt = $DB->query($SQL['select']); - -var_dump($stmt->fetchAll(PDO_FETCH_ASSOC)); -?> diff --git a/ext/pdo/tests/pdo_002.inc b/ext/pdo/tests/pdo_002.inc deleted file mode 100755 index c1bb2b5114..0000000000 --- a/ext/pdo/tests/pdo_002.inc +++ /dev/null @@ -1,21 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\')'); -set_sql('select', 'SELECT * FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -$stmt = $DB->query($SQL['select']); - -var_dump($stmt->fetchAll(PDO_FETCH_NUM)); - -?> diff --git a/ext/pdo/tests/pdo_003.inc b/ext/pdo/tests/pdo_003.inc deleted file mode 100755 index 3752a9ad4e..0000000000 --- a/ext/pdo/tests/pdo_003.inc +++ /dev/null @@ -1,20 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\')'); -set_sql('select', 'SELECT * FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -$stmt = $DB->query($SQL['select']); - -var_dump($stmt->fetchAll(PDO_FETCH_BOTH)); -?> diff --git a/ext/pdo/tests/pdo_004.inc b/ext/pdo/tests/pdo_004.inc deleted file mode 100755 index 6851ec4ef6..0000000000 --- a/ext/pdo/tests/pdo_004.inc +++ /dev/null @@ -1,20 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\')'); -set_sql('select', 'SELECT * FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -$stmt = $DB->query($SQL['select']); - -var_dump($stmt->fetchAll(PDO_FETCH_OBJ)); -?> diff --git a/ext/pdo/tests/pdo_005.inc b/ext/pdo/tests/pdo_005.inc deleted file mode 100755 index 01649b2cc3..0000000000 --- a/ext/pdo/tests/pdo_005.inc +++ /dev/null @@ -1,38 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'AA\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\', \'BB\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\', \'CC\')'); -set_sql('select', 'SELECT id, val, val2 FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -class TestBase -{ - public $id; - protected $val; - private $val2; -} - -class TestDerived extends TestBase -{ - protected $row; - - public function __construct(&$row) - { - echo __METHOD__ . "($row,{$this->id})\n"; - $this->row = $row++; - } -} - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS)); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS, 'TestBase')); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS, 'TestDerived', array(0))); -?> diff --git a/ext/pdo/tests/pdo_006.inc b/ext/pdo/tests/pdo_006.inc deleted file mode 100755 index 30c780bc79..0000000000 --- a/ext/pdo/tests/pdo_006.inc +++ /dev/null @@ -1,20 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'A\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\')'); -set_sql('select', 'SELECT val, id FROM test'); - - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_NUM|PDO_FETCH_GROUP)); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_GROUP)); - -?> diff --git a/ext/pdo/tests/pdo_007.inc b/ext/pdo/tests/pdo_007.inc deleted file mode 100755 index 265ffab85c..0000000000 --- a/ext/pdo/tests/pdo_007.inc +++ /dev/null @@ -1,19 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(\'A\', \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(\'B\', \'A\')'); -set_sql('insert3', 'INSERT INTO test VALUES(\'C\', \'C\')'); -set_sql('select', 'SELECT id, val FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE)); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_UNIQUE)); - -?> diff --git a/ext/pdo/tests/pdo_008.inc b/ext/pdo/tests/pdo_008.inc deleted file mode 100755 index 561ebd2a6d..0000000000 --- a/ext/pdo/tests/pdo_008.inc +++ /dev/null @@ -1,19 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(\'A\', \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(\'B\', \'A\')'); -set_sql('insert3', 'INSERT INTO test VALUES(\'C\', \'C\')'); -set_sql('select', 'SELECT val, id FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE)); -// check that repeated first columns overwrite existing array elements - -?> diff --git a/ext/pdo/tests/pdo_009.inc b/ext/pdo/tests/pdo_009.inc deleted file mode 100755 index d54aa61a66..0000000000 --- a/ext/pdo/tests/pdo_009.inc +++ /dev/null @@ -1,53 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(10) UNIQUE)'); -set_sql('insert1', 'INSERT INTO classtypes VALUES(0, \'stdClass\')'); -set_sql('insert2', 'INSERT INTO classtypes VALUES(1, \'Test1\')'); -set_sql('insert3', 'INSERT INTO classtypes VALUES(2, \'Test2\')'); -set_sql('create2', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10))'); -set_sql('insert4', 'INSERT INTO test VALUES(1, 0, \'A\')'); -set_sql('insert5', 'INSERT INTO test VALUES(2, 1, \'B\')'); -set_sql('insert6', 'INSERT INTO test VALUES(3, 2, \'C\')'); -set_sql('insert7', 'INSERT INTO test VALUES(4, 3, \'D\')'); -set_sql('select', 'SELECT classtypes.name, test.id AS id, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id'); - -$DB->exec($SQL['create1']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); -$DB->exec($SQL['create2']); -$DB->exec($SQL['insert4']); -$DB->exec($SQL['insert5']); -$DB->exec($SQL['insert6']); -$DB->exec($SQL['insert7']); - -class Test1 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -class Test2 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -class Test3 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_NUM)); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE, 'Test3')); - -?> diff --git a/ext/pdo/tests/pdo_010.inc b/ext/pdo/tests/pdo_010.inc deleted file mode 100755 index 2e4c943508..0000000000 --- a/ext/pdo/tests/pdo_010.inc +++ /dev/null @@ -1,53 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(10) UNIQUE)'); -set_sql('insert1', 'INSERT INTO classtypes VALUES(0, \'stdClass\')'); -set_sql('insert2', 'INSERT INTO classtypes VALUES(1, \'Test1\')'); -set_sql('insert3', 'INSERT INTO classtypes VALUES(2, \'Test2\')'); -set_sql('create2', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(10), grp VARCHAR(10))'); -set_sql('insert4', 'INSERT INTO test VALUES(1, 0, \'A\', \'Group1\')'); -set_sql('insert5', 'INSERT INTO test VALUES(2, 1, \'B\', \'Group1\')'); -set_sql('insert6', 'INSERT INTO test VALUES(3, 2, \'C\', \'Group2\')'); -set_sql('insert7', 'INSERT INTO test VALUES(4, 3, \'D\', \'Group2\')'); -set_sql('select', 'SELECT classtypes.name, test.grp AS grp, test.id AS id, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id'); - -$DB->exec($SQL['create1']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); -$DB->exec($SQL['create2']); -$DB->exec($SQL['insert4']); -$DB->exec($SQL['insert5']); -$DB->exec($SQL['insert6']); -$DB->exec($SQL['insert7']); - -class Test1 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -class Test2 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -class Test3 -{ - public function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_GROUP, 'Test3')); -var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_UNIQUE, 'Test3')); - -?> diff --git a/ext/pdo/tests/pdo_011.inc b/ext/pdo/tests/pdo_011.inc deleted file mode 100755 index 896abb3575..0000000000 --- a/ext/pdo/tests/pdo_011.inc +++ /dev/null @@ -1,67 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\', \'Group1\')'); -set_sql('insert3', 'INSERT INTO test VALUES(3, \'C\', \'Group2\')'); -set_sql('insert4', 'INSERT INTO test VALUES(4, \'D\', \'Group2\')'); -set_sql('select1', 'SELECT grp, id FROM test'); -set_sql('select2', 'SELECT id, val FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); -$DB->exec($SQL['insert4']); - -class Test1 -{ - public function __construct($id, $val) - { - echo __METHOD__ . "($id,$val)\n"; - $this->id = $id; - $this->val = $val; - } - - static public function factory($id, $val) - { - echo __METHOD__ . "($id,$val)\n"; - return new self($id, $val); - } -} - -function test($id,$val='N/A') -{ - echo __METHOD__ . "($id,$val)\n"; - return array($id=>$val); -} - -$f = new Test1(0,0); - -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_FUNC|PDO_FETCH_GROUP, 'test')); -var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_FUNC, 'test')); -var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_FUNC, array('Test1','factory'))); -var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_FUNC, array($f, 'factory'))); - -class DerivedStatement extends PDOStatement -{ - private function __construct($name, $db) - { - $this->name = $name; - echo __METHOD__ . "($name)\n"; - } - - function retrieve($id, $val) { - echo __METHOD__ . "($id,$val)\n"; - return array($id=>$val); - } -} - -$stmt = $DB->prepare($SQL['select2'], array(PDO_ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded', $DB)))); -var_dump(get_class($stmt)); -$stmt->execute(); -var_dump($stmt->fetchAll(PDO_FETCH_FUNC, array($stmt, 'retrieve'))); - -?> diff --git a/ext/pdo/tests/pdo_012.inc b/ext/pdo/tests/pdo_012.inc deleted file mode 100755 index ee07b41143..0000000000 --- a/ext/pdo/tests/pdo_012.inc +++ /dev/null @@ -1,32 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\', \'Group2\')'); -set_sql('select1', 'SELECT val, grp FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); - -$stmt = $DB->query($SQL['select1'], PDO_FETCH_NUM); -var_dump($stmt->fetchAll()); - -class Test -{ - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } -} - -$stmt = $DB->query($SQL['select1'], PDO_FETCH_CLASS, 'Test'); -var_dump($stmt->fetchAll()); - -$stmt = $DB->query($SQL['select1'], PDO_FETCH_NUM); -$stmt->setFetchMode(PDO_FETCH_CLASS, 'Test', array('Changed')); -var_dump($stmt->fetchAll()); - -?> diff --git a/ext/pdo/tests/pdo_013.inc b/ext/pdo/tests/pdo_013.inc deleted file mode 100755 index 359c2b1cb6..0000000000 --- a/ext/pdo/tests/pdo_013.inc +++ /dev/null @@ -1,39 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\', \'Group2\')'); -set_sql('select1', 'SELECT val, grp FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); - -foreach($DB->query($SQL['select1'], PDO_FETCH_NUM) as $data) -{ - var_dump($data); -} - -class Test -{ - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } -} - -foreach($DB->query($SQL['select1'], PDO_FETCH_CLASS, 'Test') as $data) -{ - var_dump($data); -} - -$stmt = $DB->query($SQL['select1'], PDO_FETCH_CLASS, 'Test', array('WOW')); - -foreach($stmt as $data) -{ - var_dump($data); -} - -?> diff --git a/ext/pdo/tests/pdo_014.inc b/ext/pdo/tests/pdo_014.inc deleted file mode 100755 index fe4e435e4e..0000000000 --- a/ext/pdo/tests/pdo_014.inc +++ /dev/null @@ -1,61 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'Group1\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'B\', \'Group2\')'); -set_sql('select1', 'SELECT val, grp FROM test'); - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); - -class Test -{ - function __construct($name = 'N/A') - { - echo __METHOD__ . "($name)\n"; - } -} - -$stmt = $DB->query($SQL['select1'], PDO_FETCH_CLASS, 'Test', array('WOW')); - -$it = new IteratorIterator($stmt); /* check if we can convert that thing */ - -/*** HINT: If YOU plan to do so remember not to call rewind() -> see below ***/ - -foreach($it as $data) -{ - var_dump($data); -} - -$it->next(); /* must be allowed */ -var_dump($it->current()); /* must return NULL */ -var_dump($it->valid()); /* must return false */ - -class PDOStatementAggregate extends PDOStatement implements IteratorAggregate -{ - private function __construct() - { - echo __METHOD__ . "\n"; - $this->setFetchMode(PDO_FETCH_NUM); - /* default fetch mode is BOTH, so we see if the ctor can overwrite that */ - } - - function getIterator() - { - echo __METHOD__ . "\n"; - $this->execute(); - return new IteratorIterator($this, 'PDOStatement'); - } -} - -$stmt = $DB->prepare($SQL['select1'], array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate'))); - -foreach($stmt as $data) -{ - var_dump($data); -} - -?> diff --git a/ext/pdo/tests/pdo_015.inc b/ext/pdo/tests/pdo_015.inc deleted file mode 100755 index cbcfb587dc..0000000000 --- a/ext/pdo/tests/pdo_015.inc +++ /dev/null @@ -1,25 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(20))'); -set_sql('insert1', 'INSERT INTO test VALUES(1, \'A\', \'A2\')'); -set_sql('insert2', 'INSERT INTO test VALUES(2, \'A\', \'B2\')'); -set_sql('select1', 'SELECT id, val, val2 FROM test'); -set_sql('select2', 'SELECT val, val2 FROM test'); - - -$DB->exec($SQL['create1']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); - -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN, 2)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_GROUP)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 0)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 1)); -var_dump($DB->query($SQL['select1'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 2)); -var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_GROUP)); - -?> diff --git a/ext/pdo/tests/pdo_016.inc b/ext/pdo/tests/pdo_016.inc deleted file mode 100755 index 09d43d93d9..0000000000 --- a/ext/pdo/tests/pdo_016.inc +++ /dev/null @@ -1,82 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -set_sql('insert1', 'INSERT INTO test VALUES(0, \'String0\')'); -set_sql('insert2', 'INSERT INTO test VALUES(1, \'String1\')'); -set_sql('insert3', 'INSERT INTO test VALUES(2, \'String2\')'); -set_sql('select1', 'SELECT COUNT(*) FROM test'); -set_sql('select2', 'SELECT idx, txt FROM test ORDER by idx'); -set_sql('select3', 'SELECT txt FROM test WHERE idx=:inp'); -set_sql('select4', 'SELECT idx FROM test WHERE txt=:txt'); - -echo "===INIT===\n"; - -$DB->exec($SQL['create1']); -var_dump($DB->exec($SQL['insert1'])); -var_dump($DB->exec($SQL['insert2'])); -var_dump($DB->exec($SQL['insert3'])); -var_dump($DB->query($SQL['select1'])->fetchColumn()); - -$cont = $DB->query($SQL['select2'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE); -var_dump($cont); - -echo "===WHILE===\n"; - -$stmt2 = $DB->prepare($SQL['select2']); -$stmt2->bindColumn('idx', $idx); -$stmt2->bindColumn('txt', $txt); -$stmt2->execute(); - -while($stmt2->fetch(PDO_FETCH_BOUND)) { - var_dump(array($idx=>$txt)); -} - -echo "===ALONE===\n"; - -$stmt3 = $DB->prepare($SQL['select3']); -$stmt3->bindParam(':inp', $idx); /* by foreign name */ -$stmt3->bindColumn('txt', $col1); - -$stmt4 = $DB->prepare($SQL['select4']); -$stmt4->bindParam(':txt', $txt); /* using same name */ -$stmt4->bindColumn('idx', $col2); - -foreach($cont as $idx => $txt) -{ - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - var_dump($stmt3->fetch(PDO_FETCH_BOUND)); - var_dump($stmt4->execute()); - var_dump($stmt4->fetch(PDO_FETCH_BOUND)); - var_dump(array($col2=>$col1)); -} - -echo "===REBIND/SAME===\n"; - -$stmt4->bindColumn('idx', $col1); - -foreach($cont as $idx => $txt) -{ - var_dump(array($idx=>$txt)); - var_dump($stmt3->execute()); - var_dump($stmt3->fetch(PDO_FETCH_BOUND)); - var_dump($col1); - var_dump($stmt4->execute()); - var_dump($stmt4->fetch(PDO_FETCH_BOUND)); - var_dump($col1); -} - -echo "===REBIND/CONFLICT===\n"; - -$stmt2->bindColumn('idx', $col1); -$stmt2->bindColumn('txt', $col1); -$stmt2->execute(); - -while($stmt2->fetch(PDO_FETCH_BOUND)) -{ - var_dump($col1); -} - -?> diff --git a/ext/pdo/tests/pdo_017.inc b/ext/pdo/tests/pdo_017.inc deleted file mode 100755 index 7a2fe4739e..0000000000 --- a/ext/pdo/tests/pdo_017.inc +++ /dev/null @@ -1,32 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', "INSERT INTO test VALUES(1, 'A')"); -set_sql('insert2', "INSERT INTO test VALUES(2, 'B')"); -set_sql('insert3', "INSERT INTO test VALUES(3, 'C')"); -set_sql('select', 'SELECT COUNT(*) FROM test'); -set_sql('delete', 'DELETE FROM test'); - -function countRows($DB, $action) { - global $SQL; - $stmt = $DB->query($SQL['select']); - $res = $stmt->fetchColumn(); - return "Counted $res rows after $action.\n"; -} - -$DB->exec($SQL['create']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -echo countRows($DB, 'insert'); - -$DB->beginTransaction(); -$DB->exec($SQL['delete']); -echo countRows($DB, 'delete'); -$DB->rollBack(); - -echo countRows($DB, 'rollback'); -?> diff --git a/ext/pdo/tests/pdo_018.inc b/ext/pdo/tests/pdo_018.inc deleted file mode 100755 index 03bc1eb0ec..0000000000 --- a/ext/pdo/tests/pdo_018.inc +++ /dev/null @@ -1,149 +0,0 @@ -<?php # vim:ft=php - -class TestBase implements Serializable -{ - public $BasePub = 'Public'; - protected $BasePro = 'Protected'; - private $BasePri = 'Private'; - - function serialize() - { - $serialized = array(); - foreach($this as $prop => $val) { - $serialized[$prop] = $val; - } - $serialized = serialize($serialized); - echo __METHOD__ . "() = '$serialized'\n"; - return $serialized; - } - - function unserialize($serialized) - { - echo __METHOD__ . '[' . __LINE__ . ']' . "($serialized)\n"; - foreach(unserialize($serialized) as $prop => $val) { - $this->$prop = '#'.$val; - } - return true; - } -} - -class TestDerived extends TestBase -{ - public $BasePub = 'DerivedPublic'; - protected $BasePro = 'DerivdeProtected'; - public $DerivedPub = 'Public'; - protected $DerivedPro = 'Protected'; - private $DerivedPri = 'Private'; - - function serialize() - { - echo __METHOD__ . "()\n"; - return TestBase::serialize(); - } - - function unserialize($serialized) - { - echo __METHOD__ . "()\n"; - return TestBase::unserialize($serialized); - } -} - -class TestLeaf extends TestDerived -{ -} - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE classtypes(id int NOT NULL PRIMARY KEY, name VARCHAR(20) UNIQUE)'); -set_sql('insert1', 'INSERT INTO classtypes VALUES(0, \'stdClass\')'); -set_sql('insert2', 'INSERT INTO classtypes VALUES(1, \'TestBase\')'); -set_sql('insert3', 'INSERT INTO classtypes VALUES(2, \'TestDerived\')'); -set_sql('selectC', 'SELECT COUNT(*) FROM classtypes'); -set_sql('select0', 'SELECT id, name FROM classtypes ORDER by id'); -set_sql('create2', 'CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int, val VARCHAR(255))'); -set_sql('insert4', 'INSERT INTO test VALUES(:id, :classtype, :val)'); -set_sql('select1', 'SELECT id FROM classtypes WHERE name=:cname'); -set_sql('select2', 'SELECT test.val FROM test'); -set_sql('select3', 'SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id'); -set_sql('select4', 'SELECT COUNT(*) FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)'); -set_sql('select5', 'SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)'); - -$DB->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION); - -echo "===INIT===\n"; -$DB->exec($SQL['create1']); -var_dump($DB->exec($SQL['insert1'])); -var_dump($DB->exec($SQL['insert2'])); -var_dump($DB->exec($SQL['insert3'])); -$DB->exec($SQL['create2']); -var_dump($DB->query($SQL['selectC'])->fetchColumn()); -var_dump($DB->query($SQL['select0'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE)); - -$objs = array(); -$objs[0] = new stdClass; -$objs[1] = new TestBase; -$objs[2] = new TestDerived; -$objs[3] = new TestLeaf; - -$stmt = $DB->prepare($SQL['select1']); -$stmt->bindParam(':cname', $cname); -$stmt->bindColumn('id', $ctype); - -$ctypes = array(); - -foreach($objs as $obj) -{ - $cname = get_class($obj); - $ctype = NULL; /* set default for non stored class name */ - $stmt->execute(); - $stmt->fetch(PDO_FETCH_BOUND); - $ctypes[$cname] = $ctype; -} - -echo "===TYPES===\n"; -var_dump($ctypes); - -echo "===INSERT===\n"; -$stmt = $DB->prepare($SQL['insert4']); -$stmt->bindParam(':id', $idx); -$stmt->bindParam(':classtype', $ctype); -$stmt->bindParam(':val', $val); - -foreach($objs as $idx => $obj) -{ - $ctype = $ctypes[get_class($obj)]; - if (method_exists($obj, 'serialize')) - { - $val = $obj->serialize(); - } - else - { - $val = NULL; - } - $stmt->execute(); -} - -echo "===DATA===\n"; -var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_COLUMN)); - -echo "===FAILURE===\n"; -try -{ - $DB->query($SQL['select3'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf', array()); -} -catch (PDOException $e) -{ - echo 'Exception:'; - echo $e->getMessage()."\n"; -} - -echo "===COUNT===\n"; -var_dump($DB->query($SQL['select4'])->fetchColumn()); - -echo "===DATABASE===\n"; -var_dump($DB->query($SQL['select5'])->fetchAll(PDO_FETCH_ASSOC)); - -echo "===FETCHCLASS===\n"; -var_dump($DB->query($SQL['select5'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf')); - -?> diff --git a/ext/pdo/tests/pdo_019.inc b/ext/pdo/tests/pdo_019.inc deleted file mode 100755 index f9c81a251f..0000000000 --- a/ext/pdo/tests/pdo_019.inc +++ /dev/null @@ -1,36 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); -set_sql('insert1', 'INSERT INTO test VALUES(0, \'String0\')'); -set_sql('insert2', 'INSERT INTO test VALUES(1, \'String1\')'); -set_sql('insert3', 'INSERT INTO test VALUES(2, \'String2\')'); -set_sql('insert4', 'INSERT INTO test VALUES(3, \'String3\')'); -set_sql('select1', 'SELECT COUNT(*) FROM test'); -set_sql('select2', 'SELECT idx, txt FROM test ORDER by idx'); - -echo "===INIT===\n"; - -$DB->exec($SQL['create1']); -var_dump($DB->exec($SQL['insert1'])); -var_dump($DB->exec($SQL['insert2'])); -var_dump($DB->exec($SQL['insert3'])); -var_dump($DB->exec($SQL['insert4'])); -var_dump($DB->query($SQL['select1'])->fetchColumn()); - -$cont = $DB->query($SQL['select2'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE); -var_dump($cont); - -echo "===WHILE===\n"; - -$stmt2 = $DB->prepare($SQL['select2']); -$stmt2->bindColumn('idx', $idx); -$stmt2->bindColumn('txt', $txt); -$stmt2->execute(); - -while($stmt2->fetch(PDO_FETCH_BOUND)) { - var_dump(array($idx=>$txt)); -} - -?> diff --git a/ext/pdo/tests/pdo_020.inc b/ext/pdo/tests/pdo_020.inc deleted file mode 100755 index b04eba26d8..0000000000 --- a/ext/pdo/tests/pdo_020.inc +++ /dev/null @@ -1,28 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -set_sql('insert1', "INSERT INTO test VALUES(1, 'A', 'A')"); -set_sql('insert2', "INSERT INTO test VALUES(2, 'B', 'B')"); -set_sql('insert3', "INSERT INTO test VALUES(3, 'C', 'C')"); -set_sql('select1', 'SELECT id, val FROM test'); -set_sql('select2', 'SELECT id, val, val2 FROM test'); -set_sql('select3', 'SELECT COUNT(*) FROM test'); - -function countColumns($DB, $action) { - global $SQL; - $stmt = $DB->query($SQL[$action]); - $res = $stmt->columnCount(); - return "Counted $res columns after $action.\n"; -} - -$DB->exec($SQL['create1']); -$DB->exec($SQL['insert1']); -$DB->exec($SQL['insert2']); -$DB->exec($SQL['insert3']); - -echo countColumns($DB, 'select1'); -echo countColumns($DB, 'select2'); -echo countColumns($DB, 'select3'); -?> diff --git a/ext/pdo/tests/pdo_021.inc b/ext/pdo/tests/pdo_021.inc deleted file mode 100755 index a566087f9d..0000000000 --- a/ext/pdo/tests/pdo_021.inc +++ /dev/null @@ -1,42 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -set_sql('insert1', "INSERT INTO test VALUES(?, ?, ?)"); -set_sql('insert2', "INSERT INTO test VALUES(:first, :second, :third)"); -set_sql('select', 'SELECT COUNT(*) FROM test'); - -$data = array( - array('10', 'Abc', 'zxy'), - array('20', 'Def', 'wvu'), - array('30', 'Ghi', 'tsr'), - array('40', 'Jkl', 'qpo'), - array('50', 'Mno', 'nml'), - array('60', 'Pqr', 'kji'), -); - -$DB->exec($SQL['create1']); - -// Insert using question mark placeholders -$stmt = $DB->prepare($SQL['insert1']); -foreach ($data as $row) { - $stmt->execute($row); -} - -$select = $DB->query($SQL['select']); -$num = $select->fetchColumn(); -echo 'There are ' . $num . " rows in the table.\n"; - -// Insert using named parameters -$stmt2 = $DB->prepare($SQL['insert2']); -foreach ($data as $row) { - $stmt2->execute(array(':first'=>($row[0] + 5), ':second'=>$row[1], - ':third'=>$row[2])); -} - -$select = $DB->query($SQL['select']); -$num = $select->fetchColumn(); -echo 'There are ' . $num . " rows in the table.\n"; - -?> diff --git a/ext/pdo/tests/pdo_022.inc b/ext/pdo/tests/pdo_022.inc deleted file mode 100755 index 6cf662e7a7..0000000000 --- a/ext/pdo/tests/pdo_022.inc +++ /dev/null @@ -1,41 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -set_sql('insert1', "INSERT INTO test VALUES(?, ?, ?)"); -set_sql('insert2', "INSERT INTO test VALUES(:first, :second, :third)"); -set_sql('select1', 'SELECT id, val, val2 FROM test'); -set_sql('select2', 'SELECT COUNT(*) FROM test'); - -$data = array( - array('10', 'Abc', 'zxy'), - array('20', 'Def', 'wvu'), - array('30', 'Ghi', 'tsr'), - array('40', 'Jkl', 'qpo'), - array('50', 'Mno', 'nml'), - array('60', 'Pqr', 'kji'), -); - -$DB->exec($SQL['create1']); - -// Insert using question mark placeholders -$stmt = $DB->prepare($SQL['insert1']); -foreach ($data as $row) { - $stmt->execute($row); -} - -// Retrieve column metadata for a result set returned by explicit SELECT -$select = $DB->query($SQL['select1']); -$meta = $select->getColumnMeta(0); -var_dump($meta); -$meta = $select->getColumnMeta(1); -var_dump($meta); -$meta = $select->getColumnMeta(2); -var_dump($meta); - -// Retrieve column metadata for a result set returned by a function -$select = $DB->query($SQL['select2']); -$meta = $select->getColumnMeta(0); -var_dump($meta); -?> diff --git a/ext/pdo/tests/pdo_023.inc b/ext/pdo/tests/pdo_023.inc deleted file mode 100755 index d42ccc7438..0000000000 --- a/ext/pdo/tests/pdo_023.inc +++ /dev/null @@ -1,26 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'); -set_sql('insert1', 'INSERT INTO test VALUES(0, \'A\')'); -set_sql('insert2', 'INSERT INTO test VALUES(1, \'B\')'); -set_sql('select1', 'SELECT val, id FROM test'); - -$DB->test(); - -var_dump($DB); - -$DB->query($SQL['create1']); -$DB->query($SQL['insert1']); -$DB->query($SQL['insert2']); - -$stmt = $DB->query($SQL['select1']); - -var_dump($stmt); -var_dump($stmt->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE)); - -$stmt = NULL; -$DB = NULL; - -?> diff --git a/ext/pdo/tests/pdo_023_def.inc b/ext/pdo/tests/pdo_023_def.inc deleted file mode 100755 index 1fb1980995..0000000000 --- a/ext/pdo/tests/pdo_023_def.inc +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -class PDOStatementX extends PDOStatement -{ - public $test1 = 1; - - protected function __construct() - { - $this->test2 = 2; - $this->test2 = 22; - echo __METHOD__ . "()\n"; - } - - function __destruct() - { - echo __METHOD__ . "()\n"; - } -} - -class PDODatabaseX extends PDO -{ - public $test1 = 1; - - function __destruct() - { - echo __METHOD__ . "()\n"; - } - - function test() - { - $this->test2 = 2; - var_dump($this->test1); - var_dump($this->test2); - $this->test2 = 22; - } - - function query($sql) - { - echo __METHOD__ . "()\n"; - $stmt = parent::prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementx'))); - $stmt->execute(); - return $stmt; - } -} - -?> diff --git a/ext/pdo/tests/pdo_024.inc b/ext/pdo/tests/pdo_024.inc deleted file mode 100755 index a3fe3a4969..0000000000 --- a/ext/pdo/tests/pdo_024.inc +++ /dev/null @@ -1,21 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create', 'create table test (id int, name varchar(10))'); -set_sql('insert', 'insert into test (id, name) values(0, :name)'); -set_sql('select', 'select name from test where id=0'); - -$DB->query($SQL['create']); -$stmt = $DB->prepare($SQL['insert']); -$name = NULL; -$before_bind = $name; -$stmt->bindParam(':name', $name); -if ($name !== $before_bind) { - echo "bind: fail\n"; -} else { - echo "bind: success\n"; -} -var_dump($stmt->execute()); -var_dump($DB->query($SQL['select'])->fetchColumn()); -?> diff --git a/ext/pdo/tests/pdo_025.inc b/ext/pdo/tests/pdo_025.inc deleted file mode 100755 index 16b861975e..0000000000 --- a/ext/pdo/tests/pdo_025.inc +++ /dev/null @@ -1,51 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -set_sql('insert1', "INSERT INTO test VALUES(?, ?, ?)"); -set_sql('select', 'SELECT * FROM test'); - -$data = array( - array('10', 'Abc', 'zxy'), - array('20', 'Def', 'wvu'), - array('30', 'Ghi', 'tsr'), - array('40', 'Jkl', 'qpo'), - array('50', 'Mno', 'nml'), - array('60', 'Pqr', 'kji'), -); - -$DB->exec($SQL['create1']); - -// Insert using question mark placeholders -$stmt = $DB->prepare($SQL['insert1']); -foreach ($data as $row) { - $stmt->execute($row); -} - -class Test { - public $id, $val, $val2; -} - -$stmt = $DB->prepare($SQL['select']); -$stmt->setFetchMode(PDO_FETCH_INTO, new Test); -$stmt->execute(); - -foreach($stmt as $obj) { - var_dump($obj); -} - -echo "===FAIL===\n"; - -class Fail { - protected $id; - public $val, $val2; -} - -$stmt->setFetchMode(PDO_FETCH_INTO, new Fail); -$stmt->execute(); - -foreach($stmt as $obj) { - var_dump($obj); -} -?> diff --git a/ext/pdo/tests/pdo_026.inc b/ext/pdo/tests/pdo_026.inc deleted file mode 100755 index 3886f7ec5a..0000000000 --- a/ext/pdo/tests/pdo_026.inc +++ /dev/null @@ -1,69 +0,0 @@ -<?php # vim:ft=php - -require_once('pdo.inc'); - -set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); -set_sql('insert1', "INSERT INTO test VALUES(?, ?, ?)"); -set_sql('select', 'SELECT * FROM test'); - -$data = array( - array('10', 'Abc', 'zxy'), - array('20', 'Def', 'wvu'), - array('30', 'Ghi', 'tsr'), -); - -class PDOStatementX extends PDOStatement -{ - public $dbh; - - protected function __construct($dbh) - { - $this->dbh = $dbh; - echo __METHOD__ . "()\n"; - } - - function __destruct() - { - echo __METHOD__ . "()\n"; - } -} - -class PDODatabase extends PDO -{ - function __destruct() - { - echo __METHOD__ . "()\n"; - } - - function query($sql) - { - echo __METHOD__ . "()\n"; - $stmt = $this->prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this)))); - $stmt->setFetchMode(PDO_FETCH_ASSOC); - $stmt->execute(); - return $stmt; - } -} - -$DB = new PDODatabase($CONNECTION, isset($USER) ? $USER : NULL, isset($PASSWD) ? $PASSWD : NULL); -var_dump(get_class($DB)); - -$DB->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_WARNING); - -$DB->exec($SQL['create1']); - -$stmt = $DB->prepare($SQL['insert1']); -var_dump(get_class($stmt)); -foreach ($data as $row) { - $stmt->execute($row); -} - -$stmt = $DB->query($SQL['select']); -var_dump(get_class($stmt)); -var_dump(get_class($stmt->dbh)); - -foreach($stmt as $obj) { - var_dump($obj); -} - -?> |