Skip to content

Commit

Permalink
Update to get rid of Travis errors
Browse files Browse the repository at this point in the history
  • Loading branch information
williamsandy committed Sep 5, 2016
1 parent ad636a1 commit a65b135
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions libraries/joomla/database/query/sqlsrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,21 +383,23 @@ public function group($columns)

// Get the _formatted_ FROM string and remove everything except `table AS alias`
$fromStr = str_replace(array("[", "]"), "", str_replace("#__", $this->db->getPrefix(), str_replace("FROM ", "", (string) $this->from)));

// Remove any trailing whitespaces
$fromStr = trim($fromStr);

// Start setting up an array of alias => table
$table = $alias = $fromStr;
if (strpos($fromStr,' AS ') !== false)
if (strpos($fromStr, ' AS ') !== false)
{
list($table, $alias) = preg_split("/\sAS\s/i", $fromStr);
list($table, $alias) = preg_split("/\sAS\s/i", $fromStr);
}
elseif (preg_match("/\b\s+/i",$fromStr))
elseif (preg_match("/\b\s+/i", $fromStr))
{
list($table, $alias) = preg_split("/\b\s+/i", $fromStr);
list($table, $alias) = preg_split("/\b\s+/i", $fromStr);
}
else
{
$table = $alias = $fromStr;
$table = $alias = $fromStr;
}
$tmpCols = $this->db->getTableColumns(trim($table));
$cols = array();
Expand All @@ -415,9 +417,9 @@ public function group($columns)
foreach ($this->join as $join)
{

$joinStr = trim(preg_replace("/.*\sJOIN\s/i","" ,(string)$join));
$joinStr = trim(preg_replace("/.*\sJOIN\s/i","", (string) $join));

if (strpos($joinStr,' AS ') !== false)
if (strpos($joinStr, ' AS ') !== false)
{
$joinTbl = str_replace("#__", $this->db->getPrefix(), str_replace("]", "", preg_replace("/^(.+?\sAS\s[^\s]*).*/i", "$1", $joinStr)));

Expand Down

0 comments on commit a65b135

Please sign in to comment.