Bug Report #2455
IS instead of = on where, JOIN with aliases
| Status: | New | Start date: | 12/22/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | Libraries:Database | |||
| Target version: | 2.4.1 | |||
| Resolution: | Points: |
Description
Two issues here.
Issue 1 where() has '=' as default operator. That's kinda pointless if you're WHEREing a null value.
db->where('mail_read') is so much shorter than db->where('mail_read', 'IS', null) or even db->where('mail_read', 'IS').
Mysql, at least, doesn't see = NULL the same as IS NULL.
Issue 2 is table aliases on joins. You can alias column names but not tables. This is fixed. Use the same syntax.
join(array(AStable => originalTable), etc...)
Here's some code where I actually needed table aliases...
$this->dbb->select(array('m_from_name' => 'users_from.u_name'));
$this->dbb->select(array('m_to_name' => 'users_to.u_name'));
$this->dbb->join(array('users_from' => 'users'), 'm_from', 'users_from.u_id');
$this->dbb->join(array('users_to' => 'users'), 'm_to', 'users_to.u_id');