(ZDelete s, TransactionId tid)
| 391 | } |
| 392 | |
| 393 | public Query handleDeleteStatement(ZDelete s, TransactionId tid) |
| 394 | throws |
| 395 | simpledb.ParsingException, IOException, ParseException { |
| 396 | int id; |
| 397 | try { |
| 398 | id = Database.getCatalog().getTableId(s.getTable()); // will fall |
| 399 | // through if |
| 400 | // table |
| 401 | // doesn't |
| 402 | // exist |
| 403 | } catch (NoSuchElementException e) { |
| 404 | throw new simpledb.ParsingException("Unknown table : " |
| 405 | + s.getTable()); |
| 406 | } |
| 407 | String name = s.getTable(); |
| 408 | Query sdbq = new Query(tid); |
| 409 | |
| 410 | LogicalPlan lp = new LogicalPlan(); |
| 411 | lp.setQuery(s.toString()); |
| 412 | |
| 413 | lp.addScan(id, name); |
| 414 | if (s.getWhere() != null) |
| 415 | processExpression(tid, (ZExpression) s.getWhere(), lp); |
| 416 | lp.addProjectField("null.*", null); |
| 417 | |
| 418 | OpIterator op = new Delete(tid, lp.physicalPlan(tid, |
| 419 | TableStats.getStatsMap(), false)); |
| 420 | sdbq.setPhysicalPlan(op); |
| 421 | |
| 422 | return sdbq; |
| 423 | |
| 424 | } |
| 425 | |
| 426 | public void handleTransactStatement(ZTransactStmt s) |
| 427 | throws IOException, |
no test coverage detected