Sunday, December 20, 2015

SQLite3 Drivers?

I finally figured out the cause of the mysterious PHP problem that has stopped me dead in my tracks.

My problem is that the command PDOStatment::fetch(PDO::FETCH_NUM) is returning a string instead of an array.

Apparently, this is what happened:

The SQL standard (which was established before PHP was a twinkle in Lerdorf's eye) return strings that the receiving program must parse.

The RDMS companies that courted PHP in the early days wrote drivers that presented the data in a more efficient manner.

Big companies, like Microsoft and Oracle, are always happy to provide drivers as the drivers create a dependency on their products.

SQLite is an open source, "zero configuration", standards based program which is designed to be embedded in other applications. The term "zero configuration" means that SQLite does not design drivers. I want to emphasize the term "embedded." SQLite hands you their code and you actually embed it in your program; so there is no driver.

Anyway, the problem I am experiencing today appears to be a repeat of a bug reported experienced in 2008.

If you read the report, the PHP programmers say that this problem is the fault of the drivers between PHP and the database. (The drivers take the standards based output and put it in a form more to the liking of PHP).

SQLite is standards based and embedded. SQLite has no drivers. In the SQLite paradigm, SQLite presents source code to the world. Companies like PHP can compile it into their program ... the catch is that it is the responsibility of the company embedding SQLite to make the driver work.

This error is actually quite humorous. This grand PHP PDO object (which is supposed to be the crown jewel of the new PHP) can't handle standards based output.

PDO has a dependency injection. The PDO object is dependent on the external driver written by large firms like Oracle and Microsoft.

I know that it will be auto rejected, but, I am seriously considering writing up a bug report on this issue, but I think I will try a twitter poll first.

No comments: