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