Show
Ignore:
Timestamp:
01/02/2008 11:53:40 AM (12 months ago)
Author:
zombor
Message:

Fix for #299. Table names can be aliased in query builder methods now.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/drivers/Database_Mysql.php

    r1642 r1663  
    102102        public function escape_table($table) 
    103103        { 
     104                if (stripos($table, ' AS ') !== FALSE) 
     105                { 
     106                        // Force 'AS' to uppercase 
     107                        $table = str_ireplace(' AS ', ' AS ', $table); 
     108 
     109                        // Runs escape_table on both sides of an AS statement 
     110                        $table = array_map(array($this, __FUNCTION__), explode(' AS ', $table)); 
     111 
     112                        // Re-create the AS statement 
     113                        return implode(' AS ', $table); 
     114                } 
    104115                return '`'.str_replace('.', '`.`', $table).'`'; 
    105116        }