Brion Vibber wrote:
On Mar 28, 2004, at 14:06, Evan Prodromou wrote:
Why not use an existing database abstraction layer, like ADOdb?
I believe what Magnus is suggesting is abstracting the *queries*, not the database's API
Yup.
, which we already do.
<snip>
my preference would be to consider SQL to be our query abstraction layer already, and just try harder than we do now to have well-factored code that keeps queries contained in the classes that deal with that particular type of data.
Putting all the queries into a single PHP class would have some advantages, though. Just think of all the special pages; should we really carry MySQL, Postgres and who-knows-what in every special page class?
Universal SQL would be a fine thing, but isn't the point of trying another database to get more performance? That probably means to code using the advantages of a specific database, while keeping clear of the database-specific "problem zones".
Also, two database could be compared much better if we could just throw a switch ( $db=new WikiMySQL; / $db=new WikiPostGres; ).
Even now we do:
$id = $title->getArticleId();
and keep the SQL for it tucked away in the Title object (or actually in LinkCache).
So, the method in Title is basically a wrapper for the method in LinkCache. Why can't the latter (basically) be a wrapper for the method in the database-specific class?
Magnus