// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/SqlExecuteCompileableChildNode.java
// public abstract class SqlExecuteCompileableChildNode extends SqlCompileableChildNode
//     implements SqlExecuteCompileable {
// 
//   public SqlExecuteCompileableChildNode(SqlNode previous) {
//     super(previous);
//   }
// 
//   @Override public void execute(SQLiteDatabase database) throws SQLException {
//     database.execSQL(asCompileableStatement().sql);
//   }
// }
// 
// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/SqlNode.java
// public interface SqlNode {
// 
//   /**
//    * This method will be called to build the sql string recursively
//    *
//    * @param builder string builder
//    */
//   void buildSql(StringBuilder builder);
// 
//   /**
//    * Get the sql string for this {@link SqlNode}.
//    * <p>
//    * <b>This method will be called from {@link #buildSql(StringBuilder)}. So
//    * don't call this directly.</b>
//    * </p>
//    *
//    * @return A sql string representing this node
//    */
//   String getSql();
// 
//   /**
//    * Get the previous {@link SqlChildNode}. This mehtod will be called to
//    * build the sql string recursivly. <b>Do not call it directly</b>
//    *
//    * @return the previous node
//    */
//   SqlNode getPrevious();
// 
//   /**
//    * Get the set of tables (table names) that might be queried or changed during executing the sql
//    * statement
//    *
//    * @return A set of string with the table names this sql statement affects
//    */
//   Set<String> getAffectedTables();
// }
// 
// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/select/SqlCompileableSelectChildNode.java
// public interface SqlCompileableSelectChildNode extends SqlCompileable {
// 
// }


import com.hannesdorfmann.sqlbrite.dao.sql.SqlExecuteCompileableChildNode;
import com.hannesdorfmann.sqlbrite.dao.sql.SqlNode;
import com.hannesdorfmann.sqlbrite.dao.sql.select.SqlCompileableSelectChildNode;
import java.util.HashSet;
import java.util.Set;
package com.hannesdorfmann.sqlbrite.dao.sql.view;


/**
 * This one is used in combination with {@link CREATE_VIEW} or
 * {@link CREATE_VIEW_IF_NOT_EXISTS}
 *
 * @author Hannes Dorfmann
 */
public class AS extends SqlExecuteCompileableChildNode {

  private final SqlCompileableSelectChildNode selectChild;

  public AS(SqlNode previous, SqlCompileableSelectChildNode selectChild) {
    super(previous);
    this.selectChild = selectChild;
  }

  @Override public String getSql() {
    return " AS ";
  }

  @Override public CompileableStatement asCompileableStatement() {
    CompileableStatement superCompileableStatement = super.asCompileableStatement();
    CompileableStatement selectChildCompileableStatement = selectChild.asCompileableStatement();

    Set<String> affectedTabels = new HashSet<>();
    if (superCompileableStatement.tables != null) {
      affectedTabels.addAll(superCompileableStatement.tables);
    }

    if (selectChildCompileableStatement.tables != null) {
      affectedTabels.addAll(selectChildCompileableStatement.tables);
    }

// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/SqlExecuteCompileableChildNode.java
// public abstract class SqlExecuteCompileableChildNode extends SqlCompileableChildNode
//     implements SqlExecuteCompileable {
// 
//   public SqlExecuteCompileableChildNode(SqlNode previous) {
//     super(previous);
//   }
// 
//   @Override public void execute(SQLiteDatabase database) throws SQLException {
//     database.execSQL(asCompileableStatement().sql);
//   }
// }
// 
// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/SqlNode.java
// public interface SqlNode {
// 
//   /**
//    * This method will be called to build the sql string recursively
//    *
//    * @param builder string builder
//    */
//   void buildSql(StringBuilder builder);
// 
//   /**
//    * Get the sql string for this {@link SqlNode}.
//    * <p>
//    * <b>This method will be called from {@link #buildSql(StringBuilder)}. So
//    * don't call this directly.</b>
//    * </p>
//    *
//    * @return A sql string representing this node
//    */
//   String getSql();
// 
//   /**
//    * Get the previous {@link SqlChildNode}. This mehtod will be called to
//    * build the sql string recursivly. <b>Do not call it directly</b>
//    *
//    * @return the previous node
//    */
//   SqlNode getPrevious();
// 
//   /**
//    * Get the set of tables (table names) that might be queried or changed during executing the sql
//    * statement
//    *
//    * @return A set of string with the table names this sql statement affects
//    */
//   Set<String> getAffectedTables();
// }
// 
// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/select/SqlCompileableSelectChildNode.java
// public interface SqlCompileableSelectChildNode extends SqlCompileable {
// 
// }


// Path: dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/sql/view/AS.java
import com.hannesdorfmann.sqlbrite.dao.sql.SqlExecuteCompileableChildNode;
import com.hannesdorfmann.sqlbrite.dao.sql.SqlNode;
import com.hannesdorfmann.sqlbrite.dao.sql.select.SqlCompileableSelectChildNode;
import java.util.HashSet;
import java.util.Set;

package com.hannesdorfmann.sqlbrite.dao.sql.view;


/**
 * This one is used in combination with {@link CREATE_VIEW} or
 * {@link CREATE_VIEW_IF_NOT_EXISTS}
 *
 * @author Hannes Dorfmann
 */
public class AS extends SqlExecuteCompileableChildNode {

  private final SqlCompileableSelectChildNode selectChild;

  public AS(SqlNode previous, SqlCompileableSelectChildNode selectChild) {
    super(previous);
    this.selectChild = selectChild;
  }

  @Override public String getSql() {
    return " AS ";
  }

  @Override public CompileableStatement asCompileableStatement() {
    CompileableStatement superCompileableStatement = super.asCompileableStatement();
    CompileableStatement selectChildCompileableStatement = selectChild.asCompileableStatement();

    Set<String> affectedTabels = new HashSet<>();
    if (superCompileableStatement.tables != null) {
      affectedTabels.addAll(superCompileableStatement.tables);
    }

    if (selectChildCompileableStatement.tables != null) {
      affectedTabels.addAll(selectChildCompileableStatement.tables);
    }

    return new CompileableStatement(