diff options
author | blowdoof <blowdoof@gmail.com> | 2013-10-18 16:46:09 +0200 |
---|---|---|
committer | blowdoof <blowdoof@gmail.com> | 2013-10-18 16:46:09 +0200 |
commit | 2cfbfc54dc68d9e7ed7c20af4cf7693736bbd447 (patch) | |
tree | db99f761e9192e5ebba161b78e03b52b9a690f1f /system/database/DB_active_rec.php | |
parent | 18d6090a7ead8c93d2513e3b034cd1a994ed3c2f (diff) |
Bugfix on the active record join statement with empty conditions
Diffstat (limited to 'system/database/DB_active_rec.php')
-rw-r--r-- | system/database/DB_active_rec.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 129eaa7b6..5bf0d8f1d 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -336,8 +336,12 @@ class CI_DB_active_record extends CI_DB_driver { $cond = $match[1].$match[2].$match[3]; } - // Assemble the JOIN statement - $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond; + // Assemble the JOIN statement: only use ON if a condition was passed + $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE); + if ($cond) + { + $join .= ' ON '.$cond; + } $this->ar_join[] = $join; if ($this->ar_caching === TRUE) |