Driver_Database_Driver_MySQL::_compile_join_on
null Driver_Database_Driver_MySQL::_compile_join_on( )
File: ./drivers/database/mysql/mysql.class.php
protected function _compile_join_on($join)
{
if ($join['type'])
{
$sql = strtoupper($join['type']) . ' JOIN';
}
else
{
$sql = 'JOIN';
}
// Quote the table name that is being joined
$sql .= ' ' . $this->quote_table($join['table'],true) . ' ON ';
$conditions = array();
foreach ($join['on'] as $condition)
{
// Split the condition
list ($c1, $op, $c2) = $condition;
if ($op)
{
// Make the operator uppercase and spaced
$op = ' ' . strtoupper($op);
}
// Quote each of the identifiers used for the condition
$conditions[] = $this->_quote_identifier($c1) . $op . ' ' . $this->_quote_identifier($c2);
}
// Concat the conditions "... AND ..."
$sql .= '(' . implode(' AND ', $conditions) . ')';
return $sql;
}