summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-08-29 15:38:24 +0200
committerAndrey Andreev <narf@devilix.net>2017-08-29 15:38:24 +0200
commit6ffc8f63c8a9a76c5323a4013382a61eb4d7031a (patch)
treee73690ec1b4c2f86c358f0d43c558f1c8ec9a2b8
parent66b6717e6b3ec2cd9ced7040cd330d7add19dcb6 (diff)
Optimize the join() type regexp and remove the extra leading space when no special join-type is used
-rw-r--r--system/database/DB_query_builder.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index d35d84d6d..3ff94be8e 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -525,8 +525,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function join($table, $cond, $type = '', $escape = NULL)
{
- $type = strtoupper(trim($type));
- preg_match('#^(NATURAL(?=\s|$)\s*)?((LEFT|RIGHT)(?=\s|$))?\s*(INNER|OUTER)?$#', $type) OR $type = '';
+ $type = trim(strtoupper($type).' JOIN');
+ preg_match('#^(NATURAL\s+)?((LEFT|RIGHT)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
// Extract any aliases that might exist. We use this information
// in the protect_identifiers to know whether to add a table prefix
@@ -587,7 +587,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
// Assemble the JOIN statement
- $this->qb_join[] = $join = $type.' JOIN '.$table.$cond;
+ $this->qb_join[] = $join = $type.' '.$table.$cond;
if ($this->qb_caching === TRUE)
{