On Wed, May 7, 2008 at 7:43 PM, DanTMan <dan_the_man(a)telus.net> wrote:
Oh... I forgot one:
5) Have tableName test for words like ON, JOIN, etc... which signal this
is a sql query, not a table.
This is the obvious way. If anyone has a database table called "JOIN"
they're already severe masochists and will probably enjoy being
punished by breakage of database functions. In particular, this would
enable LEFT JOINs to be done using the wrappers, which I'm pretty sure
is impossible right now.
On Wed, May 7, 2008 at 3:23 PM, Roan Kattouw <roan.kattouw(a)home.nl> wrote:
They're far from unneeded. Database::select() is
broken in that it adds
the backticks wrongly, generating invalid SQL [1]. I'll poke dantman to
fix this, but in the meantime we should have a working API.
You know, every other place in the entire code base where we have
inner joins, we just use implicit joins with WHERE. So in other
words, don't use ON at all. Instead of SELECT * FROM page INNER JOIN
revision ON page_id=rev_page WHERE page_id=731, use SELECT * FROM
page, revision WHERE page_id=731 AND page_id=rev_page (don't ever try
either for arbitrary pages, BTW :)). The queries are totally
equivalent. There should be no reason to use any other syntax for
inner joins, although stylistically I do prefer ON clauses.
I can't patch your code, however, since as usual, the API uses its own
syntax for database queries and non-API developers like me have no
idea how it works.