package hiro.yoshioka.ast.sql.oracle;

import hiro.yoshioka.ast.sql.AbsSQLParser;
import hiro.yoshioka.ast.sql.IDDL;
import hiro.yoshioka.ast.sql.util.ASTEditorTableListHolder;
import hiro.yoshioka.sql.resource.IDBTable;

import java.util.List;

public abstract class ASTDefaultDDL extends SimpleNode implements IDDL {
	public ASTEditorTableListHolder fTableHolder;

	public ASTDefaultDDL(int id) {
		super(id);
	}

	public ASTDefaultDDL(AbsSQLParser p, int id) {
		super(p, id);
	}

	public boolean beginTransaction() {

		return false;
	}

	public boolean isDML() {
		return false;
	}

	/**
	 * @return
	 */
	public String infomatin() {
		return null;
	}

	public boolean isDDL() {
		return true;
	}

	public boolean isDOL() {
		return false;
	}

	private void test() {
		if (fTableHolder == null) {
			fTableHolder = new ASTEditorTableListHolder();
		}
	}

	@Override
	public void addTable(IDBTable table) {
		test();
		fTableHolder.addTable(table);
	}

	@Override
	public void addTableList(List list) {
		test();
		fTableHolder.addTableList(list);
	}

	@Override
	public boolean emptyTableList() {
		return fTableHolder == null || fTableHolder.size() == 0;
	}

	@Override
	public ASTEditorTableListHolder getEditorTableListHolder() {
		return fTableHolder;
	}

}
