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