Hi,
On Wed, Oct 26, 2011 at 00:31, Dmitriy Sintsov questpc@rambler.ru wrote:
I am not native English speaker, sorry.
That's fine but maybe helpful to know so I can be extra careful that I don't confuse you. As a last resort I think there are some Russian speakers on this list that may be able to help.
However, in that bugreport there is second (different) query converted from MySQL string to Database::select() with arrays. It has INNER JOIN. The source query works fine, the converted one fails because table aliases are 'quoted'. Should I do not use table aliases at all?
Aliases should be fine. (at least per the docs I found and reedy's example)
[i'm guessing] The problem is that the code assumes that a lone string is a table name for just 1 table and that any other semantics (multiple tables or tables with aliases) will be encoded in data structures rather than need to be parsed out of strings.
Anyway, could you just try this code and tell us what happens?
function getIntervalResults( $offset, $limit ) { $result = array(); $db = wfGetDB( DB_SLAVE ); $res = $db->select( array( 'qup' => 'qp_users_polls', 'qu' => 'qp_users' ), array( 'qu.uid as uid', 'name as username', 'count(pid) as pidcount' ), 'qu.uid=qup.uid', __METHOD__, array( 'GROUP BY' => 'qup.uid', 'ORDER BY' => $this->order_by, 'OFFSET' => $offset, 'LIMIT' => $limit ) ); foreach( $res as $row ) { $result[] = $row; } return $result; }
Thanks, Jeremy