package io.github.codemumbler;

public class OracleScriptWriter {

	private static final String SCHEMA_CREATION = "--CREATE USER %1$s IDENTIFIED BY password2Change;\n" +
			"-- GRANT CONNECT, RESOURCE, CREATE SESSION, CREATE TABLE, CREATE VIEW,\n" +
			"-- \tCREATE PROCEDURE,CREATE SYNONYM, CREATE SEQUENCE, CREATE TRIGGER TO %1$s;\n";
	private final Database database;

	public OracleScriptWriter(Database database) {
		this.database = database;
	}

	public String writeScript() {
		StringBuilder script = new StringBuilder();
		script.append(String.format(SCHEMA_CREATION, database.getSchemaName()));
		return script.toString();
	}
}

@@ -627,11 +627,435 @@
 ng();%0A%09%7D
+%0A%0A%09public String writeOneTable(Table table) %7B%0A%09%09StringBuilder tableCreateScript = new StringBuilder(%22CREATE TABLE %22);%0A%09%09tableCreateScript.append(table.getName()).append(%22 (%5Cn%22);%0A%09%09for ( Column column : table.getColumns() ) %7B%0A%09%09%09tableCreateScript.append(%22%5Ct%22).append(column.getName()).append(%22 NUMBER(%22).append(column.getLength()).append(%22)%5Cn%22);%0A%09%09%7D%0A%09%09tableCreateScript.append(%22);%22);%0A%09%09return tableCreateScript.toString();%0A%09%7D
 %0A%7D%0A

write the SQL script for one simple table