function recreateIndexesForTable( Table $table, $purpose ) {
	echo "Dropping indices from table " . $table->getIdentifier() . ".\n";
	dropAllIndicesFromTable( $table->getIdentifier() );

	echo "Creating new indices for table " . $table->getIdentifier() . ".\n";
	addIndexesForTable( $table, $purpose );
}
function getTransactedSQL( QueryTransactionInformation $transactionInformation, array $selectFields, Table $table, array $restrictions, array $orderBy = array(), $count = - 1, $offset = 0 ) {
	$tableNames = array( $table->getIdentifier() );

	if ( $table->isVersioned ) {
		$restrictions[] = $transactionInformation->getRestriction( $table );
		$tableNames = array_merge( $tableNames, $transactionInformation->getTables() );
		$orderBy = array_merge( $orderBy, $transactionInformation->versioningOrderBy() );
		$groupBy = $transactionInformation->versioningGroupBy( $table );
		$selectFields = array_merge( $selectFields, $transactionInformation->versioningFields( $table->getIdentifier() ) );
	}
	else {
		$groupBy = array();
	}
	
	$query =
		"SELECT " . implode( ", ", $selectFields ) .
		" FROM " . implode( ", ", $tableNames );

	if ( count( $restrictions ) > 0 ) {
		$query .= " WHERE " . implode( ' AND ', $restrictions );
	}
	if ( count( $groupBy ) > 0 ) {
		$query .= " GROUP BY " . implode( ', ', $groupBy );
	}
	if ( count( $orderBy ) > 0 ) {
		$query .= " ORDER BY " . implode( ', ', $orderBy );
	}
	if ( $count != - 1 ) {
		$query .= " LIMIT " . $offset . ", " . $count;
	}
	return $query;
}
	protected function add( Table $table ) {
		$this->allTables[] = $table;
		$this->tableLookupMap[$table->getIdentifier()] = $table;
		return $table;
	}
	public function getRestriction( Table $table ) {
		return
			" " . $table->getIdentifier() . ".add_transaction_id =" . $this->transactionId .
			" OR " . $table->getIdentifier() . ".removeTransactionId =" . $this->transactionId;
	}