On 26.10.2011 7:16, Jeremy Baron wrote:
Hi,
On Tue, Oct 25, 2011 at 22:55, Dmitriy Sintsovquestpc@rambler.ru wrote:
Hi! Speaking of non-MySQL databases: recently I decided to try converting manually crafted SQL strings (mostly MySQL selects) to DBMS-independent Database::select() calls with arrays. However I've stumbled with serious problems with table aliases. I am not a DBMS guru, so there might be my fault, of course, however it would be nice if someone could answer to my bugreport there: https://bugzilla.wikimedia.org/show_bug.cgi?id=31534 Dmitriy
Did you test the code offered in comment 1 on that bug?
I assume
array( 'qp_users_polls', 'qu' => 'qp_users' ),
should instead be
array( 'qup' => 'qp_users_polls', 'qu' => 'qp_users' ),
(from comment 1)
Seems cleaner and saner than yours, why not give it a try? (although yours is also cleaner and saner than the original way you found it! (that you quoted))
How would Sam's code guess alias for qp_users_polls ? I thought he just forgot to put the alias key 'qup' there, writing in hurry, probably.
'qu.uid=qup.uid' probably should fail in his code.
Dmitriy