1 24 25 package com.mckoi.database.interpret; 26 27 import com.mckoi.database.ExpressionPreparer; 28 import com.mckoi.database.DatabaseException; 29 import com.mckoi.database.StatementTree; 30 31 37 38 public final class FromTableDef implements java.io.Serializable , Cloneable { 39 40 static final long serialVersionUID = -606852454508224625L; 41 42 49 private boolean subquery_table; 50 51 54 private String unique_key; 55 56 59 private String table_name; 60 61 64 private String table_alias; 65 66 69 private TableSelectExpression subselect_table; 70 71 75 public FromTableDef(String table_name, String table_alias) { 76 this.table_name = table_name; 77 this.table_alias = table_alias; 78 subselect_table = null; 79 subquery_table = false; 80 } 81 82 85 public FromTableDef(String table_name) { 86 this(table_name, null); 87 } 88 89 92 public FromTableDef(TableSelectExpression select, String table_alias) { 93 this.subselect_table = select; 94 this.table_name = table_alias; 95 this.table_alias = table_alias; 96 subquery_table = true; 97 } 98 99 102 public FromTableDef(TableSelectExpression select) { 103 this.subselect_table = select; 104 this.table_name = null; 105 this.table_alias = null; 106 subquery_table = true; 107 } 108 109 110 113 public void setUniqueKey(String unique_key) { 114 this.unique_key = unique_key; 115 } 116 117 120 public String getName() { 121 return table_name; 122 } 123 124 127 public String getAlias() { 128 return table_alias; 129 } 130 131 134 public String getUniqueKey() { 135 return unique_key; 136 } 137 138 141 public boolean isSubQueryTable() { 142 return subquery_table; 143 } 144 145 148 public TableSelectExpression getTableSelectExpression() { 149 return subselect_table; 150 } 151 152 155 public void prepareExpressions(ExpressionPreparer preparer) 156 throws DatabaseException { 157 if (subselect_table != null) { 158 subselect_table.prepareExpressions(preparer); 159 } 160 } 161 162 165 public Object clone() throws CloneNotSupportedException { 166 FromTableDef v = (FromTableDef) super.clone(); 167 if (subselect_table != null) { 168 v.subselect_table = (TableSelectExpression) subselect_table.clone(); 169 } 170 return v; 171 } 172 173 } 174 | Popular Tags |