forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpdoodbc_002.phpt
54 lines (50 loc) · 1.11 KB
/
pdoodbc_002.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--TEST--
PDO_mysql connect through PDO::connect
--EXTENSIONS--
pdo_odbc
--SKIPIF--
<?php
require 'ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require 'ext/pdo/tests/pdo_test.inc';
$config = PDOTest::get_config(__DIR__ . "/common.phpt");
$db = Pdo\Odbc::connect($config['ENV']['PDOTEST_DSN'], $config['ENV']['PDOTEST_USER'], $config['ENV']['PDOTEST_PASS']);
if (!$db instanceof Pdo\Odbc) {
echo "Wrong class type. Should be Pdo\Odbc but is " . get_class($db) . "\n";
}
$db->exec('CREATE TABLE pdoodbc_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))');
$db->exec("INSERT INTO pdoodbc_002 VALUES(1, 'A'), (2, 'B'), (3, 'C')");
foreach ($db->query('SELECT name FROM pdoodbc_002') as $row) {
var_dump($row);
}
echo "Fin.";
?>
--CLEAN--
<?php
require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->exec("DROP TABLE IF EXISTS pdoodbc_002");
?>
--EXPECT--
array(2) {
["name"]=>
string(1) "A"
[0]=>
string(1) "A"
}
array(2) {
["name"]=>
string(1) "B"
[0]=>
string(1) "B"
}
array(2) {
["name"]=>
string(1) "C"
[0]=>
string(1) "C"
}
Fin.