Unimpressed by the ongoing PDO 2 debate, we have continued working on PDO/mysqlnd for MySQL. It turned out that the current status of PDO makes developing and testing a new driver a challenge. I spent quite a lot of time comparing the different behaviours of the various drivers in the hope I could find out how PDO drivers are supposed to work. The PDO documentation and the specification do not cover each and every detail. PDO really needs some love…
Why do people suggest to improve PDO before kicking-off a PDO 2 project?
The challenge of the day was to find out what PDO::FETCH_UNIQUE is about. All what the first page of the PDO manual tells you is, that is is a predefined (class) constant of the type INT. But luckily, there is more to learn about it on the manual page of PDOStatement->fetchAll():
[…]
array fetchAll ([ int $fetch_style [, int $column_index [, array $ctor_args ]]] )
[…]
To fetch only the unique values of a single column from the result set, bitwise-OR PDO::FETCH_COLUMN with PDO::FETCH_UNIQUE.
[…]
That’s one sentence. And according to Google this is pretty much it what you can find about it on php.net. Hold on, there are some test which give usage examples. However, you never know if a test covers all aspects of a feature. What about the comment-files (ext/pdo/pdo_stmt.c, …) you ask? Well, that’s no good documentation for the end user and you never know if the implementation is wrong as long as there is no description of what the code shall accomplish. Its a valid approach in software development to refine a feature as you go. But in the end you need one document which describes how things are supposed to work. And that document is not the .c file – in particular not, if you want third-parties to contribute.

