1--TEST--
2PDO_mysql connect through PDO::connect
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12
13require_once __DIR__ . '/inc/mysql_pdo_test.inc';
14
15$db = Pdo::connect(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS);
16if (!$db instanceof Pdo\Mysql) {
17    echo "Wrong class type. Should be Pdo\Mysql but is " . get_class($db) . "\n";
18}
19
20$db->exec('CREATE TABLE pdomysql_002(id INT NOT NULL PRIMARY KEY, name VARCHAR(10))');
21$db->exec("INSERT INTO pdomysql_002 VALUES(1, 'A'), (2, 'B'), (3, 'C')");
22
23foreach ($db->query('SELECT name FROM pdomysql_002') as $row) {
24    var_dump($row);
25}
26
27echo "Fin.";
28?>
29--CLEAN--
30<?php
31require_once __DIR__ . '/inc/mysql_pdo_test.inc';
32$db = MySQLPDOTest::factory();
33$db->query('DROP TABLE pdomysql_002');
34?>
35--EXPECT--
36array(2) {
37  ["name"]=>
38  string(1) "A"
39  [0]=>
40  string(1) "A"
41}
42array(2) {
43  ["name"]=>
44  string(1) "B"
45  [0]=>
46  string(1) "B"
47}
48array(2) {
49  ["name"]=>
50  string(1) "C"
51  [0]=>
52  string(1) "C"
53}
54Fin.
55