Merge the columns of two data tables.
Manipulates the first table.

@param DataTable|DataTable\Map $table1 The table to eventually filter.
@param DataTable|DataTable\Map $table2 Whether to delete rows with no visits or not.
543033
public function mergeDataTables($table1, $table2)
    {
        // handle table arrays
        if ($table1 instanceof DataTable\Map && $table2 instanceof DataTable\Map) {
            $subTables2 = $table2->getDataTables();
            foreach ($table1->getDataTables() as $index => $subTable1) {
                if (!array_key_exists($index, $subTables2)) {
                    // occurs when archiving starts on dayN and continues into dayN+1, see https://github.com/piwik/piwik/issues/5168#issuecomment-50959925
                    continue;
                }
                $subTable2 = $subTables2[$index];
                $this->mergeDataTables($subTable1, $subTable2);
            }
            return;
        }

        $firstRow2 = $table2->getFirstRow();
        if (!($firstRow2 instanceof Row)) {
            return;
        }

        $firstRow1 = $table1->getFirstRow();
        if (empty($firstRow1)) {
            $firstRow1 = $table1->addRow(new Row());
        }

        foreach ($firstRow2->getColumns() as $metric => $value) {
            $firstRow1->setColumn($metric, $value);
        }
    }
1101103
public static function merge(array $source1, array $source2): array
    {
        $return = $source2;

        foreach ($source1 as $key => $value) {
            if ($value && is_array($value) && isset($source2[$key]) && is_array($source2[$key])) {
                $value = array_replace_recursive($source2[$key], $value);
            }
            $return[$key] = $value;
        }

        return $return;
    }
497643
public function compareTableSchema(string $tableName1, string $tableName2): bool
    {
        $schema1 = $this->getTableSchemaId($tableName1);
        $schema2 = $this->getTableSchemaId($tableName2);

        return $schema1 === $schema2;
    }
1216932
public function leftJoinRaw($table, $column1, $operator, $raw)
	{
		return $this->joinRaw($table, $column1, $operator, $raw, 'LEFT OUTER');
	}
473951
protected function getKeys($table,$table2=null) {
		$pdo = $this->adapter->getDatabase()->getPDO();
		$keys = $pdo->cubrid_schema(PDO::CUBRID_SCH_EXPORTED_KEYS,$table);//print_r($keys);
		if ($table2) $keys = array_merge($keys, $pdo->cubrid_schema(PDO::CUBRID_SCH_IMPORTED_KEYS,$table2) );//print_r($keys);
		
		return $keys;
	}
500482
public function merge(array $rows, $column, $alias, $table, $link)
    {
        foreach ($rows as &$row) {
            if (isset($row[$column])) {
                $value = $row[$column];

                $set = $this->querySlaveTable($table, $link, $value);
                $set = $this->getPreparedSet($set, $link);

                $row[$alias] = $set;
                unset($row[$column]);
            }
        }

        return $rows;
    }
784350
public function merge($pk, array $rows, $alias, $slaveTable, $slaveColumnId)
    {
        foreach ($rows as &$row) {
            // Extra check
            if (isset($row[$pk])) {
                $value = $row[$pk];

                // Prepare slave set
                $slaveSet = $this->querySlaveTable($slaveTable, $slaveColumnId, $value);
                $slaveSet = $this->getResultSetWithoutSlaveColumnId($slaveSet, $slaveColumnId);

                $row[$alias] = $slaveSet;
            }
        }

        return $rows;
    }
28520
public static function merge_data($a, $b)
    {
        $args = func_get_args();
        $t = $args[0];
        $array = is_array($t);

        foreach ($args as $k => $a) {
            $args[$k] = self::ar($a);
        }

        $args = call_user_func_array('array_merge', $args);
        
        if (!$array) {
            $args = self::sc($args);
        }
        
        return $args;
    }
940473
private function mergeColumns(): void
  {
    foreach ($this->oldColumns as $table_name => $table)
    {
      foreach ($table as $column_name => $column)
      {
        if (isset($this->columns[$table_name][$column_name]))
        {
          $this->columns[$table_name][$column_name]['constant_name'] = $column['constant_name'];
        }
      }
    }
  }
692192
public function rawColumns(array $columns, $merge = false)
    {
        if ($merge) {
            $config = $this->config->get('datatables.columns');

            $this->columnDef['raw'] = array_merge($config['raw'], $columns);
        } else {
            $this->columnDef['raw'] = $columns;
        }

        return $this;
    }
655506
public function mergeCellRange($startRow, $startColumn, $endRow, $endColumn)
    {
        list($startRow, $startColumn, $endRow, $endColumn)
                = PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);

        if ($startRow == $endRow && $startColumn == $endColumn) {
            return;
        }

        if (!$this->checkIfCellExists($endRow, $endColumn)) {
            return;
        }

        for ($j = $startRow; $j <= $endRow; $j++) {
            $start = $startColumn;
            $cell = $this->getCell($j, $start);

            while ($cell->isHorizontalMerged()) {
                $start--;
                $cell = $this->getCell($j, $start);
            }

            $end = $endColumn;

            $cell = $this->getCell($j, $end);
            while ($cell->isHorizontalMerged()) {
                $end++;
                $cell = $this->getCell($j, $end + 1);
            }

            $width = 0;

            for ($i = $start; $i <= $end; $i++) {
                $cell = $this->getCell($j, $i);
                if ($j == $startRow) {
                    $cell->setVerticalMergeStart();
                }
                else {
                    $cell->setVerticalMerged();
                }

                $width += $cell->getWidth();
                if ($i != $start) {
                    $cell->setHorizontalMerged();
                }
            }

            $this->getCell($j, $start)->setWidth($width);
        }
    }
878286
public function crossJoin( $table, $first = null, $operator = null, $second = null )
	{
		if ( $first )
		{
			return $this->join( $table, $first, $operator, $second, 'cross' );
		}

		$this->joins[] = new JoinClause( 'cross', $table );

		return $this;
	}
549623
private function mergeMetadata(EntityMetadata &$metadata = null, EntityMetadata $toAdd)
    {
        if (null === $metadata) {
            $metadata = clone $toAdd;
        } else {
            $metadata->merge($toAdd);
        }
    }
848890
protected function createTable(Table $table): void
	{
		$table->addPrimaryKey('id')
			->int()
			->setAutoIncrement();
		$table->addForeignKey('pageId', PagesMapper::class);
		$table->addColumn('name')
			->varChar();
		$table->addColumn('position')
			->int(3);
	}
1163474
public static function merge($array1, $array2)
	{
		$result = [];
		for ($i = 0; $i < func_num_args(); $i++) {
			$result = parent::merge($result, static::asArray(func_get_arg($i)));
		}

		return $result;
	}
986834
public function table($table, bool $mapped = false)
    {
        return $mapped ?
            new TableQueryMapped($this, $this->definition($table)) :
            new TableQuery($this, $this->definition($table));
    }
1062515
public function addChange($table, $method, $data)
    {
        $table = $this->getRawTableName($table);

        if (!isset($this->changes[$table])) {
            $this->changes[$table] = [];
        }

        $this->changes[$table][] = new TableChange([
            'schema' => TableStructure::identifySchema(get_class($this->db->schema)),
            'table' => $table,
            'method' => $method,
            'data' => $data,
        ]);
    }