I would say that minimising the number of places in which we need to specifically lay out different queries for each database is going to be a very good idea. For instance, using DB::manipulate() or something to abstract away the SQL-syntax for performing an update might be useful. You may find that you need to improve the expressive power of DB::manipulate(), or create other, similar, functions to be implemented in the Database sub-class, but that would be better than peppering these "switched queries" throughout the system.
Have you thought about using a map of db-classname => query value to specify the different queries? This would make it easier to add new database types in the future.
DB::switched_query(array(
"MySQLDatabase" => "UPDATE tablea INNER JOIN tableb ON tablea.ID = tableb.ID SET tablea.Age = tableb.Size WHERE tablea.ID = 3",
"PostgresDatabase => "UPDATE tablea SET Age = tableb.Size FROM tableb WHERE tablea.ID = 3 AND tableb.ID = tablea.ID",
"MSSQLDatabase" => "UPDATE tablea SET tablea.Age = tableb.Size FROM tablea INNER JOIN tableb ON
tablea.ID = tableb.ID WHERE tablea.ID = 3",
));
Alternatively, we could use some kind of "tags" system, where a database connection object could be given a number of tags. For example, the MS SQL database could be tagged with both "compliant" and "mssql".
In this example, a MS SQL database would use $array['mssql'];
DB::switched_query(array(
"mysql" => "UPDATE tablea INNER JOIN tableb ON tablea.ID = tableb.ID SET tablea.Age = tableb.Size WHERE tablea.ID = 3",
"mssql" => "UPDATE tablea SET tablea.Age = tableb.Size FROM tablea INNER JOIN tableb ON
tablea.ID = tableb.ID WHERE tablea.ID = 3",
"compliant => "UPDATE tablea SET Age = tableb.Size FROM tableb WHERE tablea.ID = 3 AND tableb.ID = tablea.ID",
));
But in this example, the same database would use $array['compliant']
DB::switched_query(array(
"mysql" => "UPDATE tablea INNER JOIN tableb ON tablea.ID = tableb.ID SET tablea.Age = tableb.Size WHERE tablea.ID = 3",
"compliant => "UPDATE tablea SET Age = tableb.Size FROM tableb WHERE tablea.ID = 3 AND tableb.ID = tablea.ID",
));
This "tags" system makes it easier to define a "standards compliant SQL" format that we can assume new databases that are introduced would use, unless we specifically needed to re-engineer the query for that database server.
That said, rather than making a fully-generic tags system, it might be better performance just to fail over to a "default" or "compliant" option if one for the specific database wasn't found.