Part of the EllisLab Network

Bug Report

table prefix not added with multi-table and operator

Date: 06/16/2008 Severity: Major
Status: New Reporter: MichaelPlacentra2
Version: 1.6.2
Keywords: Libraries, Database Class

Description

When using the db where() method and specifying an operator, the table prefix is not being applied to the table name. I’m selecting from multiple join()ed tables, so I’m including the table name in where(). I’m having this problem while using the mysqli driver.

I made this hack, in system/database/DB_active_rec.php line 444, to fix it for myself in the meantime:

$k = preg_replace_callback(”/([^\s]+)/”, create_function(’$m’, ’$ci=&get;_instance();return $ci->db->_protect_identifiers($m[0]);’), $k);

Code Sample

...
$this->db->where('events.showtime >=', mktime(0, 0, 0));
...

Expected Result

...WHERE `ci_events`.`showtime` >= 1213599600…

Actual Result

...WHERE events.showtime >= 1213599600…

I also notice that I’m not getting backticks in the entire query. They are not present in the SELECT, ON, or WHERE clauses.

Comment on Bug Report

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?