@@ -29,6 +29,7 @@ public class CreateView implements Statement {
2929 private boolean materialized = false ;
3030 private ForceOption force = ForceOption .NONE ;
3131 private TemporaryOption temp = TemporaryOption .NONE ;
32+ private AutoRefreshOption autoRefresh = AutoRefreshOption .NONE ;
3233 private boolean withReadOnly = false ;
3334 private boolean ifNotExists = false ;
3435
@@ -96,6 +97,14 @@ public void setTemporary(TemporaryOption temp) {
9697 this .temp = temp ;
9798 }
9899
100+ public AutoRefreshOption getAutoRefresh () {
101+ return autoRefresh ;
102+ }
103+
104+ public void setAutoRefresh (AutoRefreshOption autoRefresh ) {
105+ this .autoRefresh = autoRefresh ;
106+ }
107+
99108 public boolean isWithReadOnly () {
100109 return withReadOnly ;
101110 }
@@ -118,16 +127,7 @@ public String toString() {
118127 if (isOrReplace ()) {
119128 sql .append ("OR REPLACE " );
120129 }
121- switch (force ) {
122- case FORCE :
123- sql .append ("FORCE " );
124- break ;
125- case NO_FORCE :
126- sql .append ("NO FORCE " );
127- break ;
128- default :
129- // nothing
130- }
130+ appendForceOptionIfApplicable (sql );
131131
132132 if (temp != TemporaryOption .NONE ) {
133133 sql .append (temp .name ()).append (" " );
@@ -141,6 +141,9 @@ public String toString() {
141141 if (ifNotExists ) {
142142 sql .append (" IF NOT EXISTS" );
143143 }
144+ if (autoRefresh != AutoRefreshOption .NONE ) {
145+ sql .append (" AUTO REFRESH " ).append (autoRefresh .name ());
146+ }
144147 if (columnNames != null ) {
145148 sql .append (PlainSelect .getStringList (columnNames , true , true ));
146149 }
@@ -151,6 +154,19 @@ public String toString() {
151154 return sql .toString ();
152155 }
153156
157+ private void appendForceOptionIfApplicable (StringBuilder sql ) {
158+ switch (force ) {
159+ case FORCE :
160+ sql .append ("FORCE " );
161+ break ;
162+ case NO_FORCE :
163+ sql .append ("NO FORCE " );
164+ break ;
165+ default :
166+ // nothing
167+ }
168+ }
169+
154170 public CreateView withView (Table view ) {
155171 this .setView (view );
156172 return this ;
0 commit comments