Requests for comment/SQL framework

Summary
Wikia has ported a simple fluent SQL framework from Java to PHP and merged it with our codebase as a vendor library. We are starting to use this for extensions which make heavy use of database queries in order to simplify development, debugging and add some nice features to the database API (caching of results, and potentially different centralized logging/profiling back ends). The source code is visible on Github: Wikia/fluent-sql-php

Proposal
We propose adding this sort of query interface to the existing mediawiki database library. The current database API uses positional arguments and while it works for simple queries, when you get to the point of wanting to build a complex query, the various approaches to building arrays of arrays of key/value pairs differs a lot from one developer to another and it is much more difficult to see what a query is doing without executing it and capturing debug output. Since we are dealing with SQL in the end anyway, the most natural API for the database interface is something that resembles SQL.