Removes idsubdatatable_in_db metadata from a DataTable. Used by Social tables since
they use fake subtable IDs.

@param DataTable $dataTable
350700
private function removeSubtableMetadata($dataTable)
    {
        if ($dataTable instanceof DataTable\Map) {
            foreach ($dataTable->getDataTables() as $childTable) {
                $this->removeSubtableMetadata($childTable);
            }
        } else {
            foreach ($dataTable->getRows() as $row) {
                $row->deleteMetadata('idsubdatatable_in_db');
            }
        }
    }
1207991
public synchronized void remove(FieldTable table) throws DBException
    {
        BaseBuffer bufferOld = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
        for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
        {   // Delete the current key.
            KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
            keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);
            this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
        }
        bufferOld.free();   // Get rid of the old one
        table.setDataSource(null);  // same as .doSetHandle(null, Constants.DATA_SOURCE_HANDLE);
    }
197200
public function onDelete(GenericDataEvent $event)
    {
        /** @var Group[] $groups */
        $groups = $event->getData();

        $ids = [];
        foreach ($groups as $group) {
            $ids[] = $group->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(Group::class, $ids);
    }
1038833
static function remove_bindings(\fenrir\system\MysqlDatabaseSignature $db, $table, array $bindings) {
		foreach ($bindings as $key) {
			$db->prepare
				(
					"
						ALTER TABLE `$table`
						 DROP FOREIGN KEY `$key`
					"
				)
				->execute();
		}
	}
619182
public function deleteTablesExceptIgnored($idsToBeIgnored, $firstTableId = 0)
    {
        $lastTableId = $this->getMostRecentTableId();

        for ($index = $firstTableId; $index <= $lastTableId; $index++) {
            if (!in_array($index, $idsToBeIgnored)) {
                $this->deleteTable($index);
            }
        }
    }
1327948
def removeDataset(self, dataset):
        
        for datasetRecord in models.Dataset.select().where(
                        models.Dataset.id == dataset.getId()):
            datasetRecord.delete_instance(recursive=True)
601383
public function dropExistingTable($table)
    {
        echo "    > drop table $table if exists ...";
        $time = microtime(true);
        $this->db->createCommand('DROP TABLE IF EXISTS `' . $table . '`')->execute();
        echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n";
    }
656511
protected function manipulateDataTableMap($dataTable)
    {
        $result = $dataTable->getEmptyClone();
        foreach ($dataTable->getDataTables() as $tableLabel => $childTable) {
            $newTable = $this->manipulate($childTable);
            $result->addTable($newTable, $tableLabel);
        }
        return $result;
    }
725366
public function deleteTable($table)
    {
        if (null !== $this->logger) {
            $this->log('Delete table '.$table);
        }

        $parameters = array(
            'TableName' => $table,
        );

        if (null !== $this->logger) {
            $this->log('DeleteTable request paramaters : '.print_r($parameters, true), Logger::DEBUG);
        }

        $response = $this->connector->deleteTable($parameters);

        if (null !== $this->logger) {
            $this->log('DeleteTable request response : '.print_r($response, true), Logger::DEBUG);
        }
    }
652639
public function unsetDataFor($arrIds)
    {
        if (!\is_array($arrIds)) {
            throw new \RuntimeException(
                'TranslatedTableText::unsetDataFor() invalid parameter given! Array of ids is needed.',
                1
            );
        }

        if (empty($arrIds)) {
            return;
        }

        $this->accessor->removeDataForIds($this->get('id'), $arrIds);
    }
451079
protected function applyGenericFilters($datatable)
    {
        if ($datatable instanceof DataTable\Map) {
            $tables = $datatable->getDataTables();
            foreach ($tables as $table) {
                $this->applyGenericFilters($table);
            }
            return;
        }

        $tableDisabledFilters = $datatable->getMetadata(DataTable::GENERIC_FILTERS_TO_DISABLE_METADATA_NAME) ?: [];
        $genericFilters = $this->getGenericFiltersHavingDefaultValues();

        $filterApplied = false;
        foreach ($genericFilters as $filterMeta) {
            $filterName = $filterMeta[0];
            $filterParams = $filterMeta[1];
            $filterParameters = array();
            $exceptionRaised = false;

            if (in_array($filterName, $this->disabledFilters)
                || in_array($filterName, $tableDisabledFilters)
            ) {
                continue;
            }

            foreach ($filterParams as $name => $info) {
                if (!is_array($info)) {
                    // hard coded value that cannot be changed via API, see eg $naturalSort = true in 'Sort'
                    $filterParameters[] = $info;
                } else {
                    // parameter type to cast to
                    $type = $info[0];

                    // default value if specified, when the parameter doesn't have a value
                    $defaultValue = null;
                    if (isset($info[1])) {
                        $defaultValue = $info[1];
                    }

                    try {
                        $value = Common::getRequestVar($name, $defaultValue, $type, $this->request);
                        settype($value, $type);
                        $filterParameters[] = $value;
                    } catch (Exception $e) {
                        $exceptionRaised = true;
                        break;
                    }
                }
            }

            if (!$exceptionRaised) {
                $datatable->filter($filterName, $filterParameters);
                $filterApplied = true;
            }
        }

        return $filterApplied;
    }
361363
public function clearTable($table)
    {
        $this->query("DELETE FROM \"$table\"");

        // Check if resetting the auto-increment is needed
        $autoIncrement = $this->preparedQuery(
            'SELECT "AUTO_INCREMENT" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
            [ $this->getSelectedDatabase(), $table]
        )->value();

        if ($autoIncrement > 1) {
            $this->query("ALTER TABLE \"$table\" AUTO_INCREMENT = 1");
        }
    }
570382
public function remove($identifier)
    {
        $identifier = $this->normalizeToPath($identifier);
        $this->session->removeItem($identifier);
    }
448917
private function removeColumnsFromEntity()
    {
        $del = $this->getDeletes();

        if ($del) {
            foreach ($del as $id => $meta) {
                $this->dropKeysFromColumnRemoved($id, $meta);

                $sql = new SqlCommand();
                $sql->exeCommand("ALTER TABLE " . PRE . $this->entity . " DROP COLUMN " . $meta['column']);
            }
        }
    }
664549
public function removeEvent(string $name, ?string $table = null): void
    {
        $this->connection->getEventHandler()->removeEvent($name, $table);
    }
891692
public function removeTable($table)
    {
        if ($table instanceof Table)
            $table = $table->getName();
        $this->tables->set('tables', $table, null);
        return $this;
    }
1259666
public function sort(DataTable $table)
    {
        // all that code is in here and not in separate methods for best performance. It does make a difference once
        // php has to copy many (eg 50k) rows otherwise.

        $table->setTableSortedBy($this->config->primaryColumnToSort);

        $rows = $table->getRowsWithoutSummaryRow();

        // we need to sort rows that have a value separately from rows that do not have a value since we always want
        // to append rows that do not have a value at the end.
        $rowsWithValues    = array();
        $rowsWithoutValues = array();

        $valuesToSort = array();
        foreach ($rows as $key => $row) {
            $value = $this->getColumnValue($row);
            if (isset($value)) {
                $valuesToSort[] = $value;
                $rowsWithValues[] = $row;
            } else {
                $rowsWithoutValues[] = $row;
            }
        }

        unset($rows);

        if ($this->config->isSecondaryColumnSortEnabled && $this->config->secondaryColumnToSort) {
            $secondaryValues = array();
            foreach ($rowsWithValues as $key => $row) {
                $secondaryValues[$key] = $row->getColumn($this->config->secondaryColumnToSort);
            }

            array_multisort($valuesToSort, $this->config->primarySortOrder, $this->config->primarySortFlags, $secondaryValues, $this->config->secondarySortOrder, $this->config->secondarySortFlags, $rowsWithValues);

        } else {
            array_multisort($valuesToSort, $this->config->primarySortOrder, $this->config->primarySortFlags, $rowsWithValues);
        }

        if (!empty($rowsWithoutValues) && $this->config->secondaryColumnToSort) {
            $secondaryValues = array();
            foreach ($rowsWithoutValues as $key => $row) {
                $secondaryValues[$key] = $row->getColumn($this->config->secondaryColumnToSort);
            }

            array_multisort($secondaryValues, $this->config->secondarySortOrder, $this->config->secondarySortFlags, $rowsWithoutValues);
        }

        unset($secondaryValues);

        foreach ($rowsWithoutValues as $row) {
            $rowsWithValues[] = $row;
        }

        $table->setRows(array_values($rowsWithValues));
    }