1--TEST--
2PDO::ATTR_CLIENT_VERSION
3--SKIPIF--
4<?php
5require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
6require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7MySQLPDOTest::skip();
8$db = MySQLPDOTest::factory();
9?>
10--FILE--
11<?php
12    require_once(__DIR__ . DIRECTORY_SEPARATOR . '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