@Override
 public ODLTableDefinition deepCopyWithShallowValueCopy(int tableId) {
   ODLTableDefinition t = readOnlyTable(tableId);
   if (t != null) {
     return t.deepCopyWithShallowValueCopy();
   }
   return null;
 }
 @Override
 public T createTable(String tablename, int tableId) {
   if (isWriteAllowed()) {
     ODLTableDefinition dfn =
         ((ODLDatastoreAlterable<? extends T>) decorated).createTable(tablename, tableId);
     if (dfn != null) {
       return getTableByImmutableId(dfn.getImmutableId());
     }
   }
   return null;
 }
 @Override
 public boolean setTableName(int tableId, String newName) {
   ODLTableDefinition dfn = TableUtils.findTable(this, newName, true);
   if (dfn != null && dfn.getImmutableId() != tableId) {
     return false;
   }
   ODLTableDefinitionImpl table = (ODLTableDefinitionImpl) tablesById.get(tableId);
   if (table != null) {
     table.setName(newName);
   }
   return true;
 }
 @Override
 public ScriptAdapterTable addSourcedTableToAdapter(
     String datastoreId, ODLTableDefinition source, ODLTableDefinition destination) {
   AdaptedTableConfig table =
       TableLinkerWizard.createBestGuess(
           source, destination, TableLinkerWizard.FLAG_USE_ROWID_FOR_LOCATION_KEY);
   table.setName(destination.getName());
   table.setFromDatastore(datastoreId);
   return addAdaptedTable(table);
 }
  @Override
  public Command doCommand(ODLDatastore<? extends ODLTableDefinition> database) {
    ODLDatastoreAlterable<? extends ODLTableDefinition> upcast =
        (ODLDatastoreAlterable<? extends ODLTableDefinition>) database;
    ODLTableDefinition table = upcast.getTableByImmutableId(tableId);
    if (table == null) {
      return null;
    }

    if (table.getColumnCount() > 0
        || (ODLTableReadOnly.class.isInstance(table)
            && ((ODLTableReadOnly) table).getRowCount() > 0)) {
      throw new RuntimeException();
    }

    //	System.out.println("Deleting table with id " + tableId);

    long flags = table.getFlags();
    String name = table.getName();
    upcast.deleteTableById(tableId);
    return new CreateTable(name, tableId, flags);
  }