1--TEST--
2PDO::ATTR_CLIENT_VERSION
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8MySQLPDOTest::skip();
9$db = MySQLPDOTest::factory();
10?>
11--FILE--
12<?php
13    require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
14    $db = MySQLPDOTest::factory();
15
16    assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
17
18    $version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
19
20    // No more constraints - mysqlnd and libmysql return different strings at least
21    // with mysqli. Return type check is already performed in the generic test.
22    // According to the manual we should get an int but as of today we do get a string...
23    if ('' == $version)
24        printf("[001] Client version must not be empty\n");
25
26
27    // Read-only
28    if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0'))
29        printf("[002] Wonderful, I can change the client version!\n");
30
31    $new_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
32    if ($new_version !== $version)
33        printf("[003] Did we change it from '%s' to '%s'?\n", $version, $new_version);
34
35    print "done!";
36?>
37--EXPECT--
38done!
39