mirror of
https://github.com/php/php-src.git
synced 2026-04-30 03:33:17 +02:00
- Add new tests
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<?php # vim:ft=php
|
||||
|
||||
require_once('pdo.inc');
|
||||
|
||||
set_sql('create1', 'CREATE TABLE test(idx int 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'])->fetchSingle());
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
?>
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
PDO_MySQL: fetch() and while()
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_019.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "4"
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===WHILE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===DONE===
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
PDO_PGSQL: fetch() and while()
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_019.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "4"
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===WHILE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===DONE===
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
PDO_SQLite: fetch() and while()
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
require_once('skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once('connection.inc');
|
||||
require_once('prepare.inc');
|
||||
|
||||
require_once($PDO_TESTS . 'pdo_019.inc');
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
===INIT===
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
string(1) "4"
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===WHILE===
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(7) "String0"
|
||||
}
|
||||
array(1) {
|
||||
[1]=>
|
||||
string(7) "String1"
|
||||
}
|
||||
array(1) {
|
||||
[2]=>
|
||||
string(7) "String2"
|
||||
}
|
||||
array(1) {
|
||||
[3]=>
|
||||
string(7) "String3"
|
||||
}
|
||||
===DONE===
|
||||
Reference in New Issue
Block a user