package cc.topicexplorer.plugin.wiki.preprocessing.tables.categorytree;

import java.sql.SQLException;

import cc.topicexplorer.chain.commands.TableCreateCommand;

public class CategoryTreeCreate extends TableCreateCommand {

	@Override
	public void createTable() {
		try {
			database.executeUpdateQuery("create table `" + this.tableName + "` (" + "CAT$CHILD VARCHAR(255) NOT NULL, "
					+ "CAT$PARENT VARCHAR (255) not null ) " + "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
		} catch (SQLException e) {
			logger.error("Table " + this.tableName + " could not be created.");
			throw new RuntimeException(e);
		}
	}

	@Override
	public void setTableName() {
		tableName = "CATEGORYTREE";
	}

}

@@ -254,24 +254,423 @@
 ateTable() %7B
+%0A%0A%09%09// drop table%0A%09%09try %7B%0A%09%09%09this.database.executeUpdateQuery(%22drop table %22 + this.tableName + %22;%22);%0A%09%09%7D catch (SQLException e) %7B%0A%09%09%09if (e.getErrorCode() != 1051) %7B // MySQL Error code for 'Can't%0A%09%09%09%09// DROP%0A%09%09%09%09// ..; check that table exists%0A%09%09%09%09logger.error(%22wiki-plug-in.%22 + this.tableName + %22: Cannot drop table %22 + this.tableName);%0A%09%09%09%09throw new RuntimeException(e);%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09// create table
 %0A%09%09try %7B%0A%09%09%09

drop table incl exception eingefügt