1 34 package smallsql.database; 35 36 import java.sql.*; 37 38 39 42 class ViewResult extends TableViewResult { 43 44 final private View view; 45 final private Expressions columnExpressions; 46 final private CommandSelect commandSelect; 47 48 49 ViewResult(View view){ 50 this.view = view; 51 this.columnExpressions = view.commandSelect.columnExpressions; 52 this.commandSelect = view.commandSelect; 53 } 54 55 56 61 ViewResult(SSConnection con, CommandSelect commandSelect) throws SQLException{ 62 try{ 63 this.view = new View( con, commandSelect); 64 this.columnExpressions = commandSelect.columnExpressions; 65 this.commandSelect = commandSelect; 66 }catch(Exception e){ 67 throw Utils.createSQLException(e); 68 } 69 } 70 71 72 79 boolean init( SSConnection con ) throws Exception { 80 if(super.init(con)){ 81 commandSelect.compile(con); 82 return true; 83 } 84 return false; 85 } 86 87 88 89 90 95 96 TableView getTableView(){ 97 return view; 98 } 99 100 101 void deleteRow() throws SQLException{ 102 commandSelect.deleteRow(con); 103 } 104 105 void updateRow(Expression[] updateValues) throws Exception { 106 commandSelect.updateRow(con, updateValues); 107 } 108 109 void insertRow(Expression[] updateValues) throws Exception { 110 commandSelect.insertRow(con, updateValues); 111 } 112 113 118 boolean isNull(int colIdx) throws Exception { 119 return columnExpressions.get(colIdx).isNull(); 120 } 121 122 123 boolean getBoolean(int colIdx) throws Exception { 124 return columnExpressions.get(colIdx).getBoolean(); 125 } 126 127 128 int getInt(int colIdx) throws Exception { 129 return columnExpressions.get(colIdx).getInt(); 130 } 131 132 133 long getLong(int colIdx) throws Exception { 134 return columnExpressions.get(colIdx).getLong(); 135 } 136 137 138 float getFloat(int colIdx) throws Exception { 139 return columnExpressions.get(colIdx).getFloat(); 140 } 141 142 143 double getDouble(int colIdx) throws Exception { 144 return columnExpressions.get(colIdx).getDouble(); 145 } 146 147 148 long getMoney(int colIdx) throws Exception { 149 return columnExpressions.get(colIdx).getMoney(); 150 } 151 152 153 MutableNumeric getNumeric(int colIdx) throws Exception { 154 return columnExpressions.get(colIdx).getNumeric(); 155 } 156 157 158 Object getObject(int colIdx) throws Exception { 159 return columnExpressions.get(colIdx).getObject(); 160 } 161 162 163 String getString(int colIdx) throws Exception { 164 return columnExpressions.get(colIdx).getString(); 165 } 166 167 168 byte[] getBytes(int colIdx) throws Exception { 169 return columnExpressions.get(colIdx).getBytes(); 170 } 171 172 173 int getDataType(int colIdx) { 174 return columnExpressions.get(colIdx).getDataType(); 175 } 176 177 178 183 184 void beforeFirst() throws Exception { 185 commandSelect.beforeFirst(); 186 } 187 188 189 boolean isBeforeFirst() throws SQLException{ 190 return commandSelect.isBeforeFirst(); 191 } 192 193 194 boolean isFirst() throws SQLException{ 195 return commandSelect.isFirst(); 196 } 197 198 199 boolean first() throws Exception { 200 return commandSelect.first(); 201 } 202 203 204 boolean previous() throws Exception { 205 return commandSelect.previous(); 206 } 207 208 209 boolean next() throws Exception { 210 return commandSelect.next(); 211 } 212 213 214 boolean last() throws Exception { 215 return commandSelect.last(); 216 } 217 218 219 boolean isLast() throws Exception { 220 return commandSelect.isLast(); 221 } 222 223 224 boolean isAfterLast() throws Exception { 225 return commandSelect.isAfterLast(); 226 } 227 228 229 void afterLast() throws Exception { 230 commandSelect.afterLast(); 231 } 232 233 234 boolean absolute(int row) throws Exception { 235 return commandSelect.absolute(row); 236 } 237 238 239 boolean relative(int rows) throws Exception { 240 return commandSelect.relative(rows); 241 } 242 243 244 int getRow() throws Exception { 245 return commandSelect.getRow(); 246 } 247 248 249 long getRowPosition() { 250 return commandSelect.join.getRowPosition(); 251 } 252 253 254 void setRowPosition(long rowPosition) throws Exception { 255 commandSelect.join.setRowPosition(rowPosition); 256 } 257 258 259 final boolean rowInserted(){ 260 return commandSelect.join.rowInserted(); 261 } 262 263 264 final boolean rowDeleted(){ 265 return commandSelect.join.rowDeleted(); 266 } 267 268 269 void nullRow() { 270 commandSelect.join.nullRow(); 271 272 } 273 274 275 void noRow() { 276 commandSelect.join.noRow(); 277 } 278 279 280 final void execute() throws Exception { 281 commandSelect.join.execute(); 282 } 283 } 284 | Popular Tags |