core mysql

master
vitalif 2010-07-30 06:17:02 +00:00
parent 4daa602797
commit dda2cea9fd
1 changed files with 25 additions and 4 deletions

View File

@ -267,16 +267,37 @@ function mysql_tables_builder($tables)
global $cfgTables;
if (is_array($tables))
{
$t = array();
$t = '';
foreach ($tables as $k => $v)
{
if (!is_numeric($k))
$v = ($cfgTables[$v] ? '`'.$cfgTables[$v].'`' : $v) . ' ' . $k;
{
if (is_array($v))
{
$join = substr(strtolower($v[0]), 0, 4);
if ($join == 'righ')
$join = 'RIGHT';
elseif ($join == 'left')
$join = 'LEFT';
else /* if (!$join || $join == 'inne' || $join == 'join') */
$join = 'INNER';
$table = ($cfgTables[$v[1]] ? '`'.$cfgTables[$v[1]].'`' : $v[1]);
if ($t)
$t .= " $join JOIN $table $k ON ".mysql_where_builder($v[2]);
else
$t = "$table $k";
}
else
$v = ($cfgTables[$v] ? '`'.$cfgTables[$v].'`' : $v) . ' ' . $k;
}
else
$v = ($cfgTables[$v] ? '`'.$cfgTables[$v].'` '.$v : $v);
$t[] = $v;
if ($t)
$t .= " INNER JOIN $v";
else
$t = $v;
}
$tables = join(',', $t);
$tables = $t;
}
else
$tables = preg_replace_callback('/((?:,|JOIN)\s*`)([^`]+)/s', 'mysql_tables_builder_pregcb1', $tables);