Sunday, October 24, 2010

php-5.3.3 sqlite behaviour

In this post I like to point out to you Bug #340059. It's about using sqlite3 without getting sqlite2 forced on you by portage.

The problem here was that to enable pdo-sqlite, the sqlite driver for PHP Data Objects, you had to enable USE="sqlite". This was fine when there was only one sqlite USE flag. But with both sqlite and sqlite3 selectable, it became an odd choice. PHP Data Objects only fully support sqlite3 in the first place!

So I changed that today and made PDO support for sqlite dependent on USE="sqlite3". The update should now be on a mirror near you. By the virtue of eblits, it is available for all php-5.3 versions we currently have. Simply remerge php (USE="-sqlite sqlite3" emerge -v php) to see the effect - an emerge --depclean should now unmerge sqlite-2* if PHP was the last application requiring it.

And while Dessa kindly pointed out to me Bug #249418, which states that USE="sqlite" should enable either sqlite2 or sqlite3 support and prefer sqlite3 (thus obsoleting the sqlite3 USE flag), I'm still in favor of the current solution.

For one, PHP upstream still enables both sqlite2 and sqlite3 by default. And if you install a Gentoo php without any changes, you'll get sqlite2 and sqlite3, too, because we follow upstreams defaults.

But heads up: future versions of PHP-5.3 will throw E_DEPRECATED notices if you continue to use sqlite2 via sqlite_open() as per this post. Support for it will be gone in future minor versions (whether they will be named 5.4 or 6...)

2 comments:

  1. What about pdo use flag? What does it provide?

    ReplyDelete
  2. wouldn't it be smarter to keep the flags unchanged for newer versions and change for older versions as in continuing to use sqlite for the latest version of sqlite and using sqlite2 for the "expired" one

    ReplyDelete