MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / handleDeleteStatement

Method handleDeleteStatement

src/java/simpledb/Parser.java:393–424  ·  view source on GitHub ↗
(ZDelete s, TransactionId tid)

Source from the content-addressed store, hash-verified

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,

Callers 1

processNextStatementMethod · 0.95

Calls 10

getCatalogMethod · 0.95
setQueryMethod · 0.95
addScanMethod · 0.95
processExpressionMethod · 0.95
addProjectFieldMethod · 0.95
physicalPlanMethod · 0.95
getStatsMapMethod · 0.95
setPhysicalPlanMethod · 0.95
getTableIdMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected