diff options
Diffstat (limited to 'kohana/libraries/Database.php')
-rw-r--r-- | kohana/libraries/Database.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kohana/libraries/Database.php b/kohana/libraries/Database.php index ca4f6512..fd1ae3fa 100644 --- a/kohana/libraries/Database.php +++ b/kohana/libraries/Database.php @@ -621,6 +621,12 @@ class Database_Core { if ($val != '') { + // Add the table prefix if we are using table.column names + if(strpos($val, '.')) + { + $val = $this->config['table_prefix'].$val; + } + $this->groupby[] = $this->driver->escape_column($val); } } @@ -674,11 +680,18 @@ class Database_Core { { $direction = strtoupper(trim($direction)); + // Add a direction if the provided one isn't valid if ( ! in_array($direction, array('ASC', 'DESC', 'RAND()', 'RANDOM()', 'NULL'))) { $direction = 'ASC'; } + // Add the table prefix if a table.column was passed + if (strpos($column, '.')) + { + $column = $this->config['table_prefix'].$column; + } + $this->orderby[] = $this->driver->escape_column($column).' '.$direction; } |