Categories
Posts

PDO Oddness

There are some parts of PDO that I find strange.

First up, why is the default fetch mode for the fetch function PDO::FETCH_BOTH? Returning twice as much data seems like a waste.

Second, but related to the first, why can’t you change the default fetch mode using PDO::setAttribute? It’s fine to be able to override the default when calling fetch, but being able to set a more reasonable default seems like an obvious feature.

And finally, why doesn’t the PDO DSN include the username and password? The format for the DSN is a bit different too. Instead of using the URL style, used by many others like the PEAR::DB DSN, they came up with something else entirely.