1--TEST--
2PDO_MYSQL: Defining a connection charset in the DSN
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12    require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
13
14    /* Connect to mysql to determine the current charset so we can diffinate it */
15    $link 		= MySQLPDOTest::factory();
16    $charset 	= $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
17
18    /* Make sure that we don't attempt to set the current character set to make this case useful */
19    $new_charset	= ($charset == 'latin1' ? 'ascii' : 'latin1');
20
21    /* Done with the original connection, create a second link to test the character set being defined */
22    unset($link);
23
24    $link 		= MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
25    $conn_charset 	= $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
26
27    if ($charset !== $conn_charset) {
28        echo "done!\n";
29    } else {
30        echo "failed!\n";
31    }
32?>
33--EXPECT--
34done!
35