Christian Fraß
minor changes; move to koralle-build-system
Christian Fraß commited 2809be5 at 2016-08-09 01:17:44
<?php
function sql_cross($table_left, $table_right)
{
$table_result = [];
array_map
(
function ($row_left) use (&$table_left,&$table_right,&$table_result)
{
array_map
(
function ($row_right) use (&$table_left,&$table_right,&$table_result,&$row_left)
{
$row_result = [];
foreach ($row_left as $key_left => $value_left) $row_result[$key_left] = $value_left;
foreach ($row_right as $key_right => $value_right) $row_result[$key_right] = $value_right;
array_push($table_result, $row_result);
},
$table_right
);
},
$table_left
);
return $table_result;
}
function sql_cross_all($tables_source)
{
$n = count($tables_source);
if ($n == 1)
{
return $tables_source[0];
}
else
{
return sql_cross(sql_cross_all(array_slice($tables_source, $n-1)), $tables_source[$n-1]);
}
}
function sql_project($table_source, $columns)
{
return (
array_map
(
function ($row_in) use (&$columns)
{
$row_out = [];
foreach ($row_in as $key_in => $value_in)
{
if (array_search($key_in, $columns) !== false)
{
$row_out[$key_in] = $value_in;
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX